XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 1 | // Copyright (c) Facebook, Inc. and its affiliates. |
| 2 | // All rights reserved. |
| 3 | // |
| 4 | // Copyright 2019 Google LLC |
| 5 | // |
| 6 | // This source code is licensed under the BSD-style license found in the |
| 7 | // LICENSE file in the root directory of this source tree. |
| 8 | |
| 9 | #include <stdlib.h> |
| 10 | |
| 11 | #include <xnnpack.h> |
| 12 | #include <xnnpack/allocator.h> |
| 13 | #include <xnnpack/log.h> |
| 14 | #include <xnnpack/operator.h> |
| 15 | #include <xnnpack/params.h> |
| 16 | |
| 17 | |
| 18 | enum xnn_status xnn_delete_operator(xnn_operator_t op) |
| 19 | { |
| 20 | if (!xnn_params.initialized) { |
| 21 | xnn_log_error("failed to delete operator: XNNPACK is not initialized"); |
| 22 | return xnn_status_uninitialized; |
| 23 | } |
| 24 | |
| 25 | if (op == NULL) { |
| 26 | return xnn_status_invalid_parameter; |
| 27 | } |
| 28 | |
Marat Dukhan | 04f03be | 2019-11-19 12:36:47 -0800 | [diff] [blame] | 29 | xnn_release_memory(op->indirection_buffer); |
| 30 | xnn_release_simd_memory(op->packed_weights); |
| 31 | xnn_release_simd_memory(op->zero_buffer); |
| 32 | xnn_release_memory(op->pixelwise_buffer); |
| 33 | xnn_release_memory(op->subconvolution_buffer); |
| 34 | xnn_release_simd_memory(op->lookup_table); |
| 35 | xnn_release_simd_memory(op); |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 36 | return xnn_status_success; |
| 37 | } |