Elffuss BraidHub

kikocis/ncnn public

master · 4.4 KiBRawPermalink
1// Tencent is pleased to support the open source community by making ncnn available.
2//
3// Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
4//
5// Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6// in compliance with the License. You may obtain a copy of the License at
7//
8// https://opensource.org/licenses/BSD-3-Clause
9//
10// Unless required by applicable law or agreed to in writing, software distributed
11// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12// CONDITIONS OF ANY KIND, either express or implied. See the License for the
13// specific language governing permissions and limitations under the License.
14
15#include "pass_level2.h"
16
17namespace pnnx {
18
19class F_upsample_nearest : public GraphRewriterPass
20{
21public:
22 const char* match_pattern_graph() const
23 {
24 return R"PNNXIR(7767517
256 5
26pnnx.Input input_0 0 1 input
27pnnx.Input input_1 0 1 size
28prim::Constant op_0 0 1 scale_h value=None
29prim::Constant op_1 0 1 scale_w value=None
30aten::upsample_nearest2d op_2 4 1 input size scale_h scale_w out
31pnnx.Output output 1 0 out
32)PNNXIR";
33 }
34
35 const char* type_str() const
36 {
37 return "F.upsample_nearest";
38 }
39};
40
41REGISTER_GLOBAL_PNNX_GRAPH_REWRITER_PASS(F_upsample_nearest, 10)
42
43class F_upsample_nearest_1 : public GraphRewriterPass
44{
45public:
46 const char* match_pattern_graph() const
47 {
48 return R"PNNXIR(7767517
495 4
50pnnx.Input input_0 0 1 input
51pnnx.Input input_1 0 1 scale_factor
52prim::Constant op_0 0 1 size value=None
53aten::upsample_nearest2d op_1 3 1 input size scale_factor out
54pnnx.Output output 1 0 out
55)PNNXIR";
56 }
57
58 const char* type_str() const
59 {
60 return "F.upsample_nearest";
61 }
62};
63
64REGISTER_GLOBAL_PNNX_GRAPH_REWRITER_PASS(F_upsample_nearest_1, 10)
65
66class F_upsample_nearest_1_1 : public GraphRewriterPass
67{
68public:
69 const char* match_pattern_graph() const
70 {
71 return R"PNNXIR(7767517
725 4
73pnnx.Input input_0 0 1 input
74pnnx.Input input_1 0 1 size
75prim::Constant op_0 0 1 scale_factor value=None
76aten::upsample_nearest2d op_1 3 1 input size scale_factor out
77pnnx.Output output 1 0 out
78)PNNXIR";
79 }
80
81 const char* type_str() const
82 {
83 return "F.upsample_nearest";
84 }
85};
86
87REGISTER_GLOBAL_PNNX_GRAPH_REWRITER_PASS(F_upsample_nearest_1_1, 10)
88
89class F_upsample_nearest_2 : public GraphRewriterPass
90{
91public:
92 const char* match_pattern_graph() const
93 {
94 return R"PNNXIR(7767517
957 6
96pnnx.Input input_0 0 1 input
97pnnx.Input input_1 0 1 size
98prim::Constant op_0 0 1 scale_d value=None
99prim::Constant op_1 0 1 scale_h value=None
100prim::Constant op_2 0 1 scale_w value=None
101aten::upsample_nearest3d op_3 5 1 input size scale_d scale_h scale_w out
102pnnx.Output output 1 0 out
103)PNNXIR";
104 }
105
106 const char* type_str() const
107 {
108 return "F.upsample_nearest";
109 }
110};
111
112REGISTER_GLOBAL_PNNX_GRAPH_REWRITER_PASS(F_upsample_nearest_2, 10)
113
114class F_upsample_nearest_2_1 : public GraphRewriterPass
115{
116public:
117 const char* match_pattern_graph() const
118 {
119 return R"PNNXIR(7767517
1205 4
121pnnx.Input input_0 0 1 input
122pnnx.Input input_1 0 1 size
123prim::Constant op_0 0 1 scale_factor value=None
124aten::upsample_nearest3d op_1 3 1 input size scale_factor out
125pnnx.Output output 1 0 out
126)PNNXIR";
127 }
128
129 const char* type_str() const
130 {
131 return "F.upsample_nearest";
132 }
133};
134
135REGISTER_GLOBAL_PNNX_GRAPH_REWRITER_PASS(F_upsample_nearest_2_1, 10)
136
137class F_upsample_nearest_3 : public GraphRewriterPass
138{
139public:
140 const char* match_pattern_graph() const
141 {
142 return R"PNNXIR(7767517
1435 4
144pnnx.Input input_0 0 1 input
145pnnx.Input input_1 0 1 scale_factor
146prim::Constant op_0 0 1 size value=None
147aten::upsample_nearest3d op_1 3 1 input size scale_factor out
148pnnx.Output output 1 0 out
149)PNNXIR";
150 }
151
152 const char* type_str() const
153 {
154 return "F.upsample_nearest";
155 }
156};
157
158REGISTER_GLOBAL_PNNX_GRAPH_REWRITER_PASS(F_upsample_nearest_3, 10)
159
160} // namespace pnnx