ncnn

Форк
0
/
ncnn_ops.td 
133 строки · 3.0 Кб
1
// Tencent is pleased to support the open source community by making ncnn available.
2
//
3
// Copyright (C) 2020 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
#ifndef NCNN_OPS_TD
16
#define NCNN_OPS_TD
17

18
include "mlir/IR/OpBase.td"
19
include "mlir/Interfaces/SideEffectInterfaces.td"
20
include "tf_op_base.td"
21

22
def NCNN_Dialect : Dialect {
23
  let name = "ncnn";
24
  let cppNamespace = "ncnn";
25
}
26

27
//===----------------------------------------------------------------------===//
28
// NCNN op definitions
29
//===----------------------------------------------------------------------===//
30

31
class NCNN_Op<string mnemonic, list<OpTrait> traits = []> :
32
    Op<NCNN_Dialect, mnemonic, traits>;
33

34
//===----------------------------------------------------------------------===//
35
// NCNN operations
36
//===----------------------------------------------------------------------===//
37

38
def NCNN_KerasConv2DOp : NCNN_Op<"KerasConv2D", [NoSideEffect]> {
39

40
  let arguments = (ins
41
    F32Tensor:$x,
42
    F32Tensor:$weight,
43
    F32Tensor:$bias,
44

45
    I64ArrayAttr:$strides,
46
    TF_AnyStrAttrOf<["SAME", "VALID", "EXPLICIT"]>:$padding,
47
    DefaultValuedAttr<I64ArrayAttr, "{}">:$explicit_paddings,
48
    DefaultValuedAttr<I64ArrayAttr, "{1, 1, 1, 1}">:$dilations
49
  );
50

51
  let results = (outs
52
    F32Tensor:$y
53
  );
54
}
55

56
def NCNN_KerasDenseOp : NCNN_Op<"KerasDense", [NoSideEffect]> {
57

58
  let arguments = (ins
59
    F32Tensor:$x,
60
    F32Tensor:$weight,
61
    F32Tensor:$bias
62
  );
63

64
  let results = (outs
65
    F32Tensor:$y
66
  );
67
}
68

69
def NCNN_KerasBatchNormOp : NCNN_Op<"KerasBatchNorm", [NoSideEffect]> {
70

71
  let arguments = (ins
72
    F32Tensor:$x,
73
    F32Tensor:$gamma,
74
    F32Tensor:$bias
75
  );
76

77
  let results = (outs
78
    F32Tensor:$y
79
  );
80
}
81

82
def NCNN_BinaryOpOp : NCNN_Op<"BinaryOp", [NoSideEffect]> {
83

84
  let arguments = (ins
85
    F32Tensor:$x,
86
    I32Attr:$op_type,
87
    I32Attr:$with_scalar,
88
    F32Attr:$b
89
  );
90

91
  let results = (outs
92
    F32Tensor:$y
93
  );
94
}
95

96
def NCNN_InstanceNormOp : NCNN_Op<"InstanceNorm", [NoSideEffect]> {
97

98
  let arguments = (ins
99
    F32Tensor:$x,
100
    F32Attr:$epsilon
101
  );
102

103
  let results = (outs
104
    F32Tensor:$y
105
  );
106
}
107

108
def NCNN_InstanceNormAffineOp : NCNN_Op<"InstanceNormAffine", [NoSideEffect]> {
109

110
  let arguments = (ins
111
    F32Tensor:$x,
112
    F32Tensor:$gamma,
113
    F32Tensor:$beta,
114
    F32Attr:$epsilon
115
  );
116

117
  let results = (outs
118
    F32Tensor:$y
119
  );
120
}
121

122
def NCNN_SwishOp : NCNN_Op<"Swish", [NoSideEffect]> {
123

124
  let arguments = (ins
125
    F32Tensor:$x
126
  );
127

128
  let results = (outs
129
    F32Tensor:$y
130
  );
131
}
132

133
#endif // NCNN_OPS_TD
134

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.