• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2023 Huawei Technologies Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "nnacl/kernel/default_kernel_base.h"
18 
DefaultPrepare3In1Out(KernelBase * self)19 int DefaultPrepare3In1Out(KernelBase *self) {
20   NNACL_CHECK_FALSE(self->in_size_ < THREE_TENSOR, NNACL_ERR);
21   NNACL_CHECK_FALSE(self->out_size_ < ONE_TENSOR, NNACL_ERR);
22   return NNACL_OK;
23 }
24 
DefaultPrepare3In2Out(KernelBase * self)25 int DefaultPrepare3In2Out(KernelBase *self) {
26   NNACL_CHECK_FALSE(self->in_size_ < THREE_TENSOR, NNACL_ERR);
27   NNACL_CHECK_FALSE(self->out_size_ < TWO_TENSOR, NNACL_ERR);
28   return NNACL_OK;
29 }
30 
DefaultPrepare1In2Out(KernelBase * self)31 int DefaultPrepare1In2Out(KernelBase *self) {
32   NNACL_CHECK_FALSE(self->in_size_ < ONE_TENSOR, NNACL_ERR);
33   NNACL_CHECK_FALSE(self->out_size_ < TWO_TENSOR, NNACL_ERR);
34   return NNACL_OK;
35 }
36 
DefaultPrepare1In1Out(KernelBase * self)37 int DefaultPrepare1In1Out(KernelBase *self) {
38   NNACL_CHECK_FALSE(self->in_size_ < ONE_TENSOR, NNACL_ERR);
39   NNACL_CHECK_FALSE(self->out_size_ < ONE_TENSOR, NNACL_ERR);
40   return NNACL_OK;
41 }
42 
DefaultPrepare2In1Out(KernelBase * self)43 int DefaultPrepare2In1Out(KernelBase *self) {
44   NNACL_CHECK_FALSE(self->in_size_ < TWO_TENSOR, NNACL_ERR);
45   NNACL_CHECK_FALSE(self->out_size_ < ONE_TENSOR, NNACL_ERR);
46   return NNACL_OK;
47 }
48 
DefaultResize(KernelBase * self)49 int DefaultResize(KernelBase *self) {
50   NNACL_CHECK_NULL_RETURN_ERR(self->in_[FIRST_INPUT]);
51   NNACL_CHECK_NULL_RETURN_ERR(self->out_[OUTPUT_INDEX]);
52   return NNACL_OK;
53 }
54 
DefaultRelease(KernelBase * self)55 int DefaultRelease(KernelBase *self) { return NNACL_OK; }
56