ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TransposeConv.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved
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#ifndef __KBENCHMARK_OPERATIONS_TRANSPOSE_CONV_H__
18#define __KBENCHMARK_OPERATIONS_TRANSPOSE_CONV_H__
19
20#include "Operation.h"
21#include "Utils.h"
22
23namespace kbenchmark
24{
25namespace operation
26{
27
28class TransposeConv final : public Operation
29{
30public:
31 TransposeConv() = default;
32
33 nonius::parameters params(int layer_num, OperationInfo &info) override
34 {
35 nonius::parameters params;
36
37 params.insert({"LAYER", nonius::param{layer_num}});
38
39 params.insert({"BATCH", nonius::param{1}});
40
41 // TODO The output_shape will be used in Dynamic tensor case
42 auto _output_shape = get_key_dims({"input0"}, info);
43
44 auto _weights = get_key_dims({"input1"}, info);
45 params.insert({"KER_H", nonius::param{_weights[1]}});
46 params.insert({"KER_W", nonius::param{_weights[2]}});
47
48 auto _input = get_key_dims({"input2"}, info);
49 params.insert({"IFM_H", nonius::param{_input[1]}});
50 params.insert({"IFM_W", nonius::param{_input[2]}});
51 params.insert({"IFM_C", nonius::param{_input[3]}});
52
53 auto _output = get_key_dims({"output0"}, info);
54 params.insert({"OFM_H", nonius::param{_output[1]}});
55 params.insert({"OFM_W", nonius::param{_output[2]}});
56 params.insert({"OFM_C", nonius::param{_output[3]}});
57
58 auto _stride_h = get_key_int({"stride_h"}, info);
59 auto _stride_w = get_key_int({"stride_w"}, info);
60 params.insert({"STRIDE_H", nonius::param{_stride_h}});
61 params.insert({"STRIDE_W", nonius::param{_stride_w}});
62
63 auto _pad = get_key_string({"padding"}, info);
64 params.insert({"PADDING", nonius::param{_pad}});
65
66 return params;
67 }
68};
69
70} // namespace operation
71} // namespace kbenchmark
72
73#endif // __KBENCHMARK_OPERATIONS_TRANSPOSE_CONV_H__
nonius::parameters params(int layer_num, OperationInfo &info) override
nnfw::cker::Shape _output_shape
volatile const char info[]
int get_key_int(const std::string &key, OperationInfo &info)
Definition Utils.h:56
std::map< std::string, std::string > OperationInfo
Definition ConfigFile.h:62
std::string get_key_string(const std::string &key, OperationInfo &info)
Definition Utils.h:62
std::vector< int > get_key_dims(const std::string &key, OperationInfo &info)
Definition Utils.h:50