blob: 3e0eeaab3848cd8d79c34778cd1a6b79f6cef208 [file] [log] [blame]
XNNPACK Teamb455b122019-09-27 18:10:33 -07001// 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
18enum 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 Dukhan04f03be2019-11-19 12:36:47 -080029 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 Teamb455b122019-09-27 18:10:33 -070036 return xnn_status_success;
37}