"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WEBGL_OP_RESOLVE_RULES = void 0;
const operators_1 = require("../../operators");
const batch_normalization_1 = require("./ops/batch-normalization");
const binaryOps = __importStar(require("./ops/binary-op"));
const clip_1 = require("./ops/clip");
const concat_1 = require("./ops/concat");
const conv_1 = require("./ops/conv");
const dropout_1 = require("./ops/dropout");
const elu_1 = require("./ops/elu");
const flatten_1 = require("./ops/flatten");
const gather_1 = require("./ops/gather");
const gemm_1 = require("./ops/gemm");
const image_scaler_1 = require("./ops/image-scaler");
const instance_normalization_1 = require("./ops/instance-normalization");
const leaky_relu_1 = require("./ops/leaky-relu");
const matmul_1 = require("./ops/matmul");
const pad_1 = require("./ops/pad");
const pool_1 = require("./ops/pool");
const reduceOps = __importStar(require("./ops/reduce"));
const reshape_1 = require("./ops/reshape");
const resize_packed_1 = require("./ops/resize-packed");
const slice_1 = require("./ops/slice");
const softmax_1 = require("./ops/softmax");
const split_1 = require("./ops/split");
const squeeze_1 = require("./ops/squeeze");
const sum_1 = require("./ops/sum");
const tile_1 = require("./ops/tile");
const transpose_1 = require("./ops/transpose");
const unaryOps = __importStar(require("./ops/unary-op"));
const unsqueeze_1 = require("./ops/unsqueeze");
const upsample_1 = require("./ops/upsample");
exports.WEBGL_OP_RESOLVE_RULES = [
    ['Abs', '', '6+', () => new unaryOps.WebGLUnaryOp(operators_1.NUMBER_TYPES, unaryOps.glslAbs())],
    ['Acos', '', '7+', () => new unaryOps.WebGLUnaryOp(operators_1.FLOAT_TYPES, unaryOps.glslAcos())],
    ['Add', '', '7+', () => new binaryOps.WebGLBinaryOp(operators_1.NUMBER_TYPES, binaryOps.glslAdd())],
    ['And', '', '7+', () => new binaryOps.WebGLBinaryOp(['bool'], binaryOps.glslAnd())],
    ['Asin', '', '7+', () => new unaryOps.WebGLUnaryOp(operators_1.FLOAT_TYPES, unaryOps.glslAsin())],
    ['Atan', '', '7+', () => new unaryOps.WebGLUnaryOp(operators_1.FLOAT_TYPES, unaryOps.glslAtan())],
    ['AveragePool', '', '7-10', () => new pool_1.WebGLAveragePool()],
    ['BatchNormalization', '', '7+', () => new batch_normalization_1.WebGLBatchNormalization()],
    ['Ceil', '', '6+', () => new unaryOps.WebGLUnaryOp(operators_1.FLOAT_TYPES, unaryOps.glslCeil())],
    ['Clip', '', '6-10', () => new clip_1.WebGLClip()],
    ['Concat', '', '4+', () => new concat_1.WebGLConcat()],
    ['Conv', '', '1+', () => new conv_1.WebGLConv()],
    ['Cos', '', '7+', () => new unaryOps.WebGLUnaryOp(operators_1.FLOAT_TYPES, unaryOps.glslCos())],
    ['Div', '', '7+', () => new binaryOps.WebGLBinaryOp(operators_1.NUMBER_TYPES, binaryOps.glslDiv())],
    ['Dropout', '', '7+', () => new dropout_1.WebGLDropout()],
    ['Equal', '', '7+', () => new binaryOps.WebGLBinaryOp(operators_1.NUMBER_TYPES, binaryOps.glslEqual(), undefined, 'bool')],
    ['Elu', '', '6+', () => new elu_1.WebGLElu()],
    ['Exp', '', '6+', () => new unaryOps.WebGLUnaryOp(operators_1.FLOAT_TYPES, unaryOps.glslExp())],
    ['Flatten', '', '1+', () => new flatten_1.WebGLFlatten()],
    ['Floor', '', '6+', () => new unaryOps.WebGLUnaryOp(operators_1.FLOAT_TYPES, unaryOps.glslFloor())],
    ['Gather', '', '1+', () => new gather_1.WebGLGather()],
    ['Gemm', '', '7-10', () => new gemm_1.WebGLGemm(false)],
    ['Gemm', '', '11+', () => new gemm_1.WebGLGemm(true)],
    ['GlobalAveragePool', '', '1+', () => new pool_1.WebGLGlobalAveragePool()],
    ['GlobalMaxPool', '', '1+', () => new pool_1.WebGLGlobalMaxPool()],
    ['Greater', '', '7+', () => new binaryOps.WebGLBinaryOp(operators_1.NUMBER_TYPES, binaryOps.glslGreater(), undefined, 'bool')],
    ['Identity', '', '1+', () => new unaryOps.WebGLUnaryOp(operators_1.NUMBER_TYPES, unaryOps.glslIdentity())],
    ['ImageScaler', '', '1+', () => new image_scaler_1.WebGLImageScaler()],
    ['InstanceNormalization', '', '6+', () => new instance_normalization_1.WebGLInstanceNormalization()],
    ['LeakyRelu', '', '6+', () => new leaky_relu_1.WebGLLeakyRelu()],
    ['Less', '', '7+', () => new binaryOps.WebGLBinaryOp(operators_1.NUMBER_TYPES, binaryOps.glslLess(), undefined, 'bool')],
    ['Log', '', '6+', () => new unaryOps.WebGLUnaryOp(operators_1.FLOAT_TYPES, unaryOps.glslLog())],
    ['MatMul', '', '1+', () => new matmul_1.WebGLMatMul()],
    ['MaxPool', '', '1-9', () => new pool_1.WebGLMaxPool()],
    ['Mul', '', '7+', () => new binaryOps.WebGLBinaryOp(operators_1.NUMBER_TYPES, binaryOps.glslMul())],
    ['Neg', '', '6+', () => new unaryOps.WebGLUnaryOp(operators_1.NUMBER_TYPES, unaryOps.glslNeg())],
    ['Not', '', '1+', () => new unaryOps.WebGLUnaryOp(['bool'], unaryOps.glslNot())],
    ['Or', '', '7+', () => new binaryOps.WebGLBinaryOp(['bool'], binaryOps.glslOr())],
    ['Pad', '', '2-10', () => new pad_1.WebGLPad()],
    ['Pow', '', '7+', () => new binaryOps.WebGLBinaryOp(operators_1.FLOAT_TYPES, binaryOps.glslPow())],
    ['PRelu', '', '7+', () => new binaryOps.WebGLBinaryOp(operators_1.FLOAT_TYPES, binaryOps.glslPRelu())],
    ['ReduceLogSum', '', '1+', () => new reduceOps.WebGLReduceLogSum()],
    ['ReduceMax', '', '1+', () => new reduceOps.WebGLReduceMax()],
    ['ReduceMean', '', '1+', () => new reduceOps.WebGLReduceMean()],
    ['ReduceMin', '', '1+', () => new reduceOps.WebGLReduceMin()],
    ['ReduceProd', '', '1+', () => new reduceOps.WebGLReduceProd()],
    ['ReduceSum', '', '1+', () => new reduceOps.WebGLReduceSum()],
    ['ReduceSumSquare', '', '1+', () => new reduceOps.WebGLReduceSumSquare()],
    ['Relu', '', '6+', () => new unaryOps.WebGLUnaryOp(operators_1.FLOAT_TYPES, unaryOps.glslRelu())],
    ['Reshape', '', '5+', () => new reshape_1.WebGLReshape()],
    ['Resize', '', '10', () => new resize_packed_1.WebGLResizePacked(10)],
    ['Resize', '', '11+', () => new resize_packed_1.WebGLResizePacked(11)],
    ['Sigmoid', '', '6+', () => new unaryOps.WebGLUnaryOp(operators_1.FLOAT_TYPES, unaryOps.glslSigmoid())],
    ['Sin', '', '7+', () => new unaryOps.WebGLUnaryOp(operators_1.FLOAT_TYPES, unaryOps.glslSin())],
    ['Slice', '', '10+', () => new slice_1.WebGLSliceV10()],
    ['Slice', '', '1-9', () => new slice_1.WebGLSlice()],
    ['Softmax', '', '1+', () => new softmax_1.WebGLSoftmax()],
    // 'Split' operator has an optional attribute 'split'
    // this attribute determines how the specified axis of input data
    // is split. When the attribute is missing, we need the count of number of outputs
    // so that we can determine the 'split' attribute from the runtime input to the Operator
    ['Split', '', '2+', (node) => new split_1.WebGLSplit(node.outputs.length)],
    ['Sqrt', '', '6+', () => new unaryOps.WebGLUnaryOp(operators_1.FLOAT_TYPES, unaryOps.glslSqrt())],
    ['Squeeze', '', '1+', () => new squeeze_1.WebGLSqueeze()],
    ['Sub', '', '7+', () => new binaryOps.WebGLBinaryOp(operators_1.NUMBER_TYPES, binaryOps.glslSub())],
    ['Sum', '', '6+', () => new sum_1.WebGLSum()],
    ['Tan', '', '7+', () => new unaryOps.WebGLUnaryOp(operators_1.FLOAT_TYPES, unaryOps.glslTan())],
    ['Tanh', '', '6+', () => new unaryOps.WebGLUnaryOp(operators_1.FLOAT_TYPES, unaryOps.glslTanh())],
    ['Tile', '', '6+', () => new tile_1.WebGLTile()],
    ['Transpose', '', '1+', () => new transpose_1.WebGLTranspose()],
    ['Upsample', '', '7-8', () => new upsample_1.WebGLUpsample(7)],
    ['Upsample', '', '9', () => new upsample_1.WebGLUpsample(9)],
    ['Unsqueeze', '', '1+', () => new unsqueeze_1.WebGLUnsqueeze()],
    ['Xor', '', '7+', () => new binaryOps.WebGLBinaryOp(['bool'], binaryOps.glslXor())],
];
//# sourceMappingURL=op-resolve-rules.js.map