onnxruntime

Форк
0
/
op-resolve-rules.ts 
143 строки · 6.9 Кб
1
// Copyright (c) Microsoft Corporation. All rights reserved.
2
// Licensed under the MIT License.
3

4
import { OpSet } from '../../opset';
5

6
import { batchNormalization, parseBatchNormalizationAttributes } from './ops/batch-normalization';
7
import * as binaryOps from './ops/binary-op';
8
import { cast, parseCastAttributes } from './ops/cast';
9
import { concat, parseConcatAttributes } from './ops/concat';
10
import { conv, parseConvAttributes } from './ops/conv';
11
import { convTranspose, parseConvTransposeAttributes } from './ops/conv-transpose';
12
import { depthToSpace, parseDepthToSpaceAttributes } from './ops/depth-to-space';
13
import { flatten, parseFlattenAttributes } from './ops/flatten';
14
import { gather, parseGatherAttributes } from './ops/gather';
15
import { gemm, parseGemmAttributesV11, parseGemmAttributesV7 } from './ops/gemm';
16
import { imageScaler, parseImageScalerAttributes } from './ops/image-scaler';
17
import { instanceNormalization, parseInstanceNormalizationAttributes } from './ops/instance-normalization';
18
import { lrn, parseLrnAttributes } from './ops/lrn';
19
import { matMul, parseMatMulAttributes } from './ops/matmul';
20
import { padV11, padV2, parsePadAttributesV11, parsePadAttributesV2 } from './ops/pad';
21
import {
22
  averagePool,
23
  globalAveragePool,
24
  globalMaxPool,
25
  maxPool,
26
  parseAveragePoolAttributes,
27
  parseGlobalAveragePoolAttributes,
28
  parseMaxPoolAttributes,
29
} from './ops/pool';
30
import {
31
  parseReduceAttributes,
32
  reduceLogSum,
33
  reduceLogSumSquare,
34
  reduceMax,
35
  reduceMean,
36
  reduceMin,
37
  reduceProd,
38
  reduceSum,
39
} from './ops/reduce';
40
import { reshape } from './ops/reshape';
41
import { parseResizeAttributesV10, parseResizeAttributesV11, resize } from './ops/resize-packed';
42
import { shape } from './ops/shape';
43
import { parseSliceAttributes, slice, sliceV10 } from './ops/slice';
44
import { parseSoftmaxAttributes, parseSoftmaxAttributesV13, softmax, softmaxV13 } from './ops/softmax';
45
import { parseSplitAttributes, split } from './ops/split';
46
import { parseSqueezeAttributes, squeeze, squeezeV13 } from './ops/squeeze';
47
import { sum } from './ops/sum';
48
import { tile } from './ops/tile';
49
import { parseTransposeAttributes, transpose } from './ops/transpose';
50
import * as unaryOps from './ops/unary-op';
51
import { parseUnsqueezeAttributes, unsqueeze, unsqueezeV13 } from './ops/unsqueeze';
52
import { parseUpsampleAttributesV7, parseUpsampleAttributesV9, upsample } from './ops/upsample';
53

54
export const WEBGL_OP_RESOLVE_RULES: readonly OpSet.ResolveRule[] = [
55
  ['Abs', '', '6+', unaryOps.abs],
56
  ['Acos', '', '7+', unaryOps.acos],
57
  ['Add', '', '7+', binaryOps.add],
58
  ['And', '', '7+', binaryOps.and],
59
  ['Asin', '', '7+', unaryOps.asin],
60
  ['Atan', '', '7+', unaryOps.atan],
61
  // TODO: support new attributes for AveragePool-10
62
  ['AveragePool', '', '7+', averagePool, parseAveragePoolAttributes],
63
  ['BatchNormalization', '', '7+', batchNormalization, parseBatchNormalizationAttributes],
64
  ['Cast', '', '6+', cast, parseCastAttributes],
65
  ['Ceil', '', '6+', unaryOps.ceil],
66
  ['Clip', '', '6-10', unaryOps.clip, unaryOps.parseClipAttributes],
67
  ['Clip', '', '11+', unaryOps.clipV11],
68
  ['Concat', '', '4+', concat, parseConcatAttributes],
69
  ['Conv', '', '1+', conv, parseConvAttributes],
70
  ['ConvTranspose', '', '1+', convTranspose, parseConvTransposeAttributes],
71
  ['Cos', '', '7+', unaryOps.cos],
72
  ['Div', '', '7+', binaryOps.div],
73
  ['Dropout', '', '7+', unaryOps.identity],
74
  ['DepthToSpace', '', '1+', depthToSpace, parseDepthToSpaceAttributes],
75
  ['Equal', '', '7+', binaryOps.equal],
76
  ['Elu', '', '6+', unaryOps.elu, unaryOps.parseEluAttributes],
77
  ['Exp', '', '6+', unaryOps.exp],
78
  ['Flatten', '', '1+', flatten, parseFlattenAttributes],
79
  ['Floor', '', '6+', unaryOps.floor],
80
  ['FusedConv', 'com.microsoft', '1+', conv, parseConvAttributes],
81
  ['Gather', '', '1+', gather, parseGatherAttributes],
82
  ['Gemm', '', '7-10', gemm, parseGemmAttributesV7],
83
  ['Gemm', '', '11+', gemm, parseGemmAttributesV11],
84
  ['GlobalAveragePool', '', '1+', globalAveragePool, parseGlobalAveragePoolAttributes],
85
  ['GlobalMaxPool', '', '1+', globalMaxPool],
86
  ['Greater', '', '7+', binaryOps.greater],
87
  ['Identity', '', '1+', unaryOps.identity],
88
  ['ImageScaler', '', '1+', imageScaler, parseImageScalerAttributes],
89
  ['InstanceNormalization', '', '6+', instanceNormalization, parseInstanceNormalizationAttributes],
90
  ['LeakyRelu', '', '6+', unaryOps.leakyRelu, unaryOps.parseLeakyReluAttributes],
91
  ['Less', '', '7+', binaryOps.less],
92
  ['LRN', '', '1+', lrn, parseLrnAttributes],
93
  ['Log', '', '6+', unaryOps.log],
94
  ['MatMul', '', '1+', matMul, parseMatMulAttributes],
95
  // TODO: support new attributes for MaxPool-8 and MaxPool-10
96
  ['MaxPool', '', '1+', maxPool, parseMaxPoolAttributes],
97
  ['Mul', '', '7+', binaryOps.mul],
98
  ['Neg', '', '6+', unaryOps.neg],
99
  ['Not', '', '1+', unaryOps.not],
100
  ['Or', '', '7+', binaryOps.or],
101
  ['Pad', '', '2-10', padV2, parsePadAttributesV2],
102
  ['Pad', '', '11+', padV11, parsePadAttributesV11],
103
  ['Pow', '', '7+', binaryOps.pow],
104
  ['PRelu', '', '7+', binaryOps.pRelu],
105
  ['ReduceLogSum', '', '1+', reduceLogSum, parseReduceAttributes],
106
  ['ReduceMax', '', '1+', reduceMax, parseReduceAttributes],
107
  ['ReduceMean', '', '1+', reduceMean, parseReduceAttributes],
108
  ['ReduceMin', '', '1+', reduceMin, parseReduceAttributes],
109
  ['ReduceProd', '', '1+', reduceProd, parseReduceAttributes],
110
  ['ReduceSum', '', '1-12', reduceSum, parseReduceAttributes],
111
  ['ReduceSumSquare', '', '1+', reduceLogSumSquare, parseReduceAttributes],
112
  ['Relu', '', '6+', unaryOps.relu],
113
  ['Reshape', '', '5+', reshape],
114
  ['Resize', '', '10', resize, parseResizeAttributesV10],
115
  ['Resize', '', '11+', resize, parseResizeAttributesV11],
116
  ['Shape', '', '1+', shape],
117
  ['Sigmoid', '', '6+', unaryOps.sigmoid],
118
  ['Sin', '', '7+', unaryOps.sin],
119
  ['Slice', '', '10+', sliceV10], // TODO: support 'steps' for Slice-10
120
  ['Slice', '', '1-9', slice, parseSliceAttributes],
121
  // The "semantic" meaning of axis has changed in opset-13.
122
  ['Softmax', '', '1-12', softmax, parseSoftmaxAttributes],
123
  ['Softmax', '', '13+', softmaxV13, parseSoftmaxAttributesV13],
124
  // 'Split' operator has an optional attribute 'split'
125
  // this attribute determines how the specified axis of input data is split.
126
  // When the attribute is missing, we need the count of number of outputs
127
  // so that we can determine the 'split' attribute from the runtime input to the Operator
128
  ['Split', '', '2-12', split, parseSplitAttributes],
129
  ['Sqrt', '', '6+', unaryOps.sqrt],
130
  ['Squeeze', '', '1-12', squeeze, parseSqueezeAttributes],
131
  ['Squeeze', '', '13+', squeezeV13],
132
  ['Sub', '', '7+', binaryOps.sub],
133
  ['Sum', '', '6+', sum],
134
  ['Tan', '', '7+', unaryOps.tan],
135
  ['Tanh', '', '6+', unaryOps.tanh],
136
  ['Tile', '', '6+', tile],
137
  ['Transpose', '', '1+', transpose, parseTransposeAttributes],
138
  ['Upsample', '', '7-8', upsample, parseUpsampleAttributesV7],
139
  ['Upsample', '', '9', upsample, parseUpsampleAttributesV9],
140
  ['Unsqueeze', '', '1-12', unsqueeze, parseUnsqueezeAttributes],
141
  ['Unsqueeze', '', '13+', unsqueezeV13],
142
  ['Xor', '', '7+', binaryOps.xor],
143
];
144

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

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

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

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