{"version":3,"sources":["../../common/lib/backend-impl.ts","../../common/lib/backend.ts","../../common/lib/version.ts","../../common/lib/env-impl.ts","../../common/lib/env.ts","../../common/lib/tensor-conversion-impl.ts","../../common/lib/tensor-factory-impl.ts","../../common/lib/tensor-impl-type-mapping.ts","../../common/lib/tensor-utils-impl.ts","../../common/lib/tensor-impl.ts","../../common/lib/tensor.ts","../../common/lib/trace.ts","../../common/lib/inference-session-impl.ts","../../common/lib/inference-session.ts","../../common/lib/tensor-conversion.ts","../../common/lib/tensor-factory.ts","../../common/lib/onnx-model.ts","../../common/lib/onnx-value.ts","../../common/lib/training-session-impl.ts","../../common/lib/training-session.ts","../../common/lib/index.ts","../lib/onnxjs/instrument.ts","../lib/onnxjs/opset.ts","../node_modules/guid-typescript/dist/guid.js","../node_modules/long/index.js","../node_modules/flatbuffers/js/flatbuffers.mjs","../lib/onnxjs/ort-schema/flatbuffers/ort-generated.ts","../node_modules/@protobufjs/aspromise/index.js","../node_modules/@protobufjs/base64/index.js","../node_modules/@protobufjs/eventemitter/index.js","../node_modules/@protobufjs/float/index.js","../node_modules/@protobufjs/inquire/index.js","../node_modules/@protobufjs/utf8/index.js","../node_modules/@protobufjs/pool/index.js","../node_modules/protobufjs/src/util/longbits.js","../node_modules/protobufjs/src/util/minimal.js","../node_modules/protobufjs/src/writer.js","../node_modules/protobufjs/src/writer_buffer.js","../node_modules/protobufjs/src/reader.js","../node_modules/protobufjs/src/reader_buffer.js","../node_modules/protobufjs/src/rpc/service.js","../node_modules/protobufjs/src/rpc.js","../node_modules/protobufjs/src/roots.js","../node_modules/protobufjs/src/index-minimal.js","../node_modules/protobufjs/minimal.js","../lib/onnxjs/ort-schema/protobuf/onnx.js","../lib/onnxjs/util.ts","../lib/onnxjs/tensor.ts","../lib/onnxjs/backends/webgl/glsl-source.ts","../lib/onnxjs/backends/webgl/types.ts","../lib/onnxjs/backends/webgl/utils.ts","../lib/onnxjs/backends/webgl/ops/packing-utils.ts","../lib/onnxjs/backends/webgl/ops/pack.ts","../lib/onnxjs/backends/webgl/ops/reshape-packed.ts","../lib/onnxjs/backends/webgl/ops/uint8-encode.ts","../lib/onnxjs/backends/webgl/ops/unpack.ts","../lib/onnxjs/backends/webgl/texture-data-encoder.ts","../lib/onnxjs/backends/webgl/texture-layout.ts","../lib/onnxjs/backends/webgl/inference-handler.ts","../lib/onnxjs/attribute-with-cache-key.ts","../lib/onnxjs/backends/webgl/ops/batch-normalization.ts","../lib/onnxjs/backends/webgl/glsl-definitions.ts","../lib/onnxjs/backends/webgl/ops/binary-op.ts","../lib/onnxjs/backends/webgl/ops/cast.ts","../lib/onnxjs/backends/webgl/ops/concat-packed.ts","../lib/onnxjs/backends/webgl/ops/concat.ts","../lib/onnxjs/backends/webgl/ops/unary-op.ts","../lib/onnxjs/backends/webgl/ops/fuse-utils.ts","../lib/onnxjs/backends/webgl/ops/conv-grouped.ts","../lib/onnxjs/backends/webgl/ops/im2col-pack.ts","../lib/onnxjs/backends/webgl/ops/matmul.ts","../lib/onnxjs/backends/webgl/ops/matmul-pack.ts","../lib/onnxjs/backends/webgl/ops/conv-pack.ts","../lib/onnxjs/backends/webgl/ops/im2col.ts","../lib/onnxjs/backends/webgl/ops/dot-product.ts","../lib/onnxjs/backends/webgl/ops/conv.ts","../lib/onnxjs/backends/webgl/ops/conv-transpose.ts","../lib/onnxjs/backends/webgl/ops/transpose.ts","../lib/onnxjs/backends/webgl/ops/depth-to-space.ts","../lib/onnxjs/backends/webgl/ops/flatten.ts","../lib/onnxjs/operators.ts","../lib/onnxjs/backends/webgl/ops/gather.ts","../lib/onnxjs/backends/webgl/ops/gemm.ts","../lib/onnxjs/backends/webgl/ops/image-scaler.ts","../lib/onnxjs/backends/webgl/ops/instance-normalization.ts","../lib/onnxjs/backends/webgl/ops/lrn.ts","../lib/onnxjs/backends/webgl/ops/pad.ts","../lib/onnxjs/backends/webgl/ops/pool.ts","../lib/onnxjs/backends/webgl/ops/reduce.ts","../lib/onnxjs/backends/webgl/ops/reshape.ts","../lib/onnxjs/backends/webgl/ops/upsample.ts","../lib/onnxjs/backends/webgl/ops/resize-packed.ts","../lib/onnxjs/backends/webgl/ops/shape.ts","../lib/onnxjs/backends/webgl/ops/slice.ts","../lib/onnxjs/backends/webgl/ops/softmax.ts","../lib/onnxjs/backends/webgl/ops/split.ts","../lib/onnxjs/backends/webgl/ops/squeeze.ts","../lib/onnxjs/backends/webgl/ops/sum.ts","../lib/onnxjs/backends/webgl/ops/tile.ts","../lib/onnxjs/backends/webgl/ops/unsqueeze.ts","../lib/onnxjs/backends/webgl/op-resolve-rules.ts","../lib/onnxjs/backends/webgl/glsl-function-inliner.ts","../lib/onnxjs/backends/webgl/texture-layout-strategy.ts","../lib/onnxjs/backends/webgl/glsl-coordinate-lib.ts","../lib/onnxjs/backends/webgl/glsl-encoding-lib.ts","../lib/onnxjs/backends/webgl/glsl-fragcolor-lib.ts","../lib/onnxjs/backends/webgl/glsl-shape-utils-lib.ts","../lib/onnxjs/backends/webgl/glsl-vec-lib.ts","../lib/onnxjs/backends/webgl/glsl-registered-libs.ts","../lib/onnxjs/backends/webgl/glsl-preprocessor.ts","../lib/onnxjs/backends/webgl/program-manager.ts","../lib/onnxjs/backends/webgl/texture-manager.ts","../lib/onnxjs/backends/webgl/session-handler.ts","../lib/onnxjs/backends/webgl/webgl-context.ts","../lib/onnxjs/backends/webgl/webgl-context-factory.ts","../lib/onnxjs/backends/backend-webgl.ts","../lib/onnxjs/backend.ts","../lib/onnxjs/execution-plan.ts","../lib/onnxjs/attribute.ts","../lib/onnxjs/graph.ts","../lib/onnxjs/model.ts","../lib/onnxjs/session.ts","../lib/onnxjs/session-handler-inference.ts","../lib/backend-onnxjs.ts","../lib/wasm/wasm-utils-env.ts","../lib/wasm/proxy-worker/main.ts","../lib/wasm/wasm-utils-import.ts","../lib/wasm/wasm-factory.ts","../lib/wasm/wasm-utils.ts","../lib/wasm/run-options.ts","../lib/wasm/session-options.ts","../lib/wasm/wasm-common.ts","../lib/wasm/wasm-utils-load-file.ts","../lib/wasm/wasm-core-impl.ts","../lib/wasm/proxy-wrapper.ts","../lib/wasm/session-handler-inference.ts","../lib/backend-wasm.ts","../lib/backend-wasm-inference.ts","../lib/index.ts","../lib/version.ts"],"names":["backends","backendsSortedByPriority","registerBackend","tryResolveAndInitializeBackend","resolveBackendAndExecutionProviders","init_backend_impl","__esmMin","name","backend","priority","currentBackend","i","backendName","backendInfo","isInitializing","e","options","eps","backendHints","backendNames","errors","availableBackendNames","resolveResult","err","filteredEps","target","prop","init_backend","version","init_version","logLevelValue","env","init_env_impl","value","init_env","tensorToDataURL","tensorToImageData","init_tensor_conversion_impl","tensor","canvas","pixels2DContext","width","height","inputformat","norm","normMean","normBias","stride","rTensorPointer","gTensorPointer","bTensorPointer","aTensorPointer","j","R","G","B","A","image","channels","step","rImagePointer","gImagePointer","bImagePointer","aImagePointer","bufferToTensor","tensorFromImage","tensorFromTexture","tensorFromGpuBuffer","tensorFromPinnedBuffer","init_tensor_factory_impl","init_tensor_impl","buffer","outputformat","float32Data","Tensor","isHTMLImageEle","isImageDataEle","isImageBitmap","isString","data","bufferToTensorOptions","createCanvas","createCanvasContext","tempCanvas","resolve","reject","context","newImage","img","texture","download","dispose","dims","gpuBuffer","dataType","type","NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP","NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP","isTypedArrayChecked","checkTypedArray","init_tensor_impl_type_mapping","isBigInt64ArrayAvailable","isBigUint64ArrayAvailable","isFloat16ArrayAvailable","calculateSize","tensorReshape","init_tensor_utils_impl","size","dim","arg0","arg1","arg2","expectedTypedArrayConstructor","maybeDims","typedArrayConstructor","firstElementType","mappedType","releaseData","init_tensor","TRACE","TRACE_FUNC","TRACE_FUNC_BEGIN","TRACE_FUNC_END","init_trace","deviceType","label","msg","extraMsg","stack","hasTraceFunc","InferenceSession","init_inference_session_impl","_InferenceSession","handler","feeds","fetches","isFetchesEmpty","isFetches","arg1Keys","v","results","returnValue","key","result","arg3","filePathOrUint8Array","byteOffset","byteLength","optionsWithValidatedEPs","init_inference_session","init_tensor_conversion","init_tensor_factory","init_onnx_model","init_onnx_value","noBackendErrMsg","TrainingSession","init_training_session_impl","_TrainingSession","hasOptimizerModel","hasEvalModel","trainingOptions","sessionOptions","evalModel","optimizerModel","inputNames","outputNames","trainableOnly","array","paramsSize","init_training_session","esm_exports","__export","init_esm","log","createCategorizedLogger","logInternal","category","severity","content","_stack","config","LOGGER_CONFIG_MAP","SEVERITY_VALUE","LOGGER_PROVIDER_MAP","NoOpLoggerProvider","ConsoleLoggerProvider","LOGGER_DEFAULT_CONFIG","Logger","Event","EventRecord","Profiler","now","init_instrument","_severity","_content","_category","verbose","info","warning","error","fatal","reset","set","previousConfig","setWithEnv","startTime","endCallback","timer","ctx","endTime","maxNumberEvents","flushBatchSize","flushIntervalInMilliseconds","func","event","isPromise","res","reason","eventRes","currentTime","previousPointer","resolveOperator","node","opsets","rules","rule","opType","domain","versionSelector","opImpl","opInit","opset","matchSelector","selector","rangeStart","pair","rangeEnd","init_opset","require_guid","__commonJSMin","exports","Guid","guid","count","out","other","Long","low","high","unsigned","isLong","obj","ctz32","c","fromInt","cachedObj","cache","UINT_CACHE","fromBits","INT_CACHE","fromNumber","UZERO","ZERO","TWO_PWR_64_DBL","MAX_UNSIGNED_VALUE","TWO_PWR_63_DBL","MIN_VALUE","MAX_VALUE","TWO_PWR_32_DBL","lowBits","highBits","fromString","str","radix","p","radixToPower","pow_dbl","power","fromValue","val","wasm","TWO_PWR_16_DBL","TWO_PWR_24_DBL","TWO_PWR_24","ONE","UONE","NEG_ONE","LongPrototype","long_default","init_long","radixLong","div","rem1","rem","remDiv","intval","digits","bit","thisNeg","otherNeg","addend","a48","a32","a16","a00","b48","b32","b16","b00","c48","c32","c16","c00","subtrahend","multiplier","divisor","approx","halfThis","log2","delta","approxRes","approxRem","numBits","b","le","hi","lo","bytes","flatbuffers","init_flatbuffers","opt_initial_size","initial_size","forceDefaults","additional_bytes","align_size","old_buf_size","byte_size","voffset","defaultValue","bb","new_buf_size","nbb","offset","numfields","vtableloc","trimmed_size","standard_fields","len","existing_vtable","vt1","outer_loop","vt2","root_table","opt_file_identifier","opt_size_prefix","size_prefix","file_identifier","table","field","table_start","vtable_start","ok","elem_size","num_elems","alignment","s","utf8","codePoint","a","position","bb_pos","vtable_offset","vtable","t","opt_encoding","length","d","ident","onnxruntime","init_ort_generated","experimental","fbs","AttributeType","DimensionValueType","TensorDataType","NodeType","TypeInfoValue","Shape","index","builder","dimOffset","numElems","Dimension","optionalEncoding","valueOffset","denotationOffset","DimensionValue","dimType","dimValue","dimParamOffset","TensorTypeAndShape","elemType","shapeOffset","MapType","keyType","valueTypeOffset","SequenceType","elemTypeOffset","EdgeEnd","node_index","src_arg_index","dst_arg_index","NodeEdge","nodeIndex","inputEdgesOffset","outputEdgesOffset","Node","nameOffset","docStringOffset","domainOffset","sinceVersion","opTypeOffset","executionProviderTypeOffset","inputsOffset","outputsOffset","attributesOffset","inputArgCountsOffset","implicitInputsOffset","ValueInfo","typeOffset","TypeInfo","valueType","OperatorSetId","dimsOffset","rawDataOffset","stringDataOffset","SparseTensor","valuesOffset","indicesOffset","Attribute","f","sOffset","tOffset","gOffset","floatsOffset","intsOffset","stringsOffset","tensorsOffset","graphsOffset","Graph","initializersOffset","nodeArgsOffset","nodesOffset","maxNodeIndex","nodeEdgesOffset","sparseInitializersOffset","Model","irVersion","opsetImportOffset","producerNameOffset","producerVersionOffset","modelVersion","graphOffset","graphDocStringOffset","KernelCreateInfos","nodeIndicesOffset","kernelDefHashesOffset","SubGraphSessionState","graphIdOffset","sessionStateOffset","SessionState","kernelsOffset","subGraphSessionStatesOffset","ortVersionOffset","modelOffset","require_aspromise","module","asPromise","fn","params","pending","require_base64","base64","string","n","b64","s64","start","end","parts","chunk","invalidEncoding","require_eventemitter","EventEmitter","evt","listeners","args","require_float","factory","f32","f8b","writeFloat_f32_cpy","buf","pos","writeFloat_f32_rev","readFloat_f32_cpy","readFloat_f32_rev","writeFloat_ieee754","writeUint","sign","exponent","mantissa","writeUintLE","writeUintBE","readFloat_ieee754","readUint","uint","readUintLE","readUintBE","f64","writeDouble_f64_cpy","writeDouble_f64_rev","readDouble_f64_cpy","readDouble_f64_rev","writeDouble_ieee754","off0","off1","readDouble_ieee754","require_inquire","require_utf8","c1","c2","require_pool","pool","alloc","slice","SIZE","MAX","slab","require_longbits","LongBits","util","zero","zeroHash","charCodeAt","hash","mask","part0","part1","part2","require_minimal","Buffer","sizeOrArray","bits","merge","dst","src","ifNotSet","keys","newError","CustomError","message","properties","fieldNames","fieldMap","encoding","require_writer","Writer","BufferWriter","Op","noop","State","writer","create","writeByte","writeVarint32","VarintOp","writeVarint64","writeFixed32","writeBytes","head","tail","BufferWriter_","require_writer_buffer","writeStringBuffer","require_reader","Reader","BufferReader","indexOutOfRange","reader","writeLength","create_array","readLongVarint","readFixed32_end","readFixed64","nativeBuffer","wireType","BufferReader_","require_reader_buffer","require_service","Service","rpcImpl","requestDelimited","responseDelimited","rpcCall","method","requestCtor","responseCtor","request","callback","self","response","endedByRPC","require_rpc","rpc","require_roots","require_index_minimal","protobuf","configure","require_onnx","$protobuf","$Reader","$Writer","$util","$root","onnx","valuesById","values","AttributeProto","tag","end2","object","long","typeUrlPrefix","ValueInfoProto","NodeProto","TrainingInfoProto","ModelProto","StringStringEntryProto","TensorAnnotation","GraphProto","TensorProto","Segment","SparseTensorProto","TensorShapeProto","$oneOfFields","TypeProto","Sequence","Map","Optional","OperatorSetIdProto","FunctionProto","assert","expr","decodeUtf8String","import_onnx","ArrayUtil","MatMulUtil","BroadcastUtil","GemmUtil","ProtoUtil","LongUtil","ShapeUtil","SplitUtil","PoolConvUtil","MIN_CLIP","MAX_CLIP","init_util","n1","n2","dimsA","dimsB","outputShape","aRank","bRank","_BroadcastUtil","adims","bdims","isMatMul","arank","brank","crank","cdims","cShapeMatMul","aLen","bLen","broadcastedIndices","originalShape","originalIndices","op","inplace","resultType","outputIndices","originalIndicesA","originalIndicesB","valA","valB","isAScalar","isBScalar","rest","shape","finalShape","inputRank","finalRank","inputShape","inRank","leftShape","transLeft","rightShape","transRight","biasShape","M","K","N","kDim","_ProtoUtil","typeProto","attributes","_ShapeUtil","axis","rank","strides","indices","tensorRank","axes","x","axisToIncrementOn","k","originalDims","shapeHints","nDims","reshapedDims","unknownDimension","newTensorSize","oldTensorSize","perm","pad","shape1","shape2","total","y","right","outputDims","inSqueezeList","inputDimsIterator","_SplitUtil","split","numOutputs","shapes","offsets","numElementsAlongAxis","_PoolConvUtil","isGlobalOperator","inputDims","kernelShape","dilations","pads","autoPad","filterDims","inSize","dilation","kernel","padHeadIndex","padTailIndex","dkernel","padNeeded","sizeof","sizeofProto","createView","dataBuffer","dataviewConstructor","longToNumber","ortFbs","readProto","view","import_guid_typescript","_Tensor","dataProvider","asyncDataProvider","dataId","empty","constructor","tensorProto","dataDest","dataSource","elementSize","element","ortTensor","getGlsl","GLSL_ES_2_0","GLSL_ES_3_0","getVertexShaderSource","glsl","getFragShaderPreamble","getDefaultFragShaderMain","outputShapeLength","init_glsl_source","init_types","repeatedTry","checkFn","delayFn","_counter","maxCounter","tryCount","tryFn","nextBackoff","generateShaderFuncNameFromInputSamplerName","samplerName","generateShaderFuncNameFromInputSamplerNameAtOutCoords","squeezeInputShape","squeezedShape","newInputShape","getSqueezedParams","keptDims","getCoordsDataType","getGlChannels","init_utils","getVecChannels","getChannels","unpackFromChannel","init_packing_utils","getOutOfBoundsCondition","cond","getOutput","coord00","coord01","coord10","coord11","D","getSetup","rows","cols","packProgramMetadata","createPackProgramInfo","createPackProgramInfoLoader","init_pack","input","outputRank","coordsDataType","setup","reversedInputWH","outOfBoundsCondition","output","shaderSource","processDims3D","batch","isReshapeCheap","isCheapReshape","getReshapedInputCoords","coords","line1","line2","getFlattenedIndexFrom3D","createPackedReshape3DProgramMetadata","createPackedReshape3DProgramInfo","createPackedReshape3DProgramInfoLoader","init_reshape_packed","outputShape3D","input3D","metadata","inputShape3D","squeezedOutputShape","mainLoop","outputCoords","encodeAsUint8","init_uint8_encode","inferenceHandler","programInfo","getSourceCoords","unpackProgramMetadata","createUnpackProgramInfo","createUnpackProgramInfoLoader","init_unpack","innerDims","unpackChannel","sourceCoords","RedFloat32DataEncoder","RGBAFloatDataEncoder","Uint8DataEncoder","init_texture_data_encoder","gl","textureSize","source","dataSize","_value","textureType","dest","_textureSize","createTextureLayoutFromTextureType","calculateTextureWidthAndHeight","createTextureLayoutFromShape","init_texture_layout","textureLayoutStrategy","channel","isPacked","reverseWH","breakAxis","unpackedShape","layout","prefs","inferredDims","getProgramInfoUniqueKey","WebGLInferenceHandler","init_inference_handler","inputTextureDatas","inputs","session","program","artifact","outputTextureLayout","outputTextureData","td","adjustedKernelShape","adjustedLayout","numFeatureMaps","oldRowSize","newRowSize","newSize","oldOffset","newOffset","unpackedTextureLayout","unpackedTextureData","usage","inputTD","newTextureLayout","squeezedInputShape","squeezedInputTensor","squeezedOutputTensor","tensorId","textureData","_id","AttributeWithCacheKeyImpl","createAttributeWithCacheKey","init_attribute_with_cache_key","attribute","batchNormalizationProgramMetadata","batchNormalization","parseBatchNormalizationAttributes","createBatchNormalizationProgramInfo","validateInputs","init_batch_normalization","epsilon","momentum","spatial","scaleWidth","scaleHeight","X","scale","mean","var_","GlslContext","GlslLib","GlslLibRoutine","GlslLibRoutineNode","TopologicalSortGlslRoutines","init_glsl_definitions","glContext","inputTextureLayouts","routineBody","dependencies","nodes","cycleCheck","alreadyTraversed","graphNodes","root","glslAdd","glslDiv","glslMul","glslSub","glslEqual","glslGreater","glslLess","glslAnd","glslOr","glslXor","glslPow","glslBuiltinBinary","glslPRelu","fname","createBinaryProgramInfoLoader","createBinaryProgramInfo","add","and","equal","greater","less","mul","or","pow","pRelu","sub","xor","init_binary_op","glslFunc","outputTensorType","cacheKey","isBroadcast","usePackedTexture","calculatedShape","aBcast","bBcast","cast","parseCastAttributes","init_cast","to","createPackedConcatProgramMetadata","createPackedConcatProgramInfo","createPackedConcatProgramInfoLoader","getShiftedChannelsSnippet","init_concat_packed","inputCount","cacheHint","_v","dataNShape","axisIndex","dtype","lastChannels","allChannels","getValueSnippet","shift","lastIndex","channelIdx","idx","concat","createUnpackedConcatProgramMetadata","createUnpackedConcatProgramInfo","createUnpackedConcatProgramInfoLoader","getTextureIndexWhereDataResidesLinearSearch","getTextureIndexWhereDataResidesBinarySearch","getFetchDataFromCorrectTextureMethod","getGetSizeInConcatAxisValueFromIndexMethod","parseConcatAttributes","init_concat","_handler","sizeInConcatAxis","previousSum","getTextureIndexWhereDataResidesMethod","fetchDataFromCorrectTextureMethod","getSizeInConcatAxisValueFromIndexMethod","numberOfTensors","codeLines","inputType","inputDimensionality","glslAbs","glslBuiltinUnary","glslAcos","glslAsin","glslAtan","glslCeil","glslCos","glslElu","alpha","glslExp","glslFloor","glslClip","min","max","glslIdentity","glslLeakyRelu","glslLog","glslNeg","glslNot","glslSin","glslRelu","glslSigmoid","glslSqrt","glslTan","glslTanh","createElementwiseProgramInfo","createElementwiseProgramInfoLoader","abs","acos","asin","atan","clip","parseClipAttributes","clipV11","generateClipAttributesFromInputs","ceil","cos","elu","parseEluAttributes","exp","floor","identity","leakyRelu","parseLeakyReluAttributes","neg","not","relu","sigmoid","sin","sqrt","tan","tanh","init_unary_op","getActivationSnippet","activationName","activationFunction","applyActivation","parseInternalActivationAttributes","init_fuse_utils","activation","clipMin","clipMax","createUnpackedGroupedConvProgramMetadata","createUnpackedGroupedConvProgramInfo","createUnpackedGroupedConvProgramInfoLoader","init_conv_grouped","init_conv","hasBias","processBias","xShape","wShape","outputChannelsPerGroup","calculateOutputShape","createPackedIm2ColProgramMetadata","createPackedIm2ColProgramInfo","createPackedIm2ColProgramInfoLoader","init_im2col_pack","w","xshape","wshape","rowDim","colDim","im2colShape","kernelSize","unrolled","row","col","createMatmulProgramInfo","activationAttributes","aShape","bShape","allGlChannels","getBiasForMatmulSnippet","getBiasForMatmul","sharedDim","createMatmulProgramInfoLoader","createMatmulProgramMetadata","inShape","outShape","unpackedCoordsSnippet","outRank","rankDiff","_s","coordsSnippet","isInputScalar","matMul","parseMatMulAttributes","init_matmul","init_matmul_pack","createPackedMatmulProgramInfoLoader","getBcastSamplerForMatmul","unpackedACoordsSnippet","unpackedBCoordsSnippet","inAShape","inBShape","inARank","inBRank","rankADiff","rankBDiff","broadcastADims","broadcastBDims","coordsASnippet","coordsBSnippet","swapDimSnippet","getA","getB","createPackedMatmulProgramMetadata","createPackedMatmulProgramInfo","sharedDimIndex","getBcastedSamplerForMatmulSnippet","getSamplerAInLoopSnippet","getSamplerBInLoopSnippet","getOutputCoordsSnippet","conv2DPacked","init_conv_pack","kshape","im2colOutput","kernelReshaped","matmulInputs","matmulOutput","createIm2ColProgramMetadata","createIm2ColProgramInfo","createIm2ColProgramInfoLoader","calculateIm2ColDims","init_im2col","_inferenceHandler","im2colDims","createDotProductProgramMetadata","createDotProductProgramInfo","createDotProductProgramInfoLoader","init_dot_product","kWidth","kHeight","im2colStrides","im2colWidth","im2colHeight","initValue","conv","conv2d","conv2DUnpackedPointwise","conv2DUnpacked","getAdjustedConvAttributes","parseConvAttributes","adjustPads","batchSize","inputSpatialShape","spatialRank","outChannels","dilatedKernelShape","outputSpatialShape","adjustedAttributes","packMode","isPointwise","reshapedX","reshapedK","xIm2Col","dotProductInputs","newAttributes","group","dataChannel","filterInChannel","computeTotalPad","distributePadding","calculateOutputShapeAndPads","convTranspose","convTranspose2d","createConvTransposeProgramMetadata","createUnpackedConvTransposeProgramInfo","createUnpackedConvTransposeProgramInfoLoader","convTranspose2DUnpacked","getAdjustedConvTransposeAttributes","parseConvTransposeAttributes","init_conv_transpose","inDim","adj","outSize","totalPad","smallPad","outputPadding","updateShape","valueInit","inputChannelsPerGroup","featureMaps","transposeProgramMetadata","transpose","parseTransposeAttributes","createTransposeProgramInfo","getAdjustedPerm","getOutputShape","getPermFunctionBody","init_transpose","unpackedOutputShape","reverseFunc","depthToSpace","parseDepthToSpaceAttributes","init_depth_to_space","blocksize","blocksizeSqr","transposePerm","firstReshapeShape","firstReshapedTensor","transposeAttributes","transposeOutput","secondReshapeShape","mode","flatten","parseFlattenAttributes","init_flatten","r","NUMBER_TYPES","init_operators","gather","parseGatherAttributes","gatherProgramMetadata","createGatherProgramInfo","createGatherProgramInfoLoader","init_gather","indexDataShape","indexCopyOps","orank","irank","iDrank","gemm","parseGemmAttributes","parseGemmAttributesV7","parseGemmAttributesV11","createGemmProgramInfoLoader","createGemmProgramInfo","init_gemm","isOptionalC","transA","transB","beta","line","declareC","broadcastC","calculateC","imageScaler","parseImageScalerAttributes","imageScalerProgramMetadata","createImageScalerProgramInfo","createImageScalerProgramInfoLoader","createGetBiasMethod","init_image_scaler","bias","numChannels","instanceNormalization","parseInstanceNormalizationAttributes","meanAndVarianceProgramMetadata","createMeanAndVarianceProgramInfo","createMeanAndVarianceProgramInfoLoader","computeOutputProgramMetadata","createComputeOutputProgramInfo","createComputeOutputProgramInfoLoader","init_instance_normalization","meanAndVariance","xDims","channelSize","meanAndVarianceShape","textureWidth","textureHeight","meanAndVarianceWidth","meanAndVarianceHeight","createLrnProgramInfo","C","from","lrnProgramMetadata","createLrnProgramInfoLoader","lrn","parseLrnAttributes","init_lrn","padProgramMetadata","padV2","parsePadAttributesV2","padV11","parsePadAttributesV11","generatePadAttributesFromInputs","createPadProgramInfo","validateInputsV2","validateInputsV11","getPadFunction","getPadConstant","getPadReflect","getPadEdge","init_pad","attrubutes","block","averagePool","parseAveragePoolAttributes","createAveragePoolProgramInfo","globalAveragePool","parseGlobalAveragePoolAttributes","maxPool","parseMaxPoolAttributes","createMaxPoolProgramInfo","getAdjustedPoolAttributesAndOutputShape","globalMaxPoolAttributes","globalMaxPoolMetadata","globalMaxPool","generatePoolingCode","copyArray","offsetToIndices","init_pool","ceilMode","countIncludePad","op1","op2","storageOrder","hasDilations","kw","sw","pwStart","pwEnd","dimW","codeW","codeH","codeHEnd","kh","sh","phStart","phEnd","dimH","kernelStrides","stridesRank","padsRank","offsetToIndicesFunction","copyInputDims","copyPads","copyKernelStrides","copyStrides","hasPads","sum","cur","padCode","arrayName","reduce","parseReduceAttributes","createReduceProgramInfo","reduceSum","reduceMean","reduceMax","reduceMin","reduceProd","reduceLogSum","reduceLogSumSquare","init_reduce","reduceOp","reduceProgramMetadata","keepDims","_name","iRank","idxCopy","ops","reduceOps","idxZero","reshape","init_reshape","upsampleProgramMetadata","upsample","parseUpsampleAttributesV7","parseUpsampleAttributesV9","parseUpsampleAttributes","createUpsampleProgramInfo","scalesValidation","init_upsample","isResize","scales","extrapolationValue","coordinateTransformMode","needRoiInput","useExtrapolation","nearestMode","cubicCoefficientA","excludeOutside","useNearest2xOptimization","roiInputIdx","scalesInputIdx","sizesInputIdx","inputWidth","inputHeight","outputWidth","outputHeight","outputPitches","inputPitches","precalculatedPitches","getInputFloatFunction","resizeProgramMetadata","resize","parseResizeAttributesV10","parseResizeAttributesV11","createPackedResizeProgramInfo","prepareInputs","parseScalesData","parseScalesDataFromOutputSize","init_resize_packed","scalesHeight","scalesWidth","getSourceFracIndex","outputSizes","scalesTensor","sizesTensor","yDims","init_shape","sliceProgramMetadata","parseSliceAttributes","createSliceProgramInfo","sliceV10","generateSliceAttributesFromInputs","validateInputsV10","init_slice","starts","ends","_val","normalizedAxes","sliceOps","softmaxComputeMaxProgramMetadata","softmaxComputeScaleProgramMetadata","softmaxProgramMetadata","softmax","parseSoftmaxAttributes","parseSoftmaxAttributesV13","softmaxV13","computeSoftmax","createComputeMaxProgramInfo","createComputScaleProgramInfo","createSoftMaxProgramInfo","init_softmax","logicalRowCount","featureCount","isTransposeRequired","transposedInputShape","transposedInputs","transposeAttribute","_","computeMaxProgramInfo","computeScaleProgramInfo","softMaxProgramInfo","maxElementPerLogicalRow","normalizationPerLogicalRow","splitProgramMetadata","parseSplitAttributes","getProgramCount","createSplitProgramInfo","init_split","squeeze","squeezeV13","parseSqueezeAttributes","validateInputsV13","init_squeeze","createSumProgramInfo","init_sum","sumProgramMetadata","tile","createTileProgramInfo","init_tile","tileProgramMetadata","tileOps","unsqueeze","unsqueezeV13","parseUnsqueezeAttributes","init_unsqueeze","WEBGL_OP_RESOLVE_RULES","init_op_resolve_rules","replaceInlines","script","inlineDefs","match","INLINE_FUNC_DEF_REGEX","tokens","regexString","FUNC_CALL_REGEX","regex","variable","declLine","newBody","paramRedecLine","replacement","init_glsl_function_inliner","squeezeShape","newShape","isEmptyArray","parseAxisParam","ax","isInt","sizeFromShape","sizeToSquarishShape","PreferLogicalStrategy","init_texture_layout_strategy","maxTextureSize","wh","wsize","hsize","logShape","_d","CoordsGlslLib","init_glsl_coordinate_lib","funcName","outputLayout","outTexShape","floatTextureSetRGBASource","floatTextureSetRGBAFuncName","floatTextureSetRSource","floatTextureSetRFuncName","_shape","texShape","packedTexShape","texelsInLogicalRow","texelsInBatch","texelsInBatchN","batches","coordsToCompute","coordsFromIndexSnippet","inputLayout","outCoordFuncName","texFuncSnippet","broadcastDims","fields","isOutputScalar","swapLastDimsSnippet","inTexShape","texNumR","texNumC","packedSampler","valuesPerRow","newInputLayout","samplerRoutine","tNumR","tNumC","stride0","stride1","routine","revDims","stride2","stride3","stride4","xScale","yScale","stridesBlock","body","varName","EncodingGlslLib","init_glsl_encoding_lib","_EncodingGlslLib","endianness","FragColorGlslLib","init_glsl_fragcolor_lib","ShapeUtilsGlslLib","init_glsl_shape_utils_lib","_ShapeUtilsGlslLib","shapeInit","VecGlslLib","init_glsl_vec_lib","nameOp","assignmentBlock","glslRegistry","init_glsl_registered_libs","GlslPreprocessor","init_glsl_preprocessor","lib","map","libName","routinesInLib","currentNode","routinesIncluded","routines","classAndRoutine","samplers","variables","uniformLines","sampler","ProgramManager","init_program_manager","profiler","buildArtifact","preprocessor","fragScript","fragShaderScript","vertexShaderScript","fragShader","attribLocations","positionHandle","textureCoordHandle","uniformLocations","textures","texturePosition","location","arrayLength","uniformHandle","reference","TextureManager","init_texture_manager","layoutStrategy","textureDataType","encoder","inUseTextures","idleTextures","subscribers","tensorData","deleteTexture","_dataType","WebGLSessionHandler","init_session_handler","graph","initializers","linearSearchLastTrue","arr","WebGLContext","init_webgl_context","vertexShader","shaderType","shader","unit","geometry","fb","internalFormat","frameBuffer","isComplete","fragmentShader","gl2","ext","query","available","disjoint","timeElapsed","fenceContext","isFencePassed","status","resolveFn","isDoneFn","createWebGLContext","contextId","offscreenCanvas","createOffscreenCanvas","createNewWebGLContext","contextAttributes","ca","init_webgl_context_factory","WebGLBackend","init_backend_webgl","resolveBackend","hint","hints","backendHint","backendsCache","tryLoadBackend","backendObj","isBackend","init","o","KernelOp","ExecutionPlan","init_execution_plan","resolved","sessionHandler","modelInputs","graphInputs","sequence","graphValues","rear","thisOpIndex","thisOp","inputList","inputTensors","outputList","downstreamNodes","_output","currentDownstreamNodeIndex","currentDownstreamNode","outputIndex","outputTensor","init_attribute","_Attribute","attr","valueAndType","attrType","numberValue","maybeLong","ints","strings","tensors","Value","GraphImpl","init_graph","graphProto","initializer","valueInfo","_nodeProto","graphInitializer","dataIndices","nodesIndices","inputValueNames","currentIndex","nodeProto","pick","dataIndex","inputName","outputName","starters","nodesStack","nodesState","outgoingEdgeIndex","downstreamNodeIndex","newIndices","nodePossition","ind","currentData","inputValueIndex","outputValueIndex","nodesConsumingOutput","delIndex","replaceIndex","next","child","init_model","isOrtFormat","onnxError","modelProto","ortModel","opsetId","Session","init_session","arg","modelProtoBlob","outputTensors","modelInputNames","sortedInputs","sortedInputsIndex","modelInputIndices","modelValues","graphInputDims","graphInput","graphInputTypes","givenInputs","expectedType","actualType","noneDimSupported","expectedDims","actualDims","modelOutputNames","OnnxjsSessionHandler","init_session_handler_inference","_fetches","_options","inputMap","feed","outputMap","backend_onnxjs_exports","onnxjsBackend","OnnxjsBackend","init_backend_onnxjs","pathOrBuffer","init_wasm_utils_env","main_exports","main_default","WORKER_NAME","isProxyWorker","init_main","init_wasm_core_impl","init_wasm_factory","init_wasm_utils_import","ev","initializeWebAssembly","initRuntime","epName","initEp","bufferData","copyFromExternalBuffer","model","createSession","sessionMetadata","releaseSession","sessionId","inputIndices","run","outputs","extractTransferableBuffers","endProfiling","urlOverride","scriptSrc","origin","isSameOrigin","normalizeUrl","fallbackUrl","preload","dynamicImportDefault","createProxyWorker","importProxyWorker","importWasmModule","filename","prefixOverride","baseUrl","absoluteUrl","blob","url","isMultiThreaded","wasmModuleFilename","wasmModuleUrl","needPreload","initialized","initializing","aborted","isMultiThreadSupported","isSimdSupported","getInstance","flags","timeout","numThreads","multiThreadSupported","wasmPaths","wasmPrefixOverride","mjsPathOverrideFlag","mjsPathOverride","wasmPathOverrideFlag","wasmPathOverride","wasmBinaryOverride","objectUrl","ortWasmFactory","isTimeout","tasks","fileName","scriptDirectory","what","allocWasmString","iterateExtraOptions","checkLastError","init_wasm_utils","allocs","dataLength","dataOffset","prefix","seen","paramsOffset","errorCode","errorMessagePointer","errorMessage","setRunOptions","init_run_options","runOptionsHandle","runOptions","tagDataOffset","keyDataOffset","valueDataOffset","getGraphOptimzationLevel","getExecutionMode","appendDefaultOptions","setExecutionProviders","setSessionOptions","init_session_options","graphOptimizationLevel","executionMode","ep","sessionOptionsHandle","executionProviders","webgpuOptions","epNameDataOffset","logIdDataOffset","logSeverityLevel","logVerbosityLevel","optimizedModelFilePathOffset","tensorDataTypeStringToEnum","tensorDataTypeEnumToString","getTensorElementSize","tensorTypeToTypedArrayConstructor","logLevelStringToEnum","isGpuBufferSupportedType","dataLocationStringToEnum","init_wasm_common","dateType","logLevel","loadFile","init_wasm_utils_load_file","file","readFile","createReadStream","stream","chunks","contentLengthHeader","fileSize","pages","done","chunkSize","initOrt","activeSessions","getSessionInputOutputCount","prepareInputOutputTensor","loggingLevel","sessionHandle","modelDataOffset","modelData","modelDataLength","ioBindingHandle","inputNamesUTF8Encoded","outputNamesUTF8Encoded","loadingPromises","path","provider","webnnOptions","gpuDevice","powerPreference","outputCount","enableGraphCapture","outputPreferredLocations","nameString","bindingState","ioBindingState","tensorHandles","rawData","dataByteLength","elementSizeInBytes","registerBuffer","dimIndex","inputOutputBound","runOptionsAllocs","inputTensorHandles","outputTensorHandles","inputOutputAllocs","beforeRunStack","inputValuesOffset","inputNamesOffset","outputValuesOffset","outputNamesOffset","inputValuesIndex","inputNamesIndex","outputValuesIndex","outputNamesIndex","beforeGetTensorDataStack","tensorDataOffset","keepOutputTensor","tensorDataIndex","dimsLength","preferredLocation","stringData","maxBytesToRead","getBuffer","profileFileName","buffers","isProxy","proxyWorker","temporaryObjectUrl","initWasmCallbacks","queuedCallbacks","enqueueCallbacks","ensureWorker","onProxyWorkerMessage","initializeWebAssemblyAndOrtRuntime","initializeOrtEp","init_proxy_wrapper","callbacks","queue","worker","transferable","serializableInputs","encodeTensorMetadata","decodeTensorMetadata","OnnxruntimeWebAssemblySessionHandler","getName","inputArray","kvp","outputArray","resultMap","initializeFlags","OnnxruntimeWebAssemblyBackend","init_backend_wasm","numCpuLogicalCores","backend_wasm_inference_exports","wasmBackend","init_backend_wasm_inference","lib_exports","lib_default"],"mappings":";;;;;q7BAAA,IAgBMA,GACAC,GAYOC,GAwCPC,GAwCOC,GA7GbC,GAAAC,EAAA,kBAgBMN,GAAqC,IAAI,IACzCC,GAAqC,CAAA,EAY9BC,GAAkB,CAACK,EAAcC,EAAkBC,IAA0B,CACxF,GAAID,GAAW,OAAOA,EAAQ,MAAS,YAAc,OAAOA,EAAQ,+BAAkC,WAAY,CAChH,IAAME,EAAiBV,GAAS,IAAIO,CAAI,EACxC,GAAIG,IAAmB,OACrBV,GAAS,IAAIO,EAAM,CAAC,QAAAC,EAAS,SAAAC,CAAQ,CAAC,MACjC,IAAIC,EAAe,SAAWD,EAEnC,OACK,GAAIC,EAAe,WAAaD,GACjCC,EAAe,UAAYF,EAC7B,MAAM,IAAI,MAAM,4BAA4BD,CAAI,oBAAoBE,CAAQ,EAAE,EAIlF,GAAIA,GAAY,EAAG,CACjB,IAAME,EAAIV,GAAyB,QAAQM,CAAI,EAC3CI,IAAM,IACRV,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AE,EACtC1+D,GAAgB,OAAQ0+D,EAAa,EAAE,CACzC,CAEA,OAAO,eAAe78D,EAAI,SAAU,MAAO,CAAC,MAAOH,GAAS,WAAY,EAAI,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Backend} from './backend.js';\nimport {InferenceSession} from './inference-session.js';\n\ninterface BackendInfo {\n backend: Backend;\n priority: number;\n\n initPromise?: Promise;\n initialized?: boolean;\n aborted?: boolean;\n error?: string;\n}\n\nconst backends: Map = new Map();\nconst backendsSortedByPriority: string[] = [];\n\n/**\n * Register a backend.\n *\n * @param name - the name as a key to lookup as an execution provider.\n * @param backend - the backend object.\n * @param priority - an integer indicating the priority of the backend. Higher number means higher priority. if priority\n * < 0, it will be considered as a 'beta' version and will not be used as a fallback backend by default.\n *\n * @ignore\n */\nexport const registerBackend = (name: string, backend: Backend, priority: number): void => {\n if (backend && typeof backend.init === 'function' && typeof backend.createInferenceSessionHandler === 'function') {\n const currentBackend = backends.get(name);\n if (currentBackend === undefined) {\n backends.set(name, {backend, priority});\n } else if (currentBackend.priority > priority) {\n // same name is already registered with a higher priority. skip registeration.\n return;\n } else if (currentBackend.priority === priority) {\n if (currentBackend.backend !== backend) {\n throw new Error(`cannot register backend \"${name}\" using priority ${priority}`);\n }\n }\n\n if (priority >= 0) {\n const i = backendsSortedByPriority.indexOf(name);\n if (i !== -1) {\n backendsSortedByPriority.splice(i, 1);\n }\n\n for (let i = 0; i < backendsSortedByPriority.length; i++) {\n if (backends.get(backendsSortedByPriority[i])!.priority <= priority) {\n backendsSortedByPriority.splice(i, 0, name);\n return;\n }\n }\n backendsSortedByPriority.push(name);\n }\n return;\n }\n\n throw new TypeError('not a valid backend');\n};\n\n/**\n * Try to resolve and initialize a backend.\n *\n * @param backendName - the name of the backend.\n * @returns the backend instance if resolved and initialized successfully, or an error message if failed.\n */\nconst tryResolveAndInitializeBackend = async(backendName: string): Promise => {\n const backendInfo = backends.get(backendName);\n if (!backendInfo) {\n return 'backend not found.';\n }\n\n if (backendInfo.initialized) {\n return backendInfo.backend;\n } else if (backendInfo.aborted) {\n return backendInfo.error!;\n } else {\n const isInitializing = !!backendInfo.initPromise;\n try {\n if (!isInitializing) {\n backendInfo.initPromise = backendInfo.backend.init(backendName);\n }\n await backendInfo.initPromise;\n backendInfo.initialized = true;\n return backendInfo.backend;\n } catch (e) {\n if (!isInitializing) {\n backendInfo.error = `${e}`;\n backendInfo.aborted = true;\n }\n return backendInfo.error!;\n } finally {\n delete backendInfo.initPromise;\n }\n }\n};\n\n/**\n * Resolve execution providers from the specific session options.\n *\n * @param options - the session options object.\n * @returns a promise that resolves to a tuple of an initialized backend instance and a session options object with\n * filtered EP list.\n *\n * @ignore\n */\nexport const resolveBackendAndExecutionProviders = async(options: InferenceSession.SessionOptions):\n Promise<[backend: Backend, options: InferenceSession.SessionOptions]> => {\n // extract backend hints from session options\n const eps = options.executionProviders || [];\n const backendHints = eps.map(i => typeof i === 'string' ? i : i.name);\n const backendNames = backendHints.length === 0 ? backendsSortedByPriority : backendHints;\n\n // try to resolve and initialize all requested backends\n let backend: Backend|undefined;\n const errors = [];\n const availableBackendNames = new Set();\n for (const backendName of backendNames) {\n const resolveResult = await tryResolveAndInitializeBackend(backendName);\n if (typeof resolveResult === 'string') {\n errors.push({name: backendName, err: resolveResult});\n } else {\n if (!backend) {\n backend = resolveResult;\n }\n if (backend === resolveResult) {\n availableBackendNames.add(backendName);\n }\n }\n }\n\n // if no backend is available, throw error.\n if (!backend) {\n throw new Error(`no available backend found. ERR: ${errors.map(e => `[${e.name}] ${e.err}`).join(', ')}`);\n }\n\n // for each explicitly requested backend, if it's not available, output warning message.\n for (const {name, err} of errors) {\n if (backendHints.includes(name)) {\n // eslint-disable-next-line no-console\n console.warn(`removing requested execution provider \"${\n name}\" from session options because it is not available: ${err}`);\n }\n }\n\n const filteredEps = eps.filter(i => availableBackendNames.has(typeof i === 'string' ? i : i.name));\n\n return [\n backend, new Proxy(options, {\n get: (target, prop) => {\n if (prop === 'executionProviders') {\n return filteredEps;\n }\n return Reflect.get(target, prop);\n }\n })\n ];\n };\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {InferenceSession} from './inference-session.js';\nimport {OnnxValue} from './onnx-value.js';\nimport {TrainingSession} from './training-session.js';\n\n/**\n * @ignore\n */\nexport declare namespace SessionHandler {\n type FeedsType = {[name: string]: OnnxValue};\n type FetchesType = {[name: string]: OnnxValue | null};\n type ReturnType = {[name: string]: OnnxValue};\n}\n\n/**\n * Represents shared SessionHandler functionality\n *\n * @ignore\n */\ninterface SessionHandler {\n dispose(): Promise;\n\n readonly inputNames: readonly string[];\n readonly outputNames: readonly string[];\n}\n\n/**\n * Represent a handler instance of an inference session.\n *\n * @ignore\n */\nexport interface InferenceSessionHandler extends SessionHandler {\n startProfiling(): void;\n endProfiling(): void;\n\n run(feeds: SessionHandler.FeedsType, fetches: SessionHandler.FetchesType,\n options: InferenceSession.RunOptions): Promise;\n}\n\n/**\n * Represent a handler instance of a training inference session.\n *\n * @ignore\n */\nexport interface TrainingSessionHandler extends SessionHandler {\n readonly evalInputNames: readonly string[];\n readonly evalOutputNames: readonly string[];\n\n lazyResetGrad(): Promise;\n runTrainStep(\n feeds: SessionHandler.FeedsType, fetches: SessionHandler.FetchesType,\n options: InferenceSession.RunOptions): Promise;\n runOptimizerStep(options: InferenceSession.RunOptions): Promise;\n runEvalStep(\n feeds: SessionHandler.FeedsType, fetches: SessionHandler.FetchesType,\n options: InferenceSession.RunOptions): Promise;\n\n getParametersSize(trainableOnly: boolean): Promise;\n loadParametersBuffer(buffer: Uint8Array, trainableOnly: boolean): Promise;\n getContiguousParameters(trainableOnly: boolean): Promise;\n}\n\n/**\n * Represent a backend that provides implementation of model inferencing.\n *\n * @ignore\n */\nexport interface Backend {\n /**\n * Initialize the backend asynchronously. Should throw when failed.\n */\n init(backendName: string): Promise;\n\n createInferenceSessionHandler(uriOrBuffer: string|Uint8Array, options?: InferenceSession.SessionOptions):\n Promise;\n\n createTrainingSessionHandler?\n (checkpointStateUriOrBuffer: TrainingSession.UriOrBuffer, trainModelUriOrBuffer: TrainingSession.UriOrBuffer,\n evalModelUriOrBuffer: TrainingSession.UriOrBuffer, optimizerModelUriOrBuffer: TrainingSession.UriOrBuffer,\n options: InferenceSession.SessionOptions): Promise;\n}\n\nexport {registerBackend} from './backend-impl.js';\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\n// This file is generated by /js/scripts/update-version.ts\n// Do not modify file content manually.\n\nexport const version = '1.19.0';\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Env} from './env.js';\nimport {version} from './version.js';\n\ntype LogLevelType = Env['logLevel'];\n\nlet logLevelValue: Required = 'warning';\n\nexport const env: Env = {\n wasm: {} as Env.WebAssemblyFlags,\n webgl: {} as Env.WebGLFlags,\n webgpu: {} as Env.WebGpuFlags,\n versions: {common: version},\n\n set logLevel(value: LogLevelType) {\n if (value === undefined) {\n return;\n }\n if (typeof value !== 'string' || ['verbose', 'info', 'warning', 'error', 'fatal'].indexOf(value) === -1) {\n throw new Error(`Unsupported logging level: ${value}`);\n }\n logLevelValue = value;\n },\n get logLevel(): Required {\n return logLevelValue;\n },\n};\n\n// set property 'logLevel' so that they can be correctly transferred to worker by `postMessage()`.\nObject.defineProperty(env, 'logLevel', {enumerable: true});\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {env as envImpl} from './env-impl.js';\n\nexport declare namespace Env {\n export type WasmPathPrefix = string;\n export interface WasmFilePaths {\n /**\n * Specify the override path for the main .wasm file.\n *\n * This path should be an absolute path.\n *\n * If not modified, the filename of the .wasm file is:\n * - `ort-wasm-simd-threaded.wasm` for default build\n * - `ort-wasm-simd-threaded.jsep.wasm` for JSEP build (with WebGPU and WebNN)\n * - `ort-training-wasm-simd-threaded.wasm` for training build\n */\n wasm?: URL|string;\n /**\n * Specify the override path for the main .mjs file.\n *\n * This path should be an absolute path.\n *\n * If not modified, the filename of the .mjs file is:\n * - `ort-wasm-simd-threaded.mjs` for default build\n * - `ort-wasm-simd-threaded.jsep.mjs` for JSEP build (with WebGPU and WebNN)\n * - `ort-training-wasm-simd-threaded.mjs` for training build\n */\n mjs?: URL|string;\n }\n export type WasmPrefixOrFilePaths = WasmPathPrefix|WasmFilePaths;\n export interface WebAssemblyFlags {\n /**\n * set or get number of thread(s). If omitted or set to 0, number of thread(s) will be determined by system. If set\n * to 1, no worker thread will be spawned.\n *\n * This setting is available only when WebAssembly multithread feature is available in current context.\n *\n * @defaultValue `0`\n */\n numThreads?: number;\n\n /**\n * set or get a boolean value indicating whether to enable SIMD. If set to false, SIMD will be forcely disabled.\n *\n * This setting is available only when WebAssembly SIMD feature is available in current context.\n *\n * @deprecated This property is deprecated. Since SIMD is supported by all major JavaScript engines, non-SIMD\n * build is no longer provided. This property will be removed in future release.\n * @defaultValue `true`\n */\n simd?: boolean;\n\n /**\n * set or get a boolean value indicating whether to enable trace.\n *\n * @deprecated Use `env.trace` instead. If `env.trace` is set, this property will be ignored.\n * @defaultValue `false`\n */\n trace?: boolean;\n\n /**\n * Set or get a number specifying the timeout for initialization of WebAssembly backend, in milliseconds. A zero\n * value indicates no timeout is set.\n *\n * @defaultValue `0`\n */\n initTimeout?: number;\n\n /**\n * Set a custom URL prefix to the .wasm/.mjs files, or an object of overrides for both .wasm/.mjs file. The override\n * path should be an absolute path.\n */\n wasmPaths?: WasmPrefixOrFilePaths;\n\n /**\n * Set a custom buffer which contains the WebAssembly binary. If this property is set, the `wasmPaths` property will\n * be ignored.\n */\n wasmBinary?: ArrayBufferLike|Uint8Array;\n\n /**\n * Set or get a boolean value indicating whether to proxy the execution of main thread to a worker thread.\n *\n * @defaultValue `false`\n */\n proxy?: boolean;\n }\n\n export interface WebGLFlags {\n /**\n * Set or get the WebGL Context ID (webgl or webgl2).\n *\n * @defaultValue `'webgl2'`\n */\n contextId?: 'webgl'|'webgl2';\n /**\n * Get the WebGL rendering context.\n */\n readonly context: WebGLRenderingContext;\n /**\n * Set or get the maximum batch size for matmul. 0 means to disable batching.\n *\n * @deprecated\n */\n matmulMaxBatchSize?: number;\n /**\n * Set or get the texture cache mode.\n *\n * @defaultValue `'full'`\n */\n textureCacheMode?: 'initializerOnly'|'full';\n /**\n * Set or get the packed texture mode\n *\n * @defaultValue `false`\n */\n pack?: boolean;\n /**\n * Set or get whether enable async download.\n *\n * @defaultValue `false`\n */\n async?: boolean;\n }\n\n export interface WebGpuProfilingDataV1TensorMetadata {\n dims: readonly number[];\n dataType: string;\n }\n export interface WebGpuProfilingDataV1 {\n version: 1;\n inputsMetadata: readonly WebGpuProfilingDataV1TensorMetadata[];\n outputsMetadata: readonly WebGpuProfilingDataV1TensorMetadata[];\n kernelId: number;\n kernelType: string;\n kernelName: string;\n programName: string;\n startTime: number;\n endTime: number;\n }\n\n export type WebGpuProfilingData = WebGpuProfilingDataV1;\n\n export interface WebGpuFlags {\n /**\n * Set or get the profiling mode.\n *\n * @deprecated Use `env.webgpu.profiling.mode` instead. If `env.webgpu.profiling.mode` is set, this property will be\n * ignored.\n */\n profilingMode?: 'off'|'default';\n /**\n * Set or get the profiling configuration.\n */\n profiling?: {\n /**\n * Set or get the profiling mode.\n *\n * @defaultValue `'off'`\n */\n mode?: 'off'|'default';\n\n /**\n * Set or get a callback function when a profiling data is received. If not set, the profiling data will be\n * printed to console.\n */\n ondata?: (data: WebGpuProfilingData) => void;\n };\n /**\n * Set or get the power preference.\n *\n * Setting this property only has effect before the first WebGPU inference session is created. The value will be\n * used as options for `navigator.gpu.requestAdapter()`.\n *\n * See {@link https://gpuweb.github.io/gpuweb/#dictdef-gpurequestadapteroptions} for more details.\n *\n * @defaultValue `undefined`\n */\n powerPreference?: 'low-power'|'high-performance';\n /**\n * Set or get the force fallback adapter flag.\n *\n * Setting this property only has effect before the first WebGPU inference session is created. The value will be\n * used as options for `navigator.gpu.requestAdapter()`.\n *\n * See {@link https://gpuweb.github.io/gpuweb/#dictdef-gpurequestadapteroptions} for more details.\n *\n * @defaultValue `undefined`\n */\n forceFallbackAdapter?: boolean;\n /**\n * Set or get the adapter for WebGPU.\n *\n * Setting this property only has effect before the first WebGPU inference session is created. The value will be\n * used as the GPU adapter for the underlying WebGPU backend to create GPU device.\n *\n * If this property is not set, it will be available to get after the first WebGPU inference session is created. The\n * value will be the GPU adapter that created by the underlying WebGPU backend.\n *\n * When use with TypeScript, the type of this property is `GPUAdapter` defined in \"@webgpu/types\".\n * Use `const adapter = env.webgpu.adapter as GPUAdapter;` in TypeScript to access this property with correct type.\n *\n * see comments on {@link Tensor.GpuBufferType}\n */\n adapter: unknown;\n /**\n * Get the device for WebGPU.\n *\n * This property is only available after the first WebGPU inference session is created.\n *\n * When use with TypeScript, the type of this property is `GPUDevice` defined in \"@webgpu/types\".\n * Use `const device = env.webgpu.device as GPUDevice;` in TypeScript to access this property with correct type.\n *\n * see comments on {@link Tensor.GpuBufferType} for more details about why not use types defined in \"@webgpu/types\".\n */\n readonly device: unknown;\n /**\n * Set or get whether validate input content.\n *\n * @defaultValue `false`\n */\n validateInputContent?: boolean;\n }\n}\n\nexport interface Env {\n /**\n * set the severity level for logging.\n *\n * @defaultValue `'warning'`\n */\n logLevel?: 'verbose'|'info'|'warning'|'error'|'fatal';\n\n /**\n * Indicate whether run in debug mode.\n *\n * @defaultValue `false`\n */\n debug?: boolean;\n\n /**\n * set or get a boolean value indicating whether to enable trace.\n *\n * @defaultValue `false`\n */\n trace?: boolean;\n\n /**\n * Get version of the current package.\n */\n readonly versions: {\n readonly common: string;\n readonly web?: string;\n readonly node?: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n readonly 'react-native'?: string;\n };\n\n /**\n * Represent a set of flags for WebAssembly\n */\n readonly wasm: Env.WebAssemblyFlags;\n\n /**\n * Represent a set of flags for WebGL\n */\n readonly webgl: Env.WebGLFlags;\n\n /**\n * Represent a set of flags for WebGPU\n */\n readonly webgpu: Env.WebGpuFlags;\n\n [name: string]: unknown;\n}\n\n/**\n * Represent a set of flags as a global singleton.\n */\nexport const env: Env = envImpl;\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {TensorToDataUrlOptions, TensorToImageDataOptions} from './tensor-conversion.js';\nimport {Tensor} from './tensor.js';\n\n/**\n * implementation of Tensor.toDataURL()\n */\nexport const tensorToDataURL = (tensor: Tensor, options?: TensorToDataUrlOptions): string => {\n const canvas = typeof document !== 'undefined' ? document.createElement('canvas') : (new OffscreenCanvas(1, 1));\n canvas.width = tensor.dims[3];\n canvas.height = tensor.dims[2];\n const pixels2DContext =\n canvas.getContext('2d') as (CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D | null);\n\n if (pixels2DContext != null) {\n // Default values for height and width & format\n let width: number;\n let height: number;\n if (options?.tensorLayout !== undefined && options.tensorLayout === 'NHWC') {\n width = tensor.dims[2];\n height = tensor.dims[3];\n } else { // Default layout is NCWH\n width = tensor.dims[3];\n height = tensor.dims[2];\n }\n\n const inputformat = options?.format !== undefined ? options.format : 'RGB';\n\n const norm = options?.norm;\n let normMean: [number, number, number, number];\n let normBias: [number, number, number, number];\n if (norm === undefined || norm.mean === undefined) {\n normMean = [255, 255, 255, 255];\n } else {\n if (typeof (norm.mean) === 'number') {\n normMean = [norm.mean, norm.mean, norm.mean, norm.mean];\n } else {\n normMean = [norm.mean[0], norm.mean[1], norm.mean[2], 0];\n if (norm.mean[3] !== undefined) {\n normMean[3] = norm.mean[3];\n }\n }\n }\n if (norm === undefined || norm.bias === undefined) {\n normBias = [0, 0, 0, 0];\n } else {\n if (typeof (norm.bias) === 'number') {\n normBias = [norm.bias, norm.bias, norm.bias, norm.bias];\n } else {\n normBias = [norm.bias[0], norm.bias[1], norm.bias[2], 0];\n if (norm.bias[3] !== undefined) {\n normBias[3] = norm.bias[3];\n }\n }\n }\n\n const stride = height * width;\n // Default pointer assignments\n let rTensorPointer = 0, gTensorPointer = stride, bTensorPointer = stride * 2, aTensorPointer = -1;\n\n // Updating the pointer assignments based on the input image format\n if (inputformat === 'RGBA') {\n rTensorPointer = 0;\n gTensorPointer = stride;\n bTensorPointer = stride * 2;\n aTensorPointer = stride * 3;\n } else if (inputformat === 'RGB') {\n rTensorPointer = 0;\n gTensorPointer = stride;\n bTensorPointer = stride * 2;\n } else if (inputformat === 'RBG') {\n rTensorPointer = 0;\n bTensorPointer = stride;\n gTensorPointer = stride * 2;\n }\n\n for (let i = 0; i < height; i++) {\n for (let j = 0; j < width; j++) {\n const R = ((tensor.data[rTensorPointer++] as number) - normBias[0]) * normMean[0]; // R value\n const G = ((tensor.data[gTensorPointer++] as number) - normBias[1]) * normMean[1]; // G value\n const B = ((tensor.data[bTensorPointer++] as number) - normBias[2]) * normMean[2]; // B value\n const A = aTensorPointer === -1 ?\n 255 :\n ((tensor.data[aTensorPointer++] as number) - normBias[3]) * normMean[3]; // A value\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n pixels2DContext.fillStyle = 'rgba(' + R + ',' + G + ',' + B + ',' + A + ')';\n pixels2DContext.fillRect(j, i, 1, 1);\n }\n }\n if ('toDataURL' in canvas) {\n return canvas.toDataURL();\n } else {\n throw new Error('toDataURL is not supported');\n }\n } else {\n throw new Error('Can not access image data');\n }\n};\n\n/**\n * implementation of Tensor.toImageData()\n */\nexport const tensorToImageData = (tensor: Tensor, options?: TensorToImageDataOptions): ImageData => {\n const pixels2DContext = typeof document !== 'undefined' ?\n document.createElement('canvas').getContext('2d') :\n new OffscreenCanvas(1, 1).getContext('2d') as OffscreenCanvasRenderingContext2D;\n let image: ImageData;\n if (pixels2DContext != null) {\n // Default values for height and width & format\n let width: number;\n let height: number;\n let channels: number;\n if (options?.tensorLayout !== undefined && options.tensorLayout === 'NHWC') {\n width = tensor.dims[2];\n height = tensor.dims[1];\n channels = tensor.dims[3];\n } else { // Default layout is NCWH\n width = tensor.dims[3];\n height = tensor.dims[2];\n channels = tensor.dims[1];\n }\n const inputformat = options !== undefined ? (options.format !== undefined ? options.format : 'RGB') : 'RGB';\n\n const norm = options?.norm;\n let normMean: [number, number, number, number];\n let normBias: [number, number, number, number];\n if (norm === undefined || norm.mean === undefined) {\n normMean = [255, 255, 255, 255];\n } else {\n if (typeof (norm.mean) === 'number') {\n normMean = [norm.mean, norm.mean, norm.mean, norm.mean];\n } else {\n normMean = [norm.mean[0], norm.mean[1], norm.mean[2], 255];\n if (norm.mean[3] !== undefined) {\n normMean[3] = norm.mean[3];\n }\n }\n }\n if (norm === undefined || norm.bias === undefined) {\n normBias = [0, 0, 0, 0];\n } else {\n if (typeof (norm.bias) === 'number') {\n normBias = [norm.bias, norm.bias, norm.bias, norm.bias];\n } else {\n normBias = [norm.bias[0], norm.bias[1], norm.bias[2], 0];\n if (norm.bias[3] !== undefined) {\n normBias[3] = norm.bias[3];\n }\n }\n }\n\n const stride = height * width;\n if (options !== undefined) {\n if (options.format !== undefined && (channels === 4 && options.format !== 'RGBA') ||\n (channels === 3 && (options.format !== 'RGB' && options.format !== 'BGR'))) {\n throw new Error('Tensor format doesn\\'t match input tensor dims');\n }\n }\n\n // Default pointer assignments\n const step = 4;\n let rImagePointer = 0, gImagePointer = 1, bImagePointer = 2, aImagePointer = 3;\n let rTensorPointer = 0, gTensorPointer = stride, bTensorPointer = stride * 2, aTensorPointer = -1;\n\n // Updating the pointer assignments based on the input image format\n if (inputformat === 'RGBA') {\n rTensorPointer = 0;\n gTensorPointer = stride;\n bTensorPointer = stride * 2;\n aTensorPointer = stride * 3;\n } else if (inputformat === 'RGB') {\n rTensorPointer = 0;\n gTensorPointer = stride;\n bTensorPointer = stride * 2;\n } else if (inputformat === 'RBG') {\n rTensorPointer = 0;\n bTensorPointer = stride;\n gTensorPointer = stride * 2;\n }\n\n image = pixels2DContext.createImageData(width, height);\n\n for (let i = 0; i < height * width;\n rImagePointer += step, gImagePointer += step, bImagePointer += step, aImagePointer += step, i++) {\n image.data[rImagePointer] = ((tensor.data[rTensorPointer++] as number) - normBias[0]) * normMean[0]; // R value\n image.data[gImagePointer] = ((tensor.data[gTensorPointer++] as number) - normBias[1]) * normMean[1]; // G value\n image.data[bImagePointer] = ((tensor.data[bTensorPointer++] as number) - normBias[2]) * normMean[2]; // B value\n image.data[aImagePointer] = aTensorPointer === -1 ?\n 255 :\n ((tensor.data[aTensorPointer++] as number) - normBias[3]) * normMean[3]; // A value\n }\n\n } else {\n throw new Error('Can not access image data');\n }\n return image;\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {OptionsDimensions, OptionsFormat, OptionsNormalizationParameters, OptionsTensorFormat, OptionsTensorLayout, TensorFromGpuBufferOptions, TensorFromImageBitmapOptions, TensorFromImageDataOptions, TensorFromImageElementOptions, TensorFromTextureOptions, TensorFromUrlOptions} from './tensor-factory.js';\nimport {Tensor} from './tensor-impl.js';\nimport {Tensor as TensorInterface} from './tensor.js';\n\ninterface BufferToTensorOptions extends OptionsDimensions, OptionsTensorLayout, OptionsNormalizationParameters,\n OptionsFormat, OptionsTensorFormat {}\n\n/**\n * Create a new tensor object from image object\n *\n * @param buffer - Extracted image buffer data - assuming RGBA format\n * @param imageFormat - input image configuration - required configurations height, width, format\n * @param tensorFormat - output tensor configuration - Default is RGB format\n */\nexport const bufferToTensor = (buffer: Uint8ClampedArray|undefined, options: BufferToTensorOptions): Tensor => {\n if (buffer === undefined) {\n throw new Error('Image buffer must be defined');\n }\n if (options.height === undefined || options.width === undefined) {\n throw new Error('Image height and width must be defined');\n }\n if (options.tensorLayout === 'NHWC') {\n throw new Error('NHWC Tensor layout is not supported yet');\n }\n\n const {height, width} = options;\n\n const norm = options.norm ?? {mean: 255, bias: 0};\n let normMean: [number, number, number, number];\n let normBias: [number, number, number, number];\n\n if (typeof (norm.mean) === 'number') {\n normMean = [norm.mean, norm.mean, norm.mean, norm.mean];\n } else {\n normMean = [norm.mean![0], norm.mean![1], norm.mean![2], norm.mean![3] ?? 255];\n }\n\n if (typeof (norm.bias) === 'number') {\n normBias = [norm.bias, norm.bias, norm.bias, norm.bias];\n } else {\n normBias = [norm.bias![0], norm.bias![1], norm.bias![2], norm.bias![3] ?? 0];\n }\n\n const inputformat = options.format !== undefined ? options.format : 'RGBA';\n // default value is RGBA since imagedata and HTMLImageElement uses it\n\n const outputformat =\n options.tensorFormat !== undefined ? (options.tensorFormat !== undefined ? options.tensorFormat : 'RGB') : 'RGB';\n const stride = height * width;\n const float32Data = outputformat === 'RGBA' ? new Float32Array(stride * 4) : new Float32Array(stride * 3);\n\n // Default pointer assignments\n let step = 4, rImagePointer = 0, gImagePointer = 1, bImagePointer = 2, aImagePointer = 3;\n let rTensorPointer = 0, gTensorPointer = stride, bTensorPointer = stride * 2, aTensorPointer = -1;\n\n // Updating the pointer assignments based on the input image format\n if (inputformat === 'RGB') {\n step = 3;\n rImagePointer = 0;\n gImagePointer = 1;\n bImagePointer = 2;\n aImagePointer = -1;\n }\n\n // Updating the pointer assignments based on the output tensor format\n if (outputformat === 'RGBA') {\n aTensorPointer = stride * 3;\n } else if (outputformat === 'RBG') {\n rTensorPointer = 0;\n bTensorPointer = stride;\n gTensorPointer = stride * 2;\n } else if (outputformat === 'BGR') {\n bTensorPointer = 0;\n gTensorPointer = stride;\n rTensorPointer = stride * 2;\n }\n\n for (let i = 0; i < stride;\n i++, rImagePointer += step, bImagePointer += step, gImagePointer += step, aImagePointer += step) {\n float32Data[rTensorPointer++] = (buffer[rImagePointer] + normBias[0]) / normMean[0];\n float32Data[gTensorPointer++] = (buffer[gImagePointer] + normBias[1]) / normMean[1];\n float32Data[bTensorPointer++] = (buffer[bImagePointer] + normBias[2]) / normMean[2];\n if (aTensorPointer !== -1 && aImagePointer !== -1) {\n float32Data[aTensorPointer++] = (buffer[aImagePointer] + normBias[3]) / normMean[3];\n }\n }\n\n // Float32Array -> ort.Tensor\n const outputTensor = outputformat === 'RGBA' ? new Tensor('float32', float32Data, [1, 4, height, width]) :\n new Tensor('float32', float32Data, [1, 3, height, width]);\n return outputTensor;\n};\n\n/**\n * implementation of Tensor.fromImage().\n */\nexport const tensorFromImage = async(\n image: ImageData|HTMLImageElement|ImageBitmap|string,\n options?: TensorFromImageDataOptions|TensorFromImageElementOptions|TensorFromImageBitmapOptions|\n TensorFromUrlOptions): Promise => {\n // checking the type of image object\n const isHTMLImageEle = typeof (HTMLImageElement) !== 'undefined' && image instanceof HTMLImageElement;\n const isImageDataEle = typeof (ImageData) !== 'undefined' && image instanceof ImageData;\n const isImageBitmap = typeof (ImageBitmap) !== 'undefined' && image instanceof ImageBitmap;\n const isString = typeof image === 'string';\n\n let data: Uint8ClampedArray|undefined;\n let bufferToTensorOptions: BufferToTensorOptions = options ?? {};\n\n const createCanvas = () => {\n if (typeof document !== 'undefined') {\n return document.createElement('canvas');\n } else if (typeof OffscreenCanvas !== 'undefined') {\n return new OffscreenCanvas(1, 1);\n } else {\n throw new Error('Canvas is not supported');\n }\n };\n const createCanvasContext = (canvas: HTMLCanvasElement|OffscreenCanvas) => {\n if (canvas instanceof HTMLCanvasElement) {\n return canvas.getContext('2d');\n } else if (canvas instanceof OffscreenCanvas) {\n return canvas.getContext('2d') as OffscreenCanvasRenderingContext2D;\n } else {\n return null;\n }\n };\n // filling and checking image configuration options\n if (isHTMLImageEle) {\n // HTMLImageElement - image object - format is RGBA by default\n const canvas = createCanvas();\n canvas.width = image.width;\n canvas.height = image.height;\n const pixels2DContext = createCanvasContext(canvas);\n\n if (pixels2DContext != null) {\n let height = image.height;\n let width = image.width;\n if (options !== undefined && options.resizedHeight !== undefined && options.resizedWidth !== undefined) {\n height = options.resizedHeight;\n width = options.resizedWidth;\n }\n\n if (options !== undefined) {\n bufferToTensorOptions = options;\n if (options.tensorFormat !== undefined) {\n throw new Error('Image input config format must be RGBA for HTMLImageElement');\n } else {\n bufferToTensorOptions.tensorFormat = 'RGBA';\n }\n bufferToTensorOptions.height = height;\n bufferToTensorOptions.width = width;\n } else {\n bufferToTensorOptions.tensorFormat = 'RGBA';\n bufferToTensorOptions.height = height;\n bufferToTensorOptions.width = width;\n }\n\n pixels2DContext.drawImage(image, 0, 0);\n data = pixels2DContext.getImageData(0, 0, width, height).data;\n } else {\n throw new Error('Can not access image data');\n }\n } else if (isImageDataEle) {\n let height: number;\n let width: number;\n\n if (options !== undefined && options.resizedWidth !== undefined && options.resizedHeight !== undefined) {\n height = options.resizedHeight;\n width = options.resizedWidth;\n } else {\n height = image.height;\n width = image.width;\n }\n\n if (options !== undefined) {\n bufferToTensorOptions = options;\n }\n bufferToTensorOptions.format = 'RGBA';\n bufferToTensorOptions.height = height;\n bufferToTensorOptions.width = width;\n\n if (options !== undefined) {\n const tempCanvas = createCanvas();\n\n tempCanvas.width = width;\n tempCanvas.height = height;\n\n const pixels2DContext = createCanvasContext(tempCanvas);\n\n if (pixels2DContext != null) {\n pixels2DContext.putImageData(image, 0, 0);\n data = pixels2DContext.getImageData(0, 0, width, height).data;\n } else {\n throw new Error('Can not access image data');\n }\n } else {\n data = image.data;\n }\n } else if (isImageBitmap) {\n // ImageBitmap - image object - format must be provided by user\n if (options === undefined) {\n throw new Error('Please provide image config with format for Imagebitmap');\n }\n\n const canvas = createCanvas();\n canvas.width = image.width;\n canvas.height = image.height;\n const pixels2DContext = createCanvasContext(canvas);\n\n if (pixels2DContext != null) {\n const height = image.height;\n const width = image.width;\n pixels2DContext.drawImage(image, 0, 0, width, height);\n data = pixels2DContext.getImageData(0, 0, width, height).data;\n bufferToTensorOptions.height = height;\n bufferToTensorOptions.width = width;\n return bufferToTensor(data, bufferToTensorOptions);\n } else {\n throw new Error('Can not access image data');\n }\n } else if (isString) {\n return new Promise((resolve, reject) => {\n const canvas = createCanvas();\n const context = createCanvasContext(canvas);\n if (!image || !context) {\n return reject();\n }\n const newImage = new Image();\n newImage.crossOrigin = 'Anonymous';\n newImage.src = image;\n newImage.onload = () => {\n canvas.width = newImage.width;\n canvas.height = newImage.height;\n context.drawImage(newImage, 0, 0, canvas.width, canvas.height);\n const img = context.getImageData(0, 0, canvas.width, canvas.height);\n\n bufferToTensorOptions.height = canvas.height;\n bufferToTensorOptions.width = canvas.width;\n resolve(bufferToTensor(img.data, bufferToTensorOptions));\n };\n });\n } else {\n throw new Error('Input data provided is not supported - aborted tensor creation');\n }\n\n if (data !== undefined) {\n return bufferToTensor(data, bufferToTensorOptions);\n } else {\n throw new Error('Input data provided is not supported - aborted tensor creation');\n }\n};\n\n/**\n * implementation of Tensor.fromTexture().\n */\nexport const tensorFromTexture = (\n texture: TensorInterface.TextureType, options: TensorFromTextureOptions): Tensor => {\n const {width, height, download, dispose} = options;\n // Always assume RGBAF32. TODO: support different texture format\n const dims = [1, height, width, 4];\n return new Tensor({location: 'texture', type: 'float32', texture, dims, download, dispose});\n};\n\n/**\n * implementation of Tensor.fromGpuBuffer().\n */\nexport const tensorFromGpuBuffer = (\n gpuBuffer: TensorInterface.GpuBufferType, options: TensorFromGpuBufferOptions): Tensor => {\n const {dataType, dims, download, dispose} = options;\n return new Tensor({location: 'gpu-buffer', type: dataType ?? 'float32', gpuBuffer, dims, download, dispose});\n};\n\n/**\n * implementation of Tensor.fromPinnedBuffer().\n */\nexport const tensorFromPinnedBuffer = (\n type: T, buffer: TensorInterface.DataTypeMap[T], dims?: readonly number[]): Tensor =>\n new Tensor({location: 'cpu-pinned', type, data: buffer, dims: dims ?? [buffer.length]});\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Tensor} from './tensor.js';\n\nexport type SupportedTypedArrayConstructors = Float32ArrayConstructor|Uint8ArrayConstructor|Int8ArrayConstructor|\n Uint16ArrayConstructor|Int16ArrayConstructor|Int32ArrayConstructor|BigInt64ArrayConstructor|Uint8ArrayConstructor|\n Float64ArrayConstructor|Uint32ArrayConstructor|BigUint64ArrayConstructor;\nexport type SupportedTypedArray = InstanceType;\n\n// a runtime map that maps type string to TypedArray constructor. Should match Tensor.DataTypeMap.\nexport const NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP = new Map([\n ['float32', Float32Array],\n ['uint8', Uint8Array],\n ['int8', Int8Array],\n ['uint16', Uint16Array],\n ['int16', Int16Array],\n ['int32', Int32Array],\n ['bool', Uint8Array],\n ['float64', Float64Array],\n ['uint32', Uint32Array],\n]);\n\n// a runtime map that maps type string to TypedArray constructor. Should match Tensor.DataTypeMap.\nexport const NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP = new Map([\n [Float32Array, 'float32'],\n [Uint8Array, 'uint8'],\n [Int8Array, 'int8'],\n [Uint16Array, 'uint16'],\n [Int16Array, 'int16'],\n [Int32Array, 'int32'],\n [Float64Array, 'float64'],\n [Uint32Array, 'uint32'],\n]);\n\n// a dummy type declaration for Float16Array in case any polyfill is available.\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-explicit-any\n const Float16Array: any;\n}\n\n// the following code allows delaying execution of BigInt/Float16Array checking. This allows lazy initialization for\n// NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP and NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP, which allows BigInt/Float16Array\n// polyfill if available.\nlet isTypedArrayChecked = false;\nexport const checkTypedArray = () => {\n if (!isTypedArrayChecked) {\n isTypedArrayChecked = true;\n const isBigInt64ArrayAvailable = typeof BigInt64Array !== 'undefined' && BigInt64Array.from;\n const isBigUint64ArrayAvailable = typeof BigUint64Array !== 'undefined' && BigUint64Array.from;\n const isFloat16ArrayAvailable = typeof Float16Array !== 'undefined' && Float16Array.from;\n\n if (isBigInt64ArrayAvailable) {\n NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set('int64', BigInt64Array);\n NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigInt64Array, 'int64');\n }\n if (isBigUint64ArrayAvailable) {\n NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set('uint64', BigUint64Array);\n NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(BigUint64Array, 'uint64');\n }\n if (isFloat16ArrayAvailable) {\n NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set('float16', Float16Array);\n NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.set(Float16Array, 'float16');\n } else {\n // if Float16Array is not available, use 'Uint16Array' to store the data.\n NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.set('float16', Uint16Array);\n }\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {CpuPinnedConstructorParameters, GpuBufferConstructorParameters, TextureConstructorParameters} from './tensor-factory.js';\nimport {Tensor} from './tensor-impl.js';\n\n/**\n * calculate size from dims.\n *\n * @param dims the dims array. May be an illegal input.\n */\nexport const calculateSize = (dims: readonly unknown[]): number => {\n let size = 1;\n for (let i = 0; i < dims.length; i++) {\n const dim = dims[i];\n if (typeof dim !== 'number' || !Number.isSafeInteger(dim)) {\n throw new TypeError(`dims[${i}] must be an integer, got: ${dim}`);\n }\n if (dim < 0) {\n throw new RangeError(`dims[${i}] must be a non-negative integer, got: ${dim}`);\n }\n size *= dim;\n }\n return size;\n};\n\n/**\n * implementation of Tensor.reshape()\n */\nexport const tensorReshape = (tensor: Tensor, dims: readonly number[]): Tensor => {\n switch (tensor.location) {\n case 'cpu':\n return new Tensor(tensor.type, tensor.data, dims);\n case 'cpu-pinned':\n return new Tensor({\n location: 'cpu-pinned',\n data: tensor.data as CpuPinnedConstructorParameters['data'],\n type: tensor.type as CpuPinnedConstructorParameters['type'],\n dims,\n });\n case 'texture':\n return new Tensor({\n location: 'texture',\n texture: tensor.texture,\n type: tensor.type as TextureConstructorParameters['type'],\n dims,\n });\n case 'gpu-buffer':\n return new Tensor({\n location: 'gpu-buffer',\n gpuBuffer: tensor.gpuBuffer,\n type: tensor.type as GpuBufferConstructorParameters['type'],\n dims,\n });\n default:\n throw new Error(`tensorReshape: tensor location ${tensor.location} is not supported`);\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {tensorToDataURL, tensorToImageData} from './tensor-conversion-impl.js';\nimport {TensorToDataUrlOptions, TensorToImageDataOptions} from './tensor-conversion.js';\nimport {tensorFromGpuBuffer, tensorFromImage, tensorFromPinnedBuffer, tensorFromTexture} from './tensor-factory-impl.js';\nimport {CpuPinnedConstructorParameters, GpuBufferConstructorParameters, TensorFromGpuBufferOptions, TensorFromImageBitmapOptions, TensorFromImageDataOptions, TensorFromImageElementOptions, TensorFromTextureOptions, TensorFromUrlOptions, TextureConstructorParameters} from './tensor-factory.js';\nimport {checkTypedArray, NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP, NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP, SupportedTypedArray, SupportedTypedArrayConstructors} from './tensor-impl-type-mapping.js';\nimport {calculateSize, tensorReshape} from './tensor-utils-impl.js';\nimport {Tensor as TensorInterface} from './tensor.js';\n\n// type aliases for those exported from Tensor interface\n\ntype TensorType = TensorInterface.Type;\ntype TensorDataType = TensorInterface.DataType;\ntype TensorDataLocation = TensorInterface.DataLocation;\ntype TensorTextureType = TensorInterface.TextureType;\ntype TensorGpuBufferType = TensorInterface.GpuBufferType;\n\n/**\n * the implementation of Tensor interface.\n *\n * @ignore\n */\nexport class Tensor implements TensorInterface {\n // #region constructors\n\n /**\n * Construct a new CPU tensor object from the given type, data and dims.\n */\n constructor(\n type: TensorType, data: TensorDataType|readonly string[]|readonly number[]|readonly boolean[],\n dims?: readonly number[]);\n /**\n * Construct a new CPU tensor object from the given data and dims. Type is inferred from data.\n */\n constructor(data: TensorDataType|readonly string[]|readonly boolean[], dims?: readonly number[]);\n /**\n * Construct a new tensor object from the pinned CPU data with the given type and dims.\n *\n * Tensor's location will be set to 'cpu-pinned'.\n *\n * @param params - Specify the parameters to construct the tensor.\n */\n constructor(params: CpuPinnedConstructorParameters);\n /**\n * Construct a new tensor object from the WebGL texture with the given type and dims.\n *\n * Tensor's location will be set to 'texture'.\n *\n * @param params - Specify the parameters to construct the tensor.\n */\n constructor(params: TextureConstructorParameters);\n /**\n * Construct a new tensor object from the WebGPU buffer with the given type and dims.\n *\n * Tensor's location will be set to 'gpu-buffer'.\n *\n * @param params - Specify the parameters to construct the tensor.\n */\n constructor(params: GpuBufferConstructorParameters);\n\n /**\n * implementation.\n */\n constructor(\n arg0: TensorType|TensorDataType|readonly string[]|readonly boolean[]|CpuPinnedConstructorParameters|\n TextureConstructorParameters|GpuBufferConstructorParameters,\n arg1?: TensorDataType|readonly number[]|readonly string[]|readonly boolean[], arg2?: readonly number[]) {\n // perform one-time check for BigInt/Float16Array support\n checkTypedArray();\n\n let type: TensorType;\n let dims: readonly number[];\n\n if (typeof arg0 === 'object' && 'location' in arg0) {\n //\n // constructing tensor from specific location\n //\n this.dataLocation = arg0.location;\n type = arg0.type;\n dims = arg0.dims;\n switch (arg0.location) {\n case 'cpu-pinned': {\n const expectedTypedArrayConstructor = NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.get(type);\n if (!expectedTypedArrayConstructor) {\n throw new TypeError(`unsupported type \"${type}\" to create tensor from pinned buffer`);\n }\n if (!(arg0.data instanceof expectedTypedArrayConstructor)) {\n throw new TypeError(`buffer should be of type ${expectedTypedArrayConstructor.name}`);\n }\n this.cpuData = arg0.data;\n break;\n }\n case 'texture': {\n if (type !== 'float32') {\n throw new TypeError(`unsupported type \"${type}\" to create tensor from texture`);\n }\n this.gpuTextureData = arg0.texture;\n this.downloader = arg0.download;\n this.disposer = arg0.dispose;\n break;\n }\n case 'gpu-buffer': {\n if ((type !== 'float32' && type !== 'float16' && type !== 'int32' && type !== 'int64' && type !== 'uint32' &&\n type !== 'uint8' && type !== 'bool')) {\n throw new TypeError(`unsupported type \"${type}\" to create tensor from gpu buffer`);\n }\n this.gpuBufferData = arg0.gpuBuffer;\n this.downloader = arg0.download;\n this.disposer = arg0.dispose;\n break;\n }\n default:\n throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`);\n }\n } else {\n //\n // constructing tensor of location 'cpu'\n //\n let data: TensorDataType;\n let maybeDims: typeof arg1|typeof arg2;\n // check whether arg0 is type or data\n if (typeof arg0 === 'string') {\n //\n // Override: constructor(type, data, ...)\n //\n type = arg0;\n maybeDims = arg2;\n if (arg0 === 'string') {\n // string tensor\n if (!Array.isArray(arg1)) {\n throw new TypeError('A string tensor\\'s data must be a string array.');\n }\n // we don't check whether every element in the array is string; this is too slow. we assume it's correct and\n // error will be populated at inference\n data = arg1;\n } else {\n // numeric tensor\n const typedArrayConstructor = NUMERIC_TENSOR_TYPE_TO_TYPEDARRAY_MAP.get(arg0);\n if (typedArrayConstructor === undefined) {\n throw new TypeError(`Unsupported tensor type: ${arg0}.`);\n }\n if (Array.isArray(arg1)) {\n if (arg0 === 'float16' && typedArrayConstructor === Uint16Array) {\n // When no Float16Array polyfill is used, we cannot create 'float16' tensor from number array.\n //\n // Throw error here because when user try to use number array as data,\n // e.g. new Tensor('float16', [1, 2, 3, 4], dims)), it will actually call\n // Uint16Array.from(arg1) which generates wrong data.\n throw new TypeError(\n 'Creating a float16 tensor from number array is not supported. Please use Uint16Array as data.');\n } else if (arg0 === 'uint64' || arg0 === 'int64') {\n // use 'as any' here because:\n // 1. TypeScript's check on type of 'Array.isArray()' does not work with readonly arrays.\n // see https://github.com/microsoft/TypeScript/issues/17002\n // 2. TypeScript's check on union type of '(BigInt64ArrayConstructor|BigUint64ArrayConstructor).from()'\n // does not accept parameter mapFn.\n // 3. parameters of 'SupportedTypedArrayConstructors.from()' does not match the requirement of the union\n // type.\n\n // assume 'arg1' is of type \"readonly number[]|readonly bigint[]\" here.\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data = (typedArrayConstructor as any).from(arg1, BigInt);\n } else {\n // assume 'arg1' is of type \"readonly number[]\" here.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data = (typedArrayConstructor as any).from(arg1);\n }\n } else if (arg1 instanceof typedArrayConstructor) {\n data = arg1;\n } else {\n throw new TypeError(`A ${type} tensor's data must be type of ${typedArrayConstructor}`);\n }\n }\n } else {\n //\n // Override: constructor(data, ...)\n //\n maybeDims = arg1;\n if (Array.isArray(arg0)) {\n // only boolean[] and string[] is supported\n if (arg0.length === 0) {\n throw new TypeError('Tensor type cannot be inferred from an empty array.');\n }\n const firstElementType = typeof arg0[0];\n if (firstElementType === 'string') {\n type = 'string';\n data = arg0;\n } else if (firstElementType === 'boolean') {\n type = 'bool';\n // 'arg0' is of type 'boolean[]'. Uint8Array.from(boolean[]) actually works, but typescript thinks this is\n // wrong type. We use 'as any' to make it happy.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data = Uint8Array.from(arg0 as any[]);\n } else {\n throw new TypeError(`Invalid element type of data array: ${firstElementType}.`);\n }\n } else {\n // get tensor type from TypedArray\n const mappedType =\n NUMERIC_TENSOR_TYPEDARRAY_TO_TYPE_MAP.get(arg0.constructor as SupportedTypedArrayConstructors);\n if (mappedType === undefined) {\n throw new TypeError(`Unsupported type for tensor data: ${arg0.constructor}.`);\n }\n type = mappedType;\n data = arg0 as SupportedTypedArray;\n }\n }\n\n // type and data is processed, now processing dims\n if (maybeDims === undefined) {\n // assume 1-D tensor if dims omitted\n maybeDims = [data.length];\n } else if (!Array.isArray(maybeDims)) {\n throw new TypeError('A tensor\\'s dims must be a number array');\n }\n dims = maybeDims as readonly number[];\n\n this.cpuData = data;\n this.dataLocation = 'cpu';\n }\n\n // perform check on dims\n const size = calculateSize(dims);\n // if data is on CPU, check whether data length matches tensor size\n if (this.cpuData && size !== this.cpuData.length) {\n throw new Error(`Tensor's size(${size}) does not match data length(${this.cpuData.length}).`);\n }\n\n this.type = type;\n this.dims = dims;\n this.size = size;\n }\n // #endregion\n\n // #region factory\n static async fromImage(\n image: ImageData|HTMLImageElement|ImageBitmap|string,\n options?: TensorFromImageDataOptions|TensorFromImageElementOptions|TensorFromImageBitmapOptions|\n TensorFromUrlOptions): Promise {\n return tensorFromImage(image, options);\n }\n\n static fromTexture(\n texture: TensorTextureType, options: TensorFromTextureOptions): TensorInterface {\n return tensorFromTexture(texture, options);\n }\n\n static fromGpuBuffer(\n gpuBuffer: TensorGpuBufferType, options: TensorFromGpuBufferOptions): TensorInterface {\n return tensorFromGpuBuffer(gpuBuffer, options);\n }\n\n static fromPinnedBuffer(\n type: T, buffer: TensorInterface.DataTypeMap[T], dims?: readonly number[]): Tensor {\n return tensorFromPinnedBuffer(type, buffer, dims);\n }\n\n // #endregion\n\n // #region conversions\n toDataURL(options?: TensorToDataUrlOptions): string {\n return tensorToDataURL(this, options);\n }\n\n toImageData(options?: TensorToImageDataOptions): ImageData {\n return tensorToImageData(this, options);\n }\n // #endregion\n\n // #region public fields\n readonly dims: readonly number[];\n readonly type: TensorType;\n readonly size: number;\n // #endregion\n\n // #region private fields\n\n /**\n * stores the location of the data.\n */\n private dataLocation: TensorDataLocation;\n\n /**\n * stores the data on CPU, if location is 'cpu' or 'cpu-pinned'. otherwise empty.\n */\n private cpuData?: TensorDataType;\n\n /**\n * stores the underlying texture when location is 'texture'. otherwise empty.\n */\n private gpuTextureData?: TensorTextureType;\n\n /**\n * stores the underlying GPU buffer when location is 'gpu-buffer'. otherwise empty.\n */\n private gpuBufferData?: TensorGpuBufferType;\n\n /**\n * stores an optional downloader function to download data from GPU to CPU.\n */\n private downloader?(): Promise;\n\n /**\n * a flag indicating whether the data is being downloaded from GPU to CPU.\n */\n private isDownloading?: boolean;\n\n /**\n * stores an optional disposer function to dispose the underlying data.\n */\n private disposer?(): void;\n // #endregion\n\n // #region properties\n get data(): TensorDataType {\n this.ensureValid();\n if (!this.cpuData) {\n throw new Error(\n 'The data is not on CPU. Use `getData()` to download GPU data to CPU, ' +\n 'or use `texture` or `gpuBuffer` property to access the GPU data directly.');\n }\n return this.cpuData;\n }\n\n get location(): TensorDataLocation {\n return this.dataLocation;\n }\n\n get texture(): TensorTextureType {\n this.ensureValid();\n if (!this.gpuTextureData) {\n throw new Error('The data is not stored as a WebGL texture.');\n }\n return this.gpuTextureData;\n }\n\n get gpuBuffer(): TensorGpuBufferType {\n this.ensureValid();\n if (!this.gpuBufferData) {\n throw new Error('The data is not stored as a WebGPU buffer.');\n }\n return this.gpuBufferData;\n }\n // #endregion\n\n // #region methods\n\n async getData(releaseData?: boolean): Promise {\n this.ensureValid();\n switch (this.dataLocation) {\n case 'cpu':\n case 'cpu-pinned':\n return this.data;\n case 'texture':\n case 'gpu-buffer': {\n if (!this.downloader) {\n throw new Error('The current tensor is not created with a specified data downloader.');\n }\n if (this.isDownloading) {\n throw new Error('The current tensor is being downloaded.');\n }\n try {\n this.isDownloading = true;\n const data = await this.downloader();\n this.downloader = undefined;\n this.dataLocation = 'cpu';\n this.cpuData = data;\n\n if (releaseData && this.disposer) {\n this.disposer();\n this.disposer = undefined;\n }\n\n return data;\n\n } finally {\n this.isDownloading = false;\n }\n }\n default:\n throw new Error(`cannot get data from location: ${this.dataLocation}`);\n }\n }\n\n dispose(): void {\n if (this.isDownloading) {\n throw new Error('The current tensor is being downloaded.');\n }\n\n if (this.disposer) {\n this.disposer();\n this.disposer = undefined;\n }\n this.cpuData = undefined;\n this.gpuTextureData = undefined;\n this.gpuBufferData = undefined;\n this.downloader = undefined;\n this.isDownloading = undefined;\n\n this.dataLocation = 'none';\n }\n\n // #endregion\n\n // #region tensor utilities\n private ensureValid(): void {\n if (this.dataLocation === 'none') {\n throw new Error('The tensor is disposed.');\n }\n }\n\n reshape(dims: readonly number[]): TensorInterface {\n this.ensureValid();\n if (this.downloader || this.disposer) {\n throw new Error('Cannot reshape a tensor that owns GPU resource.');\n }\n return tensorReshape(this, dims);\n }\n // #endregion\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {TensorFactory} from './tensor-factory.js';\nimport {Tensor as TensorImpl} from './tensor-impl.js';\nimport {TypedTensorUtils} from './tensor-utils.js';\n\n/* eslint-disable @typescript-eslint/no-redeclare */\n\n/**\n * represent a basic tensor with specified dimensions and data type.\n */\ninterface TypedTensorBase {\n /**\n * Get the dimensions of the tensor.\n */\n readonly dims: readonly number[];\n /**\n * Get the data type of the tensor.\n */\n readonly type: T;\n /**\n * Get the buffer data of the tensor.\n *\n * If the data is not on CPU (eg. it's in the form of WebGL texture or WebGPU buffer), throw error.\n */\n readonly data: Tensor.DataTypeMap[T];\n /**\n * Get the location of the data.\n */\n readonly location: Tensor.DataLocation;\n /**\n * Get the WebGL texture that holds the tensor data.\n *\n * If the data is not on GPU as WebGL texture, throw error.\n */\n readonly texture: Tensor.TextureType;\n /**\n * Get the WebGPU buffer that holds the tensor data.\n *\n * If the data is not on GPU as WebGPU buffer, throw error.\n */\n readonly gpuBuffer: Tensor.GpuBufferType;\n\n /**\n * Get the buffer data of the tensor.\n *\n * If the data is on CPU, returns the data immediately.\n * If the data is on GPU, downloads the data and returns the promise.\n *\n * @param releaseData - whether release the data on GPU. Ignore if data is already on CPU.\n */\n getData(releaseData?: boolean): Promise;\n\n /**\n * Dispose the tensor data.\n *\n * If the data is on CPU, remove its internal reference to the underlying data.\n * If the data is on GPU, release the data on GPU.\n *\n * After calling this function, the tensor is considered no longer valid. Its location will be set to 'none'.\n */\n dispose(): void;\n}\n\nexport declare namespace Tensor {\n interface DataTypeMap {\n float32: Float32Array;\n uint8: Uint8Array;\n int8: Int8Array;\n uint16: Uint16Array;\n int16: Int16Array;\n int32: Int32Array;\n int64: BigInt64Array;\n string: string[];\n bool: Uint8Array;\n float16: Uint16Array; // Keep using Uint16Array until we have a concrete solution for float 16.\n float64: Float64Array;\n uint32: Uint32Array;\n uint64: BigUint64Array;\n // complex64: never;\n // complex128: never;\n // bfloat16: never;\n }\n\n interface ElementTypeMap {\n float32: number;\n uint8: number;\n int8: number;\n uint16: number;\n int16: number;\n int32: number;\n int64: bigint;\n string: string;\n bool: boolean;\n float16: number; // Keep using Uint16Array until we have a concrete solution for float 16.\n float64: number;\n uint32: number;\n uint64: bigint;\n // complex64: never;\n // complex128: never;\n // bfloat16: never;\n }\n\n type DataType = DataTypeMap[Type];\n type ElementType = ElementTypeMap[Type];\n\n /**\n * supported data types for constructing a tensor from a pinned CPU buffer\n */\n export type CpuPinnedDataTypes = Exclude;\n\n /**\n * type alias for WebGL texture\n */\n export type TextureType = WebGLTexture;\n\n /**\n * supported data types for constructing a tensor from a WebGL texture\n */\n export type TextureDataTypes = 'float32';\n\n /**\n * type alias for WebGPU buffer\n *\n * The reason why we don't use type \"GPUBuffer\" defined in webgpu.d.ts from @webgpu/types is because \"@webgpu/types\"\n * requires \"@types/dom-webcodecs\" as peer dependency when using TypeScript < v5.1 and its version need to be chosen\n * carefully according to the TypeScript version being used. This means so far there is not a way to keep every\n * TypeScript version happy. It turns out that we will easily broke users on some TypeScript version.\n *\n * for more info see https://github.com/gpuweb/types/issues/127\n */\n export type GpuBufferType = {size: number; mapState: 'unmapped' | 'pending' | 'mapped'};\n\n /**\n * supported data types for constructing a tensor from a WebGPU buffer\n */\n export type GpuBufferDataTypes = 'float32'|'float16'|'int32'|'int64'|'uint32'|'uint8'|'bool';\n\n /**\n * represent where the tensor data is stored\n */\n export type DataLocation = 'none'|'cpu'|'cpu-pinned'|'texture'|'gpu-buffer';\n\n /**\n * represent the data type of a tensor\n */\n export type Type = keyof DataTypeMap;\n}\n\n/**\n * Represent multi-dimensional arrays to feed to or fetch from model inferencing.\n */\nexport interface TypedTensor extends TypedTensorBase, TypedTensorUtils {}\n/**\n * Represent multi-dimensional arrays to feed to or fetch from model inferencing.\n */\nexport interface Tensor extends TypedTensorBase, TypedTensorUtils {}\n\n/**\n * type TensorConstructor defines the constructors of 'Tensor' to create CPU tensor instances.\n */\nexport interface TensorConstructor extends TensorFactory {\n // #region CPU tensor - specify element type\n /**\n * Construct a new string tensor object from the given type, data and dims.\n *\n * @param type - Specify the element type.\n * @param data - Specify the CPU tensor data.\n * @param dims - Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n */\n new(type: 'string', data: Tensor.DataTypeMap['string']|readonly string[],\n dims?: readonly number[]): TypedTensor<'string'>;\n\n /**\n * Construct a new bool tensor object from the given type, data and dims.\n *\n * @param type - Specify the element type.\n * @param data - Specify the CPU tensor data.\n * @param dims - Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n */\n new(type: 'bool', data: Tensor.DataTypeMap['bool']|readonly boolean[], dims?: readonly number[]): TypedTensor<'bool'>;\n\n /**\n * Construct a new 64-bit integer typed tensor object from the given type, data and dims.\n *\n * @param type - Specify the element type.\n * @param data - Specify the CPU tensor data.\n * @param dims - Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n */\n new(\n type: T, data: Tensor.DataTypeMap[T]|readonly bigint[]|readonly number[],\n dims?: readonly number[]): TypedTensor;\n\n /**\n * Construct a new numeric tensor object from the given type, data and dims.\n *\n * @param type - Specify the element type.\n * @param data - Specify the CPU tensor data.\n * @param dims - Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n */\n new>(\n type: T, data: Tensor.DataTypeMap[T]|readonly number[], dims?: readonly number[]): TypedTensor;\n // #endregion\n\n // #region CPU tensor - infer element types\n\n /**\n * Construct a new float32 tensor object from the given data and dims.\n *\n * @param data - Specify the CPU tensor data.\n * @param dims - Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n */\n new(data: Float32Array, dims?: readonly number[]): TypedTensor<'float32'>;\n\n /**\n * Construct a new int8 tensor object from the given data and dims.\n *\n * @param data - Specify the CPU tensor data.\n * @param dims - Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n */\n new(data: Int8Array, dims?: readonly number[]): TypedTensor<'int8'>;\n\n /**\n * Construct a new uint8 tensor object from the given data and dims.\n *\n * @param data - Specify the CPU tensor data.\n * @param dims - Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n */\n new(data: Uint8Array, dims?: readonly number[]): TypedTensor<'uint8'>;\n\n /**\n * Construct a new uint16 tensor object from the given data and dims.\n *\n * @param data - Specify the CPU tensor data.\n * @param dims - Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n */\n new(data: Uint16Array, dims?: readonly number[]): TypedTensor<'uint16'>;\n\n /**\n * Construct a new int16 tensor object from the given data and dims.\n *\n * @param data - Specify the CPU tensor data.\n * @param dims - Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n */\n new(data: Int16Array, dims?: readonly number[]): TypedTensor<'int16'>;\n\n /**\n * Construct a new int32 tensor object from the given data and dims.\n *\n * @param data - Specify the CPU tensor data.\n * @param dims - Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n */\n new(data: Int32Array, dims?: readonly number[]): TypedTensor<'int32'>;\n\n /**\n * Construct a new int64 tensor object from the given data and dims.\n *\n * @param data - Specify the CPU tensor data.\n * @param dims - Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n */\n new(data: BigInt64Array, dims?: readonly number[]): TypedTensor<'int64'>;\n\n /**\n * Construct a new string tensor object from the given data and dims.\n *\n * @param data - Specify the CPU tensor data.\n * @param dims - Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n */\n new(data: readonly string[], dims?: readonly number[]): TypedTensor<'string'>;\n\n /**\n * Construct a new bool tensor object from the given data and dims.\n *\n * @param data - Specify the CPU tensor data.\n * @param dims - Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n */\n new(data: readonly boolean[], dims?: readonly number[]): TypedTensor<'bool'>;\n\n /**\n * Construct a new float64 tensor object from the given data and dims.\n *\n * @param data - Specify the CPU tensor data.\n * @param dims - Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n */\n new(data: Float64Array, dims?: readonly number[]): TypedTensor<'float64'>;\n\n /**\n * Construct a new uint32 tensor object from the given data and dims.\n *\n * @param data - Specify the CPU tensor data.\n * @param dims - Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n */\n new(data: Uint32Array, dims?: readonly number[]): TypedTensor<'uint32'>;\n\n /**\n * Construct a new uint64 tensor object from the given data and dims.\n *\n * @param data - Specify the CPU tensor data.\n * @param dims - Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n */\n new(data: BigUint64Array, dims?: readonly number[]): TypedTensor<'uint64'>;\n\n // #endregion\n\n // #region CPU tensor - fall back to non-generic tensor type declaration\n\n /**\n * Construct a new tensor object from the given type, data and dims.\n *\n * @param type - Specify the element type.\n * @param data - Specify the CPU tensor data.\n * @param dims - Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n */\n new(type: Tensor.Type, data: Tensor.DataType|readonly number[]|readonly string[]|readonly bigint[]|readonly boolean[],\n dims?: readonly number[]): Tensor;\n\n /**\n * Construct a new tensor object from the given data and dims.\n *\n * @param data - Specify the CPU tensor data.\n * @param dims - Specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n */\n new(data: Tensor.DataType, dims?: readonly number[]): Tensor;\n // #endregion\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const Tensor = TensorImpl as TensorConstructor;\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {env} from './env-impl.js';\n\n/**\n * @ignore\n */\nexport const TRACE = (deviceType: string, label: string) => {\n if (typeof env.trace === 'undefined' ? !env.wasm.trace : !env.trace) {\n return;\n }\n // eslint-disable-next-line no-console\n console.timeStamp(`${deviceType}::ORT::${label}`);\n};\n\nconst TRACE_FUNC = (msg: string, extraMsg?: string) => {\n const stack = new Error().stack?.split(/\\r\\n|\\r|\\n/g) || [];\n let hasTraceFunc = false;\n for (let i = 0; i < stack.length; i++) {\n if (hasTraceFunc && !stack[i].includes('TRACE_FUNC')) {\n let label = `FUNC_${msg}::${stack[i].trim().split(' ')[1]}`;\n if (extraMsg) {\n label += `::${extraMsg}`;\n }\n TRACE('CPU', label);\n return;\n }\n if (stack[i].includes('TRACE_FUNC')) {\n hasTraceFunc = true;\n }\n }\n};\n\n/**\n * @ignore\n */\nexport const TRACE_FUNC_BEGIN = (extraMsg?: string) => {\n if (typeof env.trace === 'undefined' ? !env.wasm.trace : !env.trace) {\n return;\n }\n TRACE_FUNC('BEGIN', extraMsg);\n};\n\n/**\n * @ignore\n */\nexport const TRACE_FUNC_END = (extraMsg?: string) => {\n if (typeof env.trace === 'undefined' ? !env.wasm.trace : !env.trace) {\n return;\n }\n TRACE_FUNC('END', extraMsg);\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {resolveBackendAndExecutionProviders} from './backend-impl.js';\nimport {InferenceSessionHandler} from './backend.js';\nimport {InferenceSession as InferenceSessionInterface} from './inference-session.js';\nimport {OnnxValue} from './onnx-value.js';\nimport {Tensor} from './tensor.js';\nimport {TRACE_FUNC_BEGIN, TRACE_FUNC_END} from './trace.js';\n\ntype SessionOptions = InferenceSessionInterface.SessionOptions;\ntype RunOptions = InferenceSessionInterface.RunOptions;\ntype FeedsType = InferenceSessionInterface.FeedsType;\ntype FetchesType = InferenceSessionInterface.FetchesType;\ntype ReturnType = InferenceSessionInterface.ReturnType;\n\nexport class InferenceSession implements InferenceSessionInterface {\n private constructor(handler: InferenceSessionHandler) {\n this.handler = handler;\n }\n run(feeds: FeedsType, options?: RunOptions): Promise;\n run(feeds: FeedsType, fetches: FetchesType, options?: RunOptions): Promise;\n async run(feeds: FeedsType, arg1?: FetchesType|RunOptions, arg2?: RunOptions): Promise {\n TRACE_FUNC_BEGIN();\n const fetches: {[name: string]: OnnxValue|null} = {};\n let options: RunOptions = {};\n // check inputs\n if (typeof feeds !== 'object' || feeds === null || feeds instanceof Tensor || Array.isArray(feeds)) {\n throw new TypeError(\n '\\'feeds\\' must be an object that use input names as keys and OnnxValue as corresponding values.');\n }\n\n let isFetchesEmpty = true;\n // determine which override is being used\n if (typeof arg1 === 'object') {\n if (arg1 === null) {\n throw new TypeError('Unexpected argument[1]: cannot be null.');\n }\n if (arg1 instanceof Tensor) {\n throw new TypeError('\\'fetches\\' cannot be a Tensor');\n }\n\n if (Array.isArray(arg1)) {\n if (arg1.length === 0) {\n throw new TypeError('\\'fetches\\' cannot be an empty array.');\n }\n isFetchesEmpty = false;\n // output names\n for (const name of arg1) {\n if (typeof name !== 'string') {\n throw new TypeError('\\'fetches\\' must be a string array or an object.');\n }\n if (this.outputNames.indexOf(name) === -1) {\n throw new RangeError(`'fetches' contains invalid output name: ${name}.`);\n }\n fetches[name] = null;\n }\n\n if (typeof arg2 === 'object' && arg2 !== null) {\n options = arg2;\n } else if (typeof arg2 !== 'undefined') {\n throw new TypeError('\\'options\\' must be an object.');\n }\n } else {\n // decide whether arg1 is fetches or options\n // if any output name is present and its value is valid OnnxValue, we consider it fetches\n let isFetches = false;\n const arg1Keys = Object.getOwnPropertyNames(arg1);\n for (const name of this.outputNames) {\n if (arg1Keys.indexOf(name) !== -1) {\n const v = (arg1 as InferenceSessionInterface.NullableOnnxValueMapType)[name];\n if (v === null || v instanceof Tensor) {\n isFetches = true;\n isFetchesEmpty = false;\n fetches[name] = v;\n }\n }\n }\n\n if (isFetches) {\n if (typeof arg2 === 'object' && arg2 !== null) {\n options = arg2;\n } else if (typeof arg2 !== 'undefined') {\n throw new TypeError('\\'options\\' must be an object.');\n }\n } else {\n options = arg1 as RunOptions;\n }\n }\n } else if (typeof arg1 !== 'undefined') {\n throw new TypeError('Unexpected argument[1]: must be \\'fetches\\' or \\'options\\'.');\n }\n\n // check if all inputs are in feed\n for (const name of this.inputNames) {\n if (typeof feeds[name] === 'undefined') {\n throw new Error(`input '${name}' is missing in 'feeds'.`);\n }\n }\n\n // if no fetches is specified, we use the full output names list\n if (isFetchesEmpty) {\n for (const name of this.outputNames) {\n fetches[name] = null;\n }\n }\n\n // feeds, fetches and options are prepared\n\n const results = await this.handler.run(feeds, fetches, options);\n const returnValue: {[name: string]: OnnxValue} = {};\n for (const key in results) {\n if (Object.hasOwnProperty.call(results, key)) {\n const result = results[key];\n if (result instanceof Tensor) {\n returnValue[key] = result;\n } else {\n returnValue[key] = new Tensor(result.type, result.data, result.dims);\n }\n }\n }\n TRACE_FUNC_END();\n return returnValue;\n }\n\n async release(): Promise {\n return this.handler.dispose();\n }\n\n static create(path: string, options?: SessionOptions): Promise;\n static create(buffer: ArrayBufferLike, options?: SessionOptions): Promise;\n static create(buffer: ArrayBufferLike, byteOffset: number, byteLength?: number, options?: SessionOptions):\n Promise;\n static create(buffer: Uint8Array, options?: SessionOptions): Promise;\n static async create(\n arg0: string|ArrayBufferLike|Uint8Array, arg1?: SessionOptions|number, arg2?: number,\n arg3?: SessionOptions): Promise {\n TRACE_FUNC_BEGIN();\n // either load from a file or buffer\n let filePathOrUint8Array: string|Uint8Array;\n let options: SessionOptions = {};\n\n if (typeof arg0 === 'string') {\n filePathOrUint8Array = arg0;\n if (typeof arg1 === 'object' && arg1 !== null) {\n options = arg1;\n } else if (typeof arg1 !== 'undefined') {\n throw new TypeError('\\'options\\' must be an object.');\n }\n } else if (arg0 instanceof Uint8Array) {\n filePathOrUint8Array = arg0;\n if (typeof arg1 === 'object' && arg1 !== null) {\n options = arg1;\n } else if (typeof arg1 !== 'undefined') {\n throw new TypeError('\\'options\\' must be an object.');\n }\n } else if (\n arg0 instanceof ArrayBuffer ||\n (typeof SharedArrayBuffer !== 'undefined' && arg0 instanceof SharedArrayBuffer)) {\n const buffer = arg0;\n let byteOffset = 0;\n let byteLength = arg0.byteLength;\n if (typeof arg1 === 'object' && arg1 !== null) {\n options = arg1;\n } else if (typeof arg1 === 'number') {\n byteOffset = arg1;\n if (!Number.isSafeInteger(byteOffset)) {\n throw new RangeError('\\'byteOffset\\' must be an integer.');\n }\n if (byteOffset < 0 || byteOffset >= buffer.byteLength) {\n throw new RangeError(`'byteOffset' is out of range [0, ${buffer.byteLength}).`);\n }\n byteLength = arg0.byteLength - byteOffset;\n if (typeof arg2 === 'number') {\n byteLength = arg2;\n if (!Number.isSafeInteger(byteLength)) {\n throw new RangeError('\\'byteLength\\' must be an integer.');\n }\n if (byteLength <= 0 || byteOffset + byteLength > buffer.byteLength) {\n throw new RangeError(`'byteLength' is out of range (0, ${buffer.byteLength - byteOffset}].`);\n }\n if (typeof arg3 === 'object' && arg3 !== null) {\n options = arg3;\n } else if (typeof arg3 !== 'undefined') {\n throw new TypeError('\\'options\\' must be an object.');\n }\n } else if (typeof arg2 !== 'undefined') {\n throw new TypeError('\\'byteLength\\' must be a number.');\n }\n } else if (typeof arg1 !== 'undefined') {\n throw new TypeError('\\'options\\' must be an object.');\n }\n filePathOrUint8Array = new Uint8Array(buffer, byteOffset, byteLength);\n } else {\n throw new TypeError('Unexpected argument[0]: must be \\'path\\' or \\'buffer\\'.');\n }\n\n // resolve backend, update session options with validated EPs, and create session handler\n const [backend, optionsWithValidatedEPs] = await resolveBackendAndExecutionProviders(options);\n const handler = await backend.createInferenceSessionHandler(filePathOrUint8Array, optionsWithValidatedEPs);\n TRACE_FUNC_END();\n return new InferenceSession(handler);\n }\n\n startProfiling(): void {\n this.handler.startProfiling();\n }\n endProfiling(): void {\n this.handler.endProfiling();\n }\n\n get inputNames(): readonly string[] {\n return this.handler.inputNames;\n }\n get outputNames(): readonly string[] {\n return this.handler.outputNames;\n }\n\n private handler: InferenceSessionHandler;\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {InferenceSession as InferenceSessionImpl} from './inference-session-impl.js';\nimport {OnnxModelOptions} from './onnx-model.js';\nimport {OnnxValue, OnnxValueDataLocation} from './onnx-value.js';\n\n/* eslint-disable @typescript-eslint/no-redeclare */\n\nexport declare namespace InferenceSession {\n // #region input/output types\n\n type OnnxValueMapType = {readonly [name: string]: OnnxValue};\n type NullableOnnxValueMapType = {readonly [name: string]: OnnxValue | null};\n\n /**\n * A feeds (model inputs) is an object that uses input names as keys and OnnxValue as corresponding values.\n */\n type FeedsType = OnnxValueMapType;\n\n /**\n * A fetches (model outputs) could be one of the following:\n *\n * - Omitted. Use model's output names definition.\n * - An array of string indicating the output names.\n * - An object that use output names as keys and OnnxValue or null as corresponding values.\n *\n * @remark\n * different from input argument, in output, OnnxValue is optional. If an OnnxValue is present it will be\n * used as a pre-allocated value by the inference engine; if omitted, inference engine will allocate buffer\n * internally.\n */\n type FetchesType = readonly string[]|NullableOnnxValueMapType;\n\n /**\n * A inferencing return type is an object that uses output names as keys and OnnxValue as corresponding values.\n */\n type ReturnType = OnnxValueMapType;\n\n // #endregion\n\n // #region session options\n\n /**\n * A set of configurations for session behavior.\n */\n export interface SessionOptions extends OnnxModelOptions {\n /**\n * An array of execution provider options.\n *\n * An execution provider option can be a string indicating the name of the execution provider,\n * or an object of corresponding type.\n */\n executionProviders?: readonly ExecutionProviderConfig[];\n\n /**\n * The intra OP threads number.\n *\n * This setting is available only in ONNXRuntime (Node.js binding and react-native).\n */\n intraOpNumThreads?: number;\n\n /**\n * The inter OP threads number.\n *\n * This setting is available only in ONNXRuntime (Node.js binding and react-native).\n */\n interOpNumThreads?: number;\n\n /**\n * The free dimension override.\n *\n * This setting is available only in ONNXRuntime (Node.js binding and react-native) or WebAssembly backend\n */\n freeDimensionOverrides?: {readonly [dimensionName: string]: number};\n\n /**\n * The optimization level.\n *\n * This setting is available only in ONNXRuntime (Node.js binding and react-native) or WebAssembly backend\n */\n graphOptimizationLevel?: 'disabled'|'basic'|'extended'|'all';\n\n /**\n * Whether enable CPU memory arena.\n *\n * This setting is available only in ONNXRuntime (Node.js binding and react-native) or WebAssembly backend\n */\n enableCpuMemArena?: boolean;\n\n /**\n * Whether enable memory pattern.\n *\n * This setting is available only in ONNXRuntime (Node.js binding and react-native) or WebAssembly backend\n */\n enableMemPattern?: boolean;\n\n /**\n * Execution mode.\n *\n * This setting is available only in ONNXRuntime (Node.js binding and react-native) or WebAssembly backend\n */\n executionMode?: 'sequential'|'parallel';\n\n /**\n * Optimized model file path.\n *\n * If this setting is specified, the optimized model will be dumped. In browser, a blob will be created\n * with a pop-up window.\n */\n optimizedModelFilePath?: string;\n\n /**\n * Whether enable profiling.\n *\n * This setting is a placeholder for a future use.\n */\n enableProfiling?: boolean;\n\n /**\n * File prefix for profiling.\n *\n * This setting is a placeholder for a future use.\n */\n profileFilePrefix?: string;\n\n /**\n * Log ID.\n *\n * This setting is available only in ONNXRuntime (Node.js binding and react-native) or WebAssembly backend\n */\n logId?: string;\n\n /**\n * Log severity level. See\n * https://github.com/microsoft/onnxruntime/blob/main/include/onnxruntime/core/common/logging/severity.h\n *\n * This setting is available only in ONNXRuntime (Node.js binding and react-native) or WebAssembly backend\n */\n logSeverityLevel?: 0|1|2|3|4;\n\n /**\n * Log verbosity level.\n *\n * This setting is available only in WebAssembly backend. Will support Node.js binding and react-native later\n */\n logVerbosityLevel?: number;\n\n /**\n * Specify string as a preferred data location for all outputs, or an object that use output names as keys and a\n * preferred data location as corresponding values.\n *\n * This setting is available only in ONNXRuntime Web for WebGL and WebGPU EP.\n */\n preferredOutputLocation?: OnnxValueDataLocation|{readonly [outputName: string]: OnnxValueDataLocation};\n\n /**\n * Whether enable graph capture.\n * This setting is available only in ONNXRuntime Web for WebGPU EP.\n */\n enableGraphCapture?: boolean;\n\n /**\n * Store configurations for a session. See\n * https://github.com/microsoft/onnxruntime/blob/main/include/onnxruntime/core/session/\n * onnxruntime_session_options_config_keys.h\n *\n * This setting is available only in WebAssembly backend. Will support Node.js binding and react-native later\n *\n * @example\n * ```js\n * extra: {\n * session: {\n * set_denormal_as_zero: \"1\",\n * disable_prepacking: \"1\"\n * },\n * optimization: {\n * enable_gelu_approximation: \"1\"\n * }\n * }\n * ```\n */\n extra?: Record;\n }\n\n // #region execution providers\n\n // Currently, we have the following backends to support execution providers:\n // Backend Node.js binding: supports 'cpu', 'dml' (win32), 'coreml' (macOS) and 'cuda' (linux).\n // Backend WebAssembly: supports 'cpu', 'wasm', 'webgpu' and 'webnn'.\n // Backend ONNX.js: supports 'webgl'.\n // Backend React Native: supports 'cpu', 'xnnpack', 'coreml' (iOS), 'nnapi' (Android).\n interface ExecutionProviderOptionMap {\n coreml: CoreMLExecutionProviderOption;\n cpu: CpuExecutionProviderOption;\n cuda: CudaExecutionProviderOption;\n dml: DmlExecutionProviderOption;\n nnapi: NnapiExecutionProviderOption;\n tensorrt: TensorRtExecutionProviderOption;\n wasm: WebAssemblyExecutionProviderOption;\n webgl: WebGLExecutionProviderOption;\n webgpu: WebGpuExecutionProviderOption;\n webnn: WebNNExecutionProviderOption;\n qnn: QnnExecutionProviderOption;\n xnnpack: XnnpackExecutionProviderOption;\n }\n\n type ExecutionProviderName = keyof ExecutionProviderOptionMap;\n type ExecutionProviderConfig =\n ExecutionProviderOptionMap[ExecutionProviderName]|ExecutionProviderOption|ExecutionProviderName|string;\n\n export interface ExecutionProviderOption {\n readonly name: string;\n }\n export interface CpuExecutionProviderOption extends ExecutionProviderOption {\n readonly name: 'cpu';\n useArena?: boolean;\n }\n export interface CudaExecutionProviderOption extends ExecutionProviderOption {\n readonly name: 'cuda';\n deviceId?: number;\n }\n export interface DmlExecutionProviderOption extends ExecutionProviderOption {\n readonly name: 'dml';\n deviceId?: number;\n }\n export interface TensorRtExecutionProviderOption extends ExecutionProviderOption {\n readonly name: 'tensorrt';\n deviceId?: number;\n }\n export interface WebAssemblyExecutionProviderOption extends ExecutionProviderOption {\n readonly name: 'wasm';\n }\n export interface WebGLExecutionProviderOption extends ExecutionProviderOption {\n readonly name: 'webgl';\n // TODO: add flags\n }\n export interface XnnpackExecutionProviderOption extends ExecutionProviderOption {\n readonly name: 'xnnpack';\n }\n export interface WebGpuExecutionProviderOption extends ExecutionProviderOption {\n readonly name: 'webgpu';\n preferredLayout?: 'NCHW'|'NHWC';\n }\n\n // #region WebNN options\n\n interface WebNNExecutionProviderName extends ExecutionProviderOption {\n readonly name: 'webnn';\n }\n\n /**\n * Represents a set of options for creating a WebNN MLContext.\n *\n * @see https://www.w3.org/TR/webnn/#dictdef-mlcontextoptions\n */\n export interface WebNNContextOptions {\n deviceType?: 'cpu'|'gpu'|'npu';\n numThreads?: number;\n powerPreference?: 'default'|'low-power'|'high-performance';\n }\n\n /**\n * Represents a set of options for WebNN execution provider without MLContext.\n */\n export interface WebNNOptionsWithoutMLContext extends WebNNExecutionProviderName, WebNNContextOptions {\n context?: never;\n }\n\n /**\n * Represents a set of options for WebNN execution provider with MLContext.\n *\n * When MLContext is provided, the deviceType is also required so that the WebNN EP can determine the preferred\n * channel layout.\n *\n * @see https://www.w3.org/TR/webnn/#dom-ml-createcontext\n */\n export interface WebNNOptionsWithMLContext extends WebNNExecutionProviderName,\n Omit,\n Required> {\n context: unknown /* MLContext */;\n }\n\n /**\n * Represents a set of options for WebNN execution provider with MLContext which is created from GPUDevice.\n *\n * @see https://www.w3.org/TR/webnn/#dom-ml-createcontext-gpudevice\n */\n export interface WebNNOptionsWebGpu extends WebNNExecutionProviderName {\n context: unknown /* MLContext */;\n gpuDevice: unknown /* GPUDevice */;\n }\n\n /**\n * Options for WebNN execution provider.\n */\n export type WebNNExecutionProviderOption = WebNNOptionsWithoutMLContext|WebNNOptionsWithMLContext|WebNNOptionsWebGpu;\n\n // #endregion\n\n export interface QnnExecutionProviderOption extends ExecutionProviderOption {\n readonly name: 'qnn';\n // TODO add flags\n }\n export interface CoreMLExecutionProviderOption extends ExecutionProviderOption {\n readonly name: 'coreml';\n /**\n * The bit flags for CoreML execution provider.\n *\n * ```\n * COREML_FLAG_USE_CPU_ONLY = 0x001\n * COREML_FLAG_ENABLE_ON_SUBGRAPH = 0x002\n * COREML_FLAG_ONLY_ENABLE_DEVICE_WITH_ANE = 0x004\n * COREML_FLAG_ONLY_ALLOW_STATIC_INPUT_SHAPES = 0x008\n * COREML_FLAG_CREATE_MLPROGRAM = 0x010\n * ```\n *\n * See include/onnxruntime/core/providers/coreml/coreml_provider_factory.h for more details.\n *\n * This flag is available only in ONNXRuntime (Node.js binding).\n */\n coreMlFlags?: number;\n /**\n * Specify whether to use CPU only in CoreML EP.\n *\n * This setting is available only in ONNXRuntime (react-native).\n */\n useCPUOnly?: boolean;\n /**\n * Specify whether to enable CoreML EP on subgraph.\n *\n * This setting is available only in ONNXRuntime (react-native).\n */\n enableOnSubgraph?: boolean;\n /**\n * Specify whether to only enable CoreML EP for Apple devices with ANE (Apple Neural Engine).\n *\n * This setting is available only in ONNXRuntime (react-native).\n */\n onlyEnableDeviceWithANE?: boolean;\n }\n export interface NnapiExecutionProviderOption extends ExecutionProviderOption {\n readonly name: 'nnapi';\n useFP16?: boolean;\n useNCHW?: boolean;\n cpuDisabled?: boolean;\n cpuOnly?: boolean;\n }\n // #endregion\n\n // #endregion\n\n // #region run options\n\n /**\n * A set of configurations for inference run behavior\n */\n export interface RunOptions {\n /**\n * Log severity level. See\n * https://github.com/microsoft/onnxruntime/blob/main/include/onnxruntime/core/common/logging/severity.h\n *\n * This setting is available only in ONNXRuntime (Node.js binding and react-native) or WebAssembly backend\n */\n logSeverityLevel?: 0|1|2|3|4;\n\n /**\n * Log verbosity level.\n *\n * This setting is available only in WebAssembly backend. Will support Node.js binding and react-native later\n */\n logVerbosityLevel?: number;\n\n /**\n * Terminate all incomplete OrtRun calls as soon as possible if true\n *\n * This setting is available only in WebAssembly backend. Will support Node.js binding and react-native later\n */\n terminate?: boolean;\n\n /**\n * A tag for the Run() calls using this\n *\n * This setting is available only in ONNXRuntime (Node.js binding and react-native) or WebAssembly backend\n */\n tag?: string;\n\n /**\n * Set a single run configuration entry. See\n * https://github.com/microsoft/onnxruntime/blob/main/include/onnxruntime/core/session/\n * onnxruntime_run_options_config_keys.h\n *\n * This setting is available only in WebAssembly backend. Will support Node.js binding and react-native later\n *\n * @example\n *\n * ```js\n * extra: {\n * memory: {\n * enable_memory_arena_shrinkage: \"1\",\n * }\n * }\n * ```\n */\n extra?: Record;\n }\n\n // #endregion\n\n // #region value metadata\n\n // eslint-disable-next-line @typescript-eslint/no-empty-interface\n interface ValueMetadata {\n // TBD\n }\n\n // #endregion\n}\n\n/**\n * Represent a runtime instance of an ONNX model.\n */\nexport interface InferenceSession {\n // #region run()\n\n /**\n * Execute the model asynchronously with the given feeds and options.\n *\n * @param feeds - Representation of the model input. See type description of `InferenceSession.InputType` for detail.\n * @param options - Optional. A set of options that controls the behavior of model inference.\n * @returns A promise that resolves to a map, which uses output names as keys and OnnxValue as corresponding values.\n */\n run(feeds: InferenceSession.FeedsType, options?: InferenceSession.RunOptions): Promise;\n\n /**\n * Execute the model asynchronously with the given feeds, fetches and options.\n *\n * @param feeds - Representation of the model input. See type description of `InferenceSession.InputType` for detail.\n * @param fetches - Representation of the model output. See type description of `InferenceSession.OutputType` for\n * detail.\n * @param options - Optional. A set of options that controls the behavior of model inference.\n * @returns A promise that resolves to a map, which uses output names as keys and OnnxValue as corresponding values.\n */\n run(feeds: InferenceSession.FeedsType, fetches: InferenceSession.FetchesType,\n options?: InferenceSession.RunOptions): Promise;\n\n // #endregion\n\n // #region release()\n\n /**\n * Release the inference session and the underlying resources.\n */\n release(): Promise;\n\n // #endregion\n\n // #region profiling\n\n /**\n * Start profiling.\n */\n startProfiling(): void;\n\n /**\n * End profiling.\n */\n endProfiling(): void;\n\n // #endregion\n\n // #region metadata\n\n /**\n * Get input names of the loaded model.\n */\n readonly inputNames: readonly string[];\n\n /**\n * Get output names of the loaded model.\n */\n readonly outputNames: readonly string[];\n\n // /**\n // * Get input metadata of the loaded model.\n // */\n // readonly inputMetadata: ReadonlyArray>;\n\n // /**\n // * Get output metadata of the loaded model.\n // */\n // readonly outputMetadata: ReadonlyArray>;\n\n // #endregion\n}\n\nexport interface InferenceSessionFactory {\n // #region create()\n\n /**\n * Create a new inference session and load model asynchronously from an ONNX model file.\n *\n * @param uri - The URI or file path of the model to load.\n * @param options - specify configuration for creating a new inference session.\n * @returns A promise that resolves to an InferenceSession object.\n */\n create(uri: string, options?: InferenceSession.SessionOptions): Promise;\n\n /**\n * Create a new inference session and load model asynchronously from an array bufer.\n *\n * @param buffer - An ArrayBuffer representation of an ONNX model.\n * @param options - specify configuration for creating a new inference session.\n * @returns A promise that resolves to an InferenceSession object.\n */\n create(buffer: ArrayBufferLike, options?: InferenceSession.SessionOptions): Promise;\n\n /**\n * Create a new inference session and load model asynchronously from segment of an array bufer.\n *\n * @param buffer - An ArrayBuffer representation of an ONNX model.\n * @param byteOffset - The beginning of the specified portion of the array buffer.\n * @param byteLength - The length in bytes of the array buffer.\n * @param options - specify configuration for creating a new inference session.\n * @returns A promise that resolves to an InferenceSession object.\n */\n create(buffer: ArrayBufferLike, byteOffset: number, byteLength?: number, options?: InferenceSession.SessionOptions):\n Promise;\n\n /**\n * Create a new inference session and load model asynchronously from a Uint8Array.\n *\n * @param buffer - A Uint8Array representation of an ONNX model.\n * @param options - specify configuration for creating a new inference session.\n * @returns A promise that resolves to an InferenceSession object.\n */\n create(buffer: Uint8Array, options?: InferenceSession.SessionOptions): Promise;\n\n // #endregion\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const InferenceSession: InferenceSessionFactory = InferenceSessionImpl;\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {OptionsFormat, OptionsNormalizationParameters, OptionsTensorLayout} from './tensor-factory.js';\n\nexport interface TensorToDataUrlOptions extends OptionsTensorLayout, OptionsFormat, OptionsNormalizationParameters {}\n\nexport interface TensorToImageDataOptions extends OptionsTensorLayout, OptionsFormat, OptionsNormalizationParameters {}\n\nexport interface ConversionUtils {\n /**\n * creates a DataURL instance from tensor\n *\n * @param options - An optional object representing options for creating a DataURL instance from the tensor.\n *\n * The following default settings will be applied:\n * - `format`: `'RGB'`\n * - `tensorLayout`: `'NCHW'`\n * @returns a DataURL string representing the image converted from tensor data\n */\n toDataURL(options?: TensorToDataUrlOptions): string;\n\n /**\n * creates an ImageData instance from tensor\n *\n * @param options - An optional object representing options for creating an ImageData instance from the tensor.\n *\n * The following default settings will be applied:\n * - `format`: `'RGB'`\n * - `tensorLayout`: `'NCHW'`\n * @returns an ImageData instance representing the image converted from tensor data\n */\n toImageData(options?: TensorToImageDataOptions): ImageData;\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Tensor, TypedTensor} from './tensor.js';\n\nexport type ImageFormat = 'RGB'|'RGBA'|'BGR'|'RBG';\nexport type ImageTensorLayout = 'NHWC'|'NCHW';\n\n// the following region contains type definitions for constructing tensor from a specific location.\n\n// #region types for constructing a tensor from a specific location\n\n/**\n * represent common properties of the parameter for constructing a tensor from a specific location.\n */\ninterface CommonConstructorParameters extends Pick {\n /**\n * Specify the data type of the tensor.\n */\n readonly type: T;\n}\n\n/**\n * represent the parameter for constructing a tensor from a GPU resource.\n */\ninterface GpuResourceConstructorParameters {\n /**\n * an optional callback function to download data from GPU to CPU.\n *\n * If not provided, the tensor treat the GPU data as external resource.\n */\n download?(): Promise;\n\n /**\n * an optional callback function that will be called when the tensor is disposed.\n *\n * If not provided, the tensor treat the GPU data as external resource.\n */\n dispose?(): void;\n}\n\n/**\n * represent the parameter for constructing a tensor from a pinned CPU buffer\n */\nexport interface CpuPinnedConstructorParameters extends\n CommonConstructorParameters {\n /**\n * Specify the location of the data to be 'cpu-pinned'.\n */\n readonly location: 'cpu-pinned';\n /**\n * Specify the CPU pinned buffer that holds the tensor data.\n */\n readonly data: Tensor.DataTypeMap[T];\n}\n\n/**\n * represent the parameter for constructing a tensor from a WebGL texture\n */\nexport interface TextureConstructorParameters extends\n CommonConstructorParameters, GpuResourceConstructorParameters {\n /**\n * Specify the location of the data to be 'texture'.\n */\n readonly location: 'texture';\n /**\n * Specify the WebGL texture that holds the tensor data.\n */\n readonly texture: Tensor.TextureType;\n}\n\n/**\n * represent the parameter for constructing a tensor from a WebGPU buffer\n */\nexport interface GpuBufferConstructorParameters extends\n CommonConstructorParameters, GpuResourceConstructorParameters {\n /**\n * Specify the location of the data to be 'gpu-buffer'.\n */\n readonly location: 'gpu-buffer';\n /**\n * Specify the WebGPU buffer that holds the tensor data.\n */\n readonly gpuBuffer: Tensor.GpuBufferType;\n}\n\n// #endregion\n\n// the following region contains type definitions of each individual options.\n// the tensor factory functions use a composition of those options as the parameter type.\n\n// #region Options fields\n\nexport interface OptionsFormat {\n /**\n * Describes the image format represented in RGBA color space.\n */\n format?: ImageFormat;\n}\n\nexport interface OptionsTensorFormat {\n /**\n * Describes the image format of the tensor.\n *\n * NOTE: this is different from option 'format'. While option 'format' represents the original image, 'tensorFormat'\n * represents the target format of the tensor. A transpose will be performed if they are different.\n */\n tensorFormat?: ImageFormat;\n}\n\nexport interface OptionsTensorDataType {\n /**\n * Describes the data type of the tensor.\n */\n dataType?: 'float32'|'uint8';\n}\n\nexport interface OptionsTensorLayout {\n /**\n * Describes the tensor layout when representing data of one or more image(s).\n */\n tensorLayout?: ImageTensorLayout;\n}\n\nexport interface OptionsDimensions {\n /**\n * Describes the image height in pixel\n */\n height?: number;\n /**\n * Describes the image width in pixel\n */\n width?: number;\n}\n\nexport interface OptionResizedDimensions {\n /**\n * Describes the resized height. If omitted, original height will be used.\n */\n resizedHeight?: number;\n /**\n * Describes resized width - can be accessed via tensor dimensions as well\n */\n resizedWidth?: number;\n}\n\nexport interface OptionsNormalizationParameters {\n /**\n * Describes normalization parameters when preprocessing the image as model input.\n *\n * Data element are ranged from 0 to 255.\n */\n norm?: {\n /**\n * The 'bias' value for image normalization.\n * - If omitted, use default value 0.\n * - If it's a single number, apply to each channel\n * - If it's an array of 3 or 4 numbers, apply element-wise. Number of elements need to match the number of channels\n * for the corresponding image format\n */\n bias?: number|[number, number, number]|[number, number, number, number];\n /**\n * The 'mean' value for image normalization.\n * - If omitted, use default value 255.\n * - If it's a single number, apply to each channel\n * - If it's an array of 3 or 4 numbers, apply element-wise. Number of elements need to match the number of channels\n * for the corresponding image format\n */\n mean?: number | [number, number, number] | [number, number, number, number];\n };\n}\n\n// #endregion\n\n// #region Options composition\n\nexport interface TensorFromImageDataOptions extends OptionResizedDimensions, OptionsTensorFormat, OptionsTensorLayout,\n OptionsTensorDataType, OptionsNormalizationParameters {}\n\nexport interface TensorFromImageElementOptions extends OptionResizedDimensions, OptionsTensorFormat,\n OptionsTensorLayout, OptionsTensorDataType,\n OptionsNormalizationParameters {}\n\nexport interface TensorFromUrlOptions extends OptionsDimensions, OptionResizedDimensions, OptionsTensorFormat,\n OptionsTensorLayout, OptionsTensorDataType,\n OptionsNormalizationParameters {}\n\nexport interface TensorFromImageBitmapOptions extends OptionResizedDimensions, OptionsTensorFormat, OptionsTensorLayout,\n OptionsTensorDataType, OptionsNormalizationParameters {}\n\nexport interface TensorFromTextureOptions extends\n Required, OptionsFormat, GpuResourceConstructorParameters/* TODO: add more */ {}\n\nexport interface TensorFromGpuBufferOptions extends\n Pick, GpuResourceConstructorParameters {\n /**\n * Describes the data type of the tensor.\n */\n dataType?: T;\n}\n\n// #endregion\n\n/**\n * type TensorFactory defines the factory functions of 'Tensor' to create tensor instances from existing data or\n * resources.\n */\nexport interface TensorFactory {\n /**\n * create a tensor from an ImageData object\n *\n * @param imageData - the ImageData object to create tensor from\n * @param options - An optional object representing options for creating tensor from ImageData.\n *\n * The following default settings will be applied:\n * - `tensorFormat`: `'RGB'`\n * - `tensorLayout`: `'NCHW'`\n * - `dataType`: `'float32'`\n * @returns A promise that resolves to a tensor object\n */\n fromImage(imageData: ImageData, options?: TensorFromImageDataOptions):\n Promise|TypedTensor<'uint8'>>;\n\n /**\n * create a tensor from a HTMLImageElement object\n *\n * @param imageElement - the HTMLImageElement object to create tensor from\n * @param options - An optional object representing options for creating tensor from HTMLImageElement.\n *\n * The following default settings will be applied:\n * - `tensorFormat`: `'RGB'`\n * - `tensorLayout`: `'NCHW'`\n * - `dataType`: `'float32'`\n * @returns A promise that resolves to a tensor object\n */\n fromImage(imageElement: HTMLImageElement, options?: TensorFromImageElementOptions):\n Promise|TypedTensor<'uint8'>>;\n\n /**\n * create a tensor from URL\n *\n * @param urlSource - a string as a URL to the image or a data URL containing the image data.\n * @param options - An optional object representing options for creating tensor from URL.\n *\n * The following default settings will be applied:\n * - `tensorFormat`: `'RGB'`\n * - `tensorLayout`: `'NCHW'`\n * - `dataType`: `'float32'`\n * @returns A promise that resolves to a tensor object\n */\n fromImage(urlSource: string, options?: TensorFromUrlOptions): Promise|TypedTensor<'uint8'>>;\n\n /**\n * create a tensor from an ImageBitmap object\n *\n * @param bitmap - the ImageBitmap object to create tensor from\n * @param options - An optional object representing options for creating tensor from URL.\n *\n * The following default settings will be applied:\n * - `tensorFormat`: `'RGB'`\n * - `tensorLayout`: `'NCHW'`\n * - `dataType`: `'float32'`\n * @returns A promise that resolves to a tensor object\n */\n fromImage(bitmap: ImageBitmap, options: TensorFromImageBitmapOptions):\n Promise|TypedTensor<'uint8'>>;\n\n /**\n * create a tensor from a WebGL texture\n *\n * @param texture - the WebGLTexture object to create tensor from\n * @param options - An optional object representing options for creating tensor from WebGL texture.\n *\n * The options include following properties:\n * - `width`: the width of the texture. Required.\n * - `height`: the height of the texture. Required.\n * - `format`: the format of the texture. If omitted, assume 'RGBA'.\n * - `download`: an optional function to download the tensor data from GPU to CPU. If omitted, the GPU data\n * will not be able to download. Usually, this is provided by a GPU backend for the inference outputs. Users don't\n * need to provide this function.\n * - `dispose`: an optional function to dispose the tensor data on GPU. If omitted, the GPU data will not be disposed.\n * Usually, this is provided by a GPU backend for the inference outputs. Users don't need to provide this function.\n *\n * @returns a tensor object\n */\n fromTexture(\n texture: Tensor.TextureType, options: TensorFromTextureOptions): TypedTensor<'float32'>;\n\n /**\n * create a tensor from a WebGPU buffer\n *\n * @param buffer - the GPUBuffer object to create tensor from\n * @param options - An optional object representing options for creating tensor from WebGPU buffer.\n *\n * The options include following properties:\n * - `dataType`: the data type of the tensor. If omitted, assume 'float32'.\n * - `dims`: the dimension of the tensor. Required.\n * - `download`: an optional function to download the tensor data from GPU to CPU. If omitted, the GPU data\n * will not be able to download. Usually, this is provided by a GPU backend for the inference outputs. Users don't\n * need to provide this function.\n * - `dispose`: an optional function to dispose the tensor data on GPU. If omitted, the GPU data will not be disposed.\n * Usually, this is provided by a GPU backend for the inference outputs. Users don't need to provide this function.\n *\n * @returns a tensor object\n */\n fromGpuBuffer(\n buffer: Tensor.GpuBufferType, options: TensorFromGpuBufferOptions): TypedTensor;\n\n /**\n * create a tensor from a pre-allocated buffer. The buffer will be used as a pinned buffer.\n *\n * @param type - the tensor element type.\n * @param buffer - a TypedArray corresponding to the type.\n * @param dims - specify the dimension of the tensor. If omitted, a 1-D tensor is assumed.\n *\n * @returns a tensor object\n */\n fromPinnedBuffer>(\n type: T, buffer: Tensor.DataTypeMap[T], dims?: readonly number[]): TypedTensor;\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\n/**\n * A string that represents a file's URL or path.\n *\n * Path is vailable only in onnxruntime-node or onnxruntime-web running in Node.js.\n */\nexport type FileUrlOrPath = string;\n\n/**\n * A Blob object that represents a file.\n */\nexport type FileBlob = Blob;\n\n/**\n * A Uint8Array, ArrayBuffer or SharedArrayBuffer object that represents a file content.\n *\n * When it is an ArrayBuffer or SharedArrayBuffer, the whole buffer is assumed to be the file content.\n */\nexport type FileData = Uint8Array|ArrayBufferLike;\n\n/**\n * Represents a file that can be loaded by the ONNX Runtime JavaScript API.\n */\nexport type FileType = FileUrlOrPath|FileBlob|FileData;\n\n/**\n * Represents an external data file.\n */\nexport interface ExternalDataFileDescription {\n /**\n * Specify the external data file.\n */\n data: FileType;\n /**\n * Specify the file path.\n */\n path: string;\n}\n\n/**\n * Represents an external data file.\n *\n * When using a string, it should be a file URL or path that in the same directory as the model file.\n */\nexport type ExternalDataFileType = ExternalDataFileDescription|FileUrlOrPath;\n\n/**\n * Options for model loading.\n */\nexport interface OnnxModelOptions {\n /**\n * Specifying a list of files that represents the external data.\n */\n externalData?: readonly ExternalDataFileType[];\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Tensor} from './tensor.js';\n\nexport type NonTensorType = never;\n\n/**\n * Type OnnxValue Represents both tensors and non-tensors value for model's inputs/outputs.\n *\n * NOTE: currently not support non-tensor\n */\nexport type OnnxValue = Tensor|NonTensorType;\n\n/**\n * Type OnnxValueDataLocation represents the location of the data of an OnnxValue.\n */\nexport type OnnxValueDataLocation = Tensor.DataLocation;\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {resolveBackendAndExecutionProviders} from './backend-impl.js';\nimport {SessionHandler, TrainingSessionHandler} from './backend.js';\nimport {InferenceSession as InferenceSession} from './inference-session.js';\nimport {OnnxValue} from './onnx-value.js';\nimport {Tensor} from './tensor.js';\nimport {TrainingSession as TrainingSessionInterface, TrainingSessionCreateOptions} from './training-session.js';\n\ntype SessionOptions = InferenceSession.SessionOptions;\ntype FeedsType = InferenceSession.FeedsType;\ntype FetchesType = InferenceSession.FetchesType;\ntype ReturnType = InferenceSession.ReturnType;\ntype RunOptions = InferenceSession.RunOptions;\n\nconst noBackendErrMsg: string = 'Training backend could not be resolved. ' +\n 'Make sure you\\'re using the correct configuration & WebAssembly files.';\n\nexport class TrainingSession implements TrainingSessionInterface {\n private constructor(handler: TrainingSessionHandler, hasOptimizerModel: boolean, hasEvalModel: boolean) {\n this.handler = handler;\n this.hasOptimizerModel = hasOptimizerModel;\n this.hasEvalModel = hasEvalModel;\n }\n private handler: TrainingSessionHandler;\n private hasOptimizerModel: boolean;\n private hasEvalModel: boolean;\n\n get trainingInputNames(): readonly string[] {\n return this.handler.inputNames;\n }\n get trainingOutputNames(): readonly string[] {\n return this.handler.outputNames;\n }\n\n get evalInputNames(): readonly string[] {\n if (this.hasEvalModel) {\n return this.handler.evalInputNames;\n } else {\n throw new Error('This training session has no evalModel loaded.');\n }\n }\n get evalOutputNames(): readonly string[] {\n if (this.hasEvalModel) {\n return this.handler.evalOutputNames;\n } else {\n throw new Error('This training session has no evalModel loaded.');\n }\n }\n\n static async create(trainingOptions: TrainingSessionCreateOptions, sessionOptions?: SessionOptions):\n Promise {\n const evalModel: string|Uint8Array = trainingOptions.evalModel || '';\n const optimizerModel: string|Uint8Array = trainingOptions.optimizerModel || '';\n const options: SessionOptions = sessionOptions || {};\n\n // resolve backend, update session options with validated EPs, and create session handler\n const [backend, optionsWithValidatedEPs] = await resolveBackendAndExecutionProviders(options);\n if (backend.createTrainingSessionHandler) {\n const handler = await backend.createTrainingSessionHandler(\n trainingOptions.checkpointState, trainingOptions.trainModel, evalModel, optimizerModel,\n optionsWithValidatedEPs);\n return new TrainingSession(handler, !!trainingOptions.optimizerModel, !!trainingOptions.evalModel);\n } else {\n throw new Error(noBackendErrMsg);\n }\n }\n\n /**\n * Helper function for runTrainStep and future runStep methods that handles the type-narrowing conversion from\n * the given parameters to SessionHandler.FetchesType and RunOptions.\n *\n * @param inputNames the feeds object is checked that they contain all input names in the provided list of input\n * names.\n * @param outputNames the fetches object is checked that their keys match up with valid names in the list of output\n * names.\n * @param feeds the required input\n * @param arg1 narrowed & converted into the SessionHandler.FetchesType or RunOptions object\n * @param arg2 optional RunOptions object.\n * @returns\n */\n typeNarrowingForRunStep(\n inputNames: readonly string[], outputNames: readonly string[], feeds: FeedsType, arg1?: FetchesType|RunOptions,\n arg2?: RunOptions): [SessionHandler.FetchesType, RunOptions] {\n const fetches: {[name: string]: OnnxValue|null} = {};\n let options: RunOptions = {};\n // check inputs\n if (typeof feeds !== 'object' || feeds === null || feeds instanceof Tensor || Array.isArray(feeds)) {\n throw new TypeError(\n '\\'feeds\\' must be an object that use input names as keys and OnnxValue as corresponding values.');\n }\n\n let isFetchesEmpty = true;\n // determine which override is being used\n if (typeof arg1 === 'object') {\n if (arg1 === null) {\n throw new TypeError('Unexpected argument[1]: cannot be null.');\n }\n if (arg1 instanceof Tensor) {\n throw new TypeError('\\'fetches\\' cannot be a Tensor');\n }\n\n if (Array.isArray(arg1)) {\n if (arg1.length === 0) {\n throw new TypeError('\\'fetches\\' cannot be an empty array.');\n }\n isFetchesEmpty = false;\n // output names\n for (const name of arg1) {\n if (typeof name !== 'string') {\n throw new TypeError('\\'fetches\\' must be a string array or an object.');\n }\n if (outputNames.indexOf(name) === -1) {\n throw new RangeError(`'fetches' contains invalid output name: ${name}.`);\n }\n fetches[name] = null;\n }\n\n if (typeof arg2 === 'object' && arg2 !== null) {\n options = arg2;\n } else if (typeof arg2 !== 'undefined') {\n throw new TypeError('\\'options\\' must be an object.');\n }\n } else {\n // decide whether arg1 is fetches or options\n // if any output name is present and its value is valid OnnxValue, we consider it fetches\n let isFetches = false;\n const arg1Keys = Object.getOwnPropertyNames(arg1);\n for (const name of outputNames) {\n if (arg1Keys.indexOf(name) !== -1) {\n const v = (arg1 as InferenceSession.NullableOnnxValueMapType)[name];\n if (v === null || v instanceof Tensor) {\n isFetches = true;\n isFetchesEmpty = false;\n fetches[name] = v;\n }\n }\n }\n\n if (isFetches) {\n if (typeof arg2 === 'object' && arg2 !== null) {\n options = arg2;\n } else if (typeof arg2 !== 'undefined') {\n throw new TypeError('\\'options\\' must be an object.');\n }\n } else {\n options = arg1 as RunOptions;\n }\n }\n } else if (typeof arg1 !== 'undefined') {\n throw new TypeError('Unexpected argument[1]: must be \\'fetches\\' or \\'options\\'.');\n }\n\n // check if all inputs are in feed\n for (const name of inputNames) {\n if (typeof feeds[name] === 'undefined') {\n throw new Error(`input '${name}' is missing in 'feeds'.`);\n }\n }\n\n // if no fetches is specified, we use the full output names list\n if (isFetchesEmpty) {\n for (const name of outputNames) {\n fetches[name] = null;\n }\n }\n\n return [fetches, options];\n }\n\n /**\n * Helper method for runTrainStep and any other runStep methods. Takes the ReturnType result from the SessionHandler\n * and changes it into a map of Tensors.\n *\n * @param results\n * @returns\n */\n convertHandlerReturnTypeToMapOfTensors(results: SessionHandler.ReturnType): ReturnType {\n const returnValue: {[name: string]: OnnxValue} = {};\n for (const key in results) {\n if (Object.hasOwnProperty.call(results, key)) {\n const result = results[key];\n if (result instanceof Tensor) {\n returnValue[key] = result;\n } else {\n returnValue[key] = new Tensor(result.type, result.data, result.dims);\n }\n }\n }\n return returnValue;\n }\n\n async lazyResetGrad(): Promise {\n await this.handler.lazyResetGrad();\n }\n\n runTrainStep(feeds: FeedsType, options?: RunOptions): Promise;\n runTrainStep(feeds: FeedsType, fetches: FetchesType, options?: RunOptions): Promise;\n async runTrainStep(feeds: FeedsType, arg1?: FetchesType|RunOptions, arg2?: RunOptions): Promise {\n const [fetches, options] =\n this.typeNarrowingForRunStep(this.trainingInputNames, this.trainingOutputNames, feeds, arg1, arg2);\n const results = await this.handler.runTrainStep(feeds, fetches, options);\n return this.convertHandlerReturnTypeToMapOfTensors(results);\n }\n\n async runOptimizerStep(options?: InferenceSession.RunOptions|undefined): Promise {\n if (this.hasOptimizerModel) {\n await this.handler.runOptimizerStep(options || {});\n } else {\n throw new Error('This TrainingSession has no OptimizerModel loaded.');\n }\n }\n\n runEvalStep(feeds: FeedsType, options?: RunOptions|undefined): Promise;\n runEvalStep(feeds: FeedsType, fetches: FetchesType, options?: RunOptions|undefined): Promise;\n async runEvalStep(feeds: FeedsType, arg1?: FetchesType|RunOptions, arg2?: RunOptions): Promise {\n if (this.hasEvalModel) {\n const [fetches, options] =\n this.typeNarrowingForRunStep(this.evalInputNames, this.evalOutputNames, feeds, arg1, arg2);\n const results = await this.handler.runEvalStep(feeds, fetches, options);\n return this.convertHandlerReturnTypeToMapOfTensors(results);\n } else {\n throw new Error('This TrainingSession has no EvalModel loaded.');\n }\n }\n\n async getParametersSize(trainableOnly = true): Promise {\n return this.handler.getParametersSize(trainableOnly);\n }\n\n async loadParametersBuffer(array: Uint8Array, trainableOnly = true): Promise {\n const paramsSize = await this.getParametersSize(trainableOnly);\n // checking that the size of the Uint8Array is equivalent to the byte length of a Float32Array of the number\n // of parameters\n if (array.length !== 4 * paramsSize) {\n throw new Error(\n 'Size of the buffer passed into loadParametersBuffer must match the number of parameters in ' +\n 'the model. Please use getParametersSize method to check.');\n }\n return this.handler.loadParametersBuffer(array, trainableOnly);\n }\n\n async getContiguousParameters(trainableOnly = true): Promise {\n return this.handler.getContiguousParameters(trainableOnly);\n }\n\n async release(): Promise {\n return this.handler.dispose();\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {InferenceSession} from './inference-session.js';\nimport {OnnxValue} from './onnx-value.js';\nimport {TrainingSession as TrainingSessionImpl} from './training-session-impl.js';\n\n/* eslint-disable @typescript-eslint/no-redeclare */\n\nexport declare namespace TrainingSession {\n /**\n * Either URI file path (string) or Uint8Array containing model or checkpoint information.\n */\n type UriOrBuffer = string|Uint8Array;\n}\n\n/**\n * Represent a runtime instance of an ONNX training session,\n * which contains a model that can be trained, and, optionally,\n * an eval and optimizer model.\n */\nexport interface TrainingSession {\n // #region run()\n\n /**\n * Lazily resets the gradients of all trainable parameters to zero. Should happen after the invocation of\n * runOptimizerStep.\n */\n lazyResetGrad(): Promise;\n\n /**\n * Run TrainStep asynchronously with the given feeds and options.\n *\n * @param feeds - Representation of the model input. See type description of `InferenceSession.InputType` for\n detail.\n * @param options - Optional. A set of options that controls the behavior of model training.\n * @returns A promise that resolves to a map, which uses output names as keys and OnnxValue as corresponding values.\n */\n runTrainStep(feeds: InferenceSession.FeedsType, options?: InferenceSession.RunOptions):\n Promise;\n\n /**\n * Run a single train step with the given inputs and options.\n *\n * @param feeds - Representation of the model input.\n * @param fetches - Representation of the model output.\n * detail.\n * @param options - Optional. A set of options that controls the behavior of model training.\n * @returns A promise that resolves to a map, which uses output names as keys and OnnxValue as corresponding\n values.\n */\n runTrainStep(\n feeds: InferenceSession.FeedsType, fetches: InferenceSession.FetchesType,\n options?: InferenceSession.RunOptions): Promise;\n\n /**\n * Runs a single optimizer step, which performs weight updates for the trainable parameters using the optimizer model.\n *\n * @param options - Optional. A set of options that controls the behavior of model optimizing.\n */\n runOptimizerStep(options?: InferenceSession.RunOptions): Promise;\n\n /**\n * Run a single eval step with the given inputs and options using the eval model.\n *\n * @param feeds - Representation of the model input.\n * @param options - Optional. A set of options that controls the behavior of model eval step.\n * @returns A promise that resolves to a map, which uses output names as keys and OnnxValue as corresponding\n values.\n */\n runEvalStep(feeds: InferenceSession.FeedsType, options?: InferenceSession.RunOptions):\n Promise;\n\n /**\n * Run a single eval step with the given inputs and options using the eval model.\n *\n * @param feeds - Representation of the model input.\n * @param fetches - Representation of the model output.\n * detail.\n * @param options - Optional. A set of options that controls the behavior of model eval step.\n * @returns A promise that resolves to a map, which uses output names as keys and OnnxValue as corresponding\n values.\n */\n runEvalStep(\n feeds: InferenceSession.FeedsType, fetches: InferenceSession.FetchesType,\n options?: InferenceSession.RunOptions): Promise;\n\n // #endregion\n\n // #region copy parameters\n\n /**\n * Retrieves the size of all parameters for the training state. Calculates the total number of primitive (datatype of\n * the parameters) elements of all the parameters in the training state.\n *\n * @param trainableOnly - When set to true, the size is calculated for trainable params only. Default value is true.\n */\n getParametersSize(trainableOnly: boolean): Promise;\n\n /**\n * Copies parameter values from the given buffer to the training state. Currently, only supporting models with\n * parameters of type Float32.\n *\n * @param buffer - A Uint8Array representation of Float32 parameters.\n * @param trainableOnly - True if trainable parameters only to be modified, false otherwise. Default value is true.\n */\n loadParametersBuffer(buffer: Uint8Array, trainableOnly: boolean): Promise;\n\n /**\n * Copies the model parameters to a contiguous buffer. Usually used in the context of Federated Learning.\n * Currently, only supporting models with parameters of type Float32.\n *\n * @param trainableOnly - When set to true, only trainable parameters are copied. Trainable parameters are parameters\n * for which requires_grad is set to true. Default value is true.\n * @returns A promise that resolves to a Float32 OnnxValue of the requested parameters.\n */\n getContiguousParameters(trainableOnly: boolean): Promise;\n // #endregion\n\n // #region release()\n\n /**\n * Release the inference session and the underlying resources.\n */\n release(): Promise;\n // #endregion\n\n // #region metadata\n\n /**\n * Get input names of the loaded training model.\n */\n readonly trainingInputNames: readonly string[];\n\n /**\n * Get output names of the loaded training model.\n */\n readonly trainingOutputNames: readonly string[];\n\n /**\n * Get input names of the loaded eval model. Is an empty array if no eval model is loaded.\n */\n readonly evalInputNames: readonly string[];\n\n /**\n * Get output names of the loaded eval model. Is an empty array if no eval model is loaded.\n */\n readonly evalOutputNames: readonly string[];\n\n // #endregion\n}\n\n/**\n * Represents the optional parameters that can be passed into the TrainingSessionFactory.\n */\nexport interface TrainingSessionCreateOptions {\n /**\n * URI or buffer for a .ckpt file that contains the checkpoint for the training model.\n */\n checkpointState: TrainingSession.UriOrBuffer;\n /**\n * URI or buffer for the .onnx training file.\n */\n trainModel: TrainingSession.UriOrBuffer;\n /**\n * Optional. URI or buffer for the .onnx optimizer model file.\n */\n optimizerModel?: TrainingSession.UriOrBuffer;\n /**\n * Optional. URI or buffer for the .onnx eval model file.\n */\n evalModel?: TrainingSession.UriOrBuffer;\n}\n\n/**\n * Defines method overload possibilities for creating a TrainingSession.\n */\nexport interface TrainingSessionFactory {\n // #region create()\n\n /**\n * Creates a new TrainingSession and asynchronously loads any models passed in through trainingOptions\n *\n * @param trainingOptions specify models and checkpoints to load into the Training Session\n * @param sessionOptions specify configuration for training session behavior\n *\n * @returns Promise that resolves to a TrainingSession object\n */\n create(trainingOptions: TrainingSessionCreateOptions, sessionOptions?: InferenceSession.SessionOptions):\n Promise;\n\n // #endregion\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const TrainingSession: TrainingSessionFactory = TrainingSessionImpl;\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\n/**\n * # ONNX Runtime JavaScript API\n *\n * ONNX Runtime JavaScript API is a unified API for all JavaScript usages, including the following NPM packages:\n *\n * - [onnxruntime-node](https://www.npmjs.com/package/onnxruntime-node)\n * - [onnxruntime-web](https://www.npmjs.com/package/onnxruntime-web)\n * - [onnxruntime-react-native](https://www.npmjs.com/package/onnxruntime-react-native)\n *\n * See also:\n * - [Get Started](https://onnxruntime.ai/docs/get-started/with-javascript/)\n * - [Inference examples](https://github.com/microsoft/onnxruntime-inference-examples/tree/main/js)\n *\n * @packageDocumentation\n */\n\nexport * from './backend.js';\nexport * from './env.js';\nexport * from './inference-session.js';\nexport * from './tensor.js';\nexport * from './tensor-conversion.js';\nexport * from './tensor-factory.js';\nexport * from './trace.js';\nexport * from './onnx-model.js';\nexport * from './onnx-value.js';\nexport * from './training-session.js';\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Env} from 'onnxruntime-common';\n\nimport {WebGLContext} from './backends/webgl/webgl-context';\n\nexport declare namespace Logger {\n export interface SeverityTypeMap {\n verbose: 'v';\n info: 'i';\n warning: 'w';\n error: 'e';\n fatal: 'f';\n }\n\n export type Severity = keyof SeverityTypeMap;\n\n export type Provider = 'none'|'console';\n\n /**\n * Logging config that used to control the behavior of logger\n */\n export interface Config {\n /**\n * Specify the logging provider. 'console' by default\n */\n provider?: Provider;\n /**\n * Specify the minimal logger serverity. 'warning' by default\n */\n minimalSeverity?: Logger.Severity;\n /**\n * Whether to output date time in log. true by default\n */\n logDateTime?: boolean;\n /**\n * Whether to output source information (Not yet supported). false by default\n */\n logSourceLocation?: boolean;\n }\n\n export interface CategorizedLogger {\n verbose(content: string): void;\n info(content: string): void;\n warning(content: string): void;\n error(content: string): void;\n fatal(content: string): void;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport interface Logger {\n (category: string): Logger.CategorizedLogger;\n\n verbose(content: string): void;\n verbose(category: string, content: string): void;\n info(content: string): void;\n info(category: string, content: string): void;\n warning(content: string): void;\n warning(category: string, content: string): void;\n error(content: string): void;\n error(category: string, content: string): void;\n fatal(content: string): void;\n fatal(category: string, content: string): void;\n\n /**\n * Reset the logger configuration.\n * @param config specify an optional default config\n */\n reset(config?: Logger.Config): void;\n /**\n * Set the logger's behavior on the given category\n * @param category specify a category string. If '*' is specified, all previous configuration will be overwritten. If\n * '' is specified, the default behavior will be updated.\n * @param config the config object to indicate the logger's behavior\n */\n set(category: string, config: Logger.Config): void;\n\n /**\n * Set the logger's behavior from ort-common env\n * @param env the env used to set logger. Currently only setting loglevel is supported through Env.\n */\n setWithEnv(env: Env): void;\n}\n\ninterface LoggerProvider {\n log(severity: Logger.Severity, content: string, category?: string): void;\n}\nclass NoOpLoggerProvider implements LoggerProvider {\n log(_severity: Logger.Severity, _content: string, _category?: string) {\n // do nothing\n }\n}\nclass ConsoleLoggerProvider implements LoggerProvider {\n log(severity: Logger.Severity, content: string, category?: string) {\n // eslint-disable-next-line no-console\n console.log(`${this.color(severity)} ${category ? '\\x1b[35m' + category + '\\x1b[0m ' : ''}${content}`);\n }\n\n private color(severity: Logger.Severity) {\n switch (severity) {\n case 'verbose':\n return '\\x1b[34;40mv\\x1b[0m';\n case 'info':\n return '\\x1b[32mi\\x1b[0m';\n case 'warning':\n return '\\x1b[30;43mw\\x1b[0m';\n case 'error':\n return '\\x1b[31;40me\\x1b[0m';\n case 'fatal':\n return '\\x1b[101mf\\x1b[0m';\n default:\n throw new Error(`unsupported severity: ${severity}`);\n }\n }\n}\n\nconst SEVERITY_VALUE = {\n verbose: 1000,\n info: 2000,\n warning: 4000,\n error: 5000,\n fatal: 6000\n};\n\nconst LOGGER_PROVIDER_MAP: {readonly [provider: string]: Readonly} = {\n ['none']: new NoOpLoggerProvider(),\n ['console']: new ConsoleLoggerProvider()\n};\nconst LOGGER_DEFAULT_CONFIG = {\n provider: 'console',\n minimalSeverity: 'warning',\n logDateTime: true,\n logSourceLocation: false\n};\nlet LOGGER_CONFIG_MAP:\n {[category: string]: Readonly>} = {['']: LOGGER_DEFAULT_CONFIG as Required};\n\nfunction log(category: string): Logger.CategorizedLogger;\nfunction log(severity: Logger.Severity, content: string): void;\nfunction log(severity: Logger.Severity, category: string, content: string): void;\nfunction log(severity: Logger.Severity, arg1: string, arg2?: string): void;\nfunction log(\n arg0: string|Logger.Severity, arg1?: string, arg2?: string|number, arg3?: number): Logger.CategorizedLogger|void {\n if (arg1 === undefined) {\n // log(category: string): Logger.CategorizedLogger;\n return createCategorizedLogger(arg0);\n } else if (arg2 === undefined) {\n // log(severity, content);\n logInternal(arg0 as Logger.Severity, arg1, 1);\n } else if (typeof arg2 === 'number' && arg3 === undefined) {\n // log(severity, content, stack)\n logInternal(arg0 as Logger.Severity, arg1, arg2);\n } else if (typeof arg2 === 'string' && arg3 === undefined) {\n // log(severity, category, content)\n logInternal(arg0 as Logger.Severity, arg2, 1, arg1);\n } else if (typeof arg2 === 'string' && typeof arg3 === 'number') {\n // log(severity, category, content, stack)\n logInternal(arg0 as Logger.Severity, arg2, arg3, arg1);\n } else {\n throw new TypeError('input is valid');\n }\n}\n\nfunction createCategorizedLogger(category: string): Logger.CategorizedLogger {\n return {\n verbose: log.verbose.bind(null, category),\n info: log.info.bind(null, category),\n warning: log.warning.bind(null, category),\n error: log.error.bind(null, category),\n fatal: log.fatal.bind(null, category)\n };\n}\n\n// NOTE: argument 'category' is put the last parameter beacause typescript\n// doesn't allow optional argument put in front of required argument. This\n// order is different from a usual logging API.\nfunction logInternal(severity: Logger.Severity, content: string, _stack: number, category?: string) {\n const config = LOGGER_CONFIG_MAP[category || ''] || LOGGER_CONFIG_MAP[''];\n if (SEVERITY_VALUE[severity] < SEVERITY_VALUE[config.minimalSeverity]) {\n return;\n }\n\n if (config.logDateTime) {\n content = `${new Date().toISOString()}|${content}`;\n }\n\n if (config.logSourceLocation) {\n // TODO: calculate source location from 'stack'\n }\n\n LOGGER_PROVIDER_MAP[config.provider].log(severity, content, category);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace log {\n export function verbose(content: string): void;\n export function verbose(category: string, content: string): void;\n export function verbose(arg0: string, arg1?: string) {\n log('verbose', arg0, arg1);\n }\n export function info(content: string): void;\n export function info(category: string, content: string): void;\n export function info(arg0: string, arg1?: string) {\n log('info', arg0, arg1);\n }\n export function warning(content: string): void;\n export function warning(category: string, content: string): void;\n export function warning(arg0: string, arg1?: string) {\n log('warning', arg0, arg1);\n }\n export function error(content: string): void;\n export function error(category: string, content: string): void;\n export function error(arg0: string, arg1?: string) {\n log('error', arg0, arg1);\n }\n export function fatal(content: string): void;\n export function fatal(category: string, content: string): void;\n export function fatal(arg0: string, arg1?: string) {\n log('fatal', arg0, arg1);\n }\n\n export function reset(config?: Logger.Config): void {\n LOGGER_CONFIG_MAP = {};\n set('', config || {});\n }\n export function set(category: string, config: Logger.Config): void {\n if (category === '*') {\n reset(config);\n } else {\n const previousConfig = LOGGER_CONFIG_MAP[category] || LOGGER_DEFAULT_CONFIG;\n LOGGER_CONFIG_MAP[category] = {\n provider: config.provider || previousConfig.provider,\n minimalSeverity: config.minimalSeverity || previousConfig.minimalSeverity,\n logDateTime: (config.logDateTime === undefined) ? previousConfig.logDateTime : config.logDateTime,\n logSourceLocation: (config.logSourceLocation === undefined) ? previousConfig.logSourceLocation :\n config.logSourceLocation\n };\n }\n\n // TODO: we want to support wildcard or regex?\n }\n\n export function setWithEnv(env: Env): void {\n const config: Logger.Config = {};\n if (env.logLevel) {\n config.minimalSeverity = env.logLevel as Logger.Severity;\n }\n set('', config);\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare, @typescript-eslint/naming-convention\nexport const Logger: Logger = log;\n\nexport declare namespace Profiler {\n export interface Config {\n maxNumberEvents?: number;\n flushBatchSize?: number;\n flushIntervalInMilliseconds?: number;\n }\n\n export type EventCategory = 'session'|'node'|'op'|'backend';\n\n export interface Event {\n end(): void|Promise;\n }\n}\n// TODO\n// class WebGLEvent implements Profiler.Event {}\n\nclass Event implements Profiler.Event {\n constructor(\n public category: Profiler.EventCategory, public name: string, public startTime: number,\n private endCallback: (e: Event) => void|Promise, public timer?: WebGLQuery, public ctx?: WebGLContext) {}\n\n async end() {\n return this.endCallback(this);\n }\n\n async checkTimer(): Promise {\n if (this.ctx === undefined || this.timer === undefined) {\n throw new Error('No webgl timer found');\n } else {\n this.ctx.endTimer();\n return this.ctx.waitForQueryAndGetTime(this.timer);\n }\n }\n}\n\nclass EventRecord {\n constructor(\n public category: Profiler.EventCategory, public name: string, public startTime: number, public endTime: number) {}\n}\n\nexport class Profiler {\n static create(config?: Profiler.Config): Profiler {\n if (config === undefined) {\n return new this();\n }\n return new this(config.maxNumberEvents, config.flushBatchSize, config.flushIntervalInMilliseconds);\n }\n\n private constructor(maxNumberEvents?: number, flushBatchSize?: number, flushIntervalInMilliseconds?: number) {\n this._started = false;\n this._maxNumberEvents = maxNumberEvents === undefined ? 10000 : maxNumberEvents;\n this._flushBatchSize = flushBatchSize === undefined ? 10 : flushBatchSize;\n this._flushIntervalInMilliseconds = flushIntervalInMilliseconds === undefined ? 5000 : flushIntervalInMilliseconds;\n }\n\n // start profiling\n start() {\n this._started = true;\n this._timingEvents = [];\n this._flushTime = now();\n this._flushPointer = 0;\n }\n\n // stop profiling\n stop() {\n this._started = false;\n for (; this._flushPointer < this._timingEvents.length; this._flushPointer++) {\n this.logOneEvent(this._timingEvents[this._flushPointer]);\n }\n }\n\n // create an event scope for the specific function\n event(category: Profiler.EventCategory, name: string, func: () => T, ctx?: WebGLContext): T;\n event(category: Profiler.EventCategory, name: string, func: () => Promise, ctx?: WebGLContext): Promise;\n\n event(category: Profiler.EventCategory, name: string, func: () => T | Promise, ctx?: WebGLContext): T\n |Promise {\n const event = this._started ? this.begin(category, name, ctx) : undefined;\n let isPromise = false;\n\n const res = func();\n\n // we consider a then-able object is a promise\n if (res && typeof (res as Promise).then === 'function') {\n isPromise = true;\n return new Promise((resolve, reject) => {\n (res as Promise)\n .then(\n async value => { // fulfilled\n if (event) {\n await event.end();\n }\n resolve(value);\n },\n async reason => { // rejected\n if (event) {\n await event.end();\n }\n reject(reason);\n });\n });\n }\n if (!isPromise && event) {\n const eventRes = event.end();\n if (eventRes && typeof eventRes.then === 'function') {\n return new Promise((resolve, reject) => {\n (eventRes).then(\n () => { // fulfilled\n resolve(res);\n },\n (reason) => { // rejected\n reject(reason);\n });\n });\n }\n }\n return res;\n }\n\n // begin an event\n begin(category: Profiler.EventCategory, name: string, ctx?: WebGLContext): Event {\n if (!this._started) {\n throw new Error('profiler is not started yet');\n }\n if (ctx === undefined) {\n const startTime = now();\n this.flush(startTime);\n return new Event(category, name, startTime, e => this.endSync(e));\n } else {\n const timer: WebGLQuery = ctx.beginTimer();\n return new Event(category, name, 0, async e => this.end(e), timer, ctx);\n }\n }\n\n // end the specific event\n private async end(event: Event): Promise {\n const endTime: number = await event.checkTimer();\n if (this._timingEvents.length < this._maxNumberEvents) {\n this._timingEvents.push(new EventRecord(event.category, event.name, event.startTime, endTime));\n this.flush(endTime);\n }\n }\n\n private endSync(event: Event): void {\n const endTime: number = now();\n if (this._timingEvents.length < this._maxNumberEvents) {\n this._timingEvents.push(new EventRecord(event.category, event.name, event.startTime, endTime));\n this.flush(endTime);\n }\n }\n\n private logOneEvent(event: EventRecord) {\n Logger.verbose(\n `Profiler.${event.category}`,\n `${(event.endTime - event.startTime).toFixed(2)}ms on event '${event.name}' at ${event.endTime.toFixed(2)}`);\n }\n\n private flush(currentTime: number) {\n if (this._timingEvents.length - this._flushPointer >= this._flushBatchSize ||\n currentTime - this._flushTime >= this._flushIntervalInMilliseconds) {\n // should flush when either batch size accumlated or interval elepsed\n\n for (const previousPointer = this._flushPointer; this._flushPointer < previousPointer + this._flushBatchSize &&\n this._flushPointer < this._timingEvents.length;\n this._flushPointer++) {\n this.logOneEvent(this._timingEvents[this._flushPointer]);\n }\n\n this._flushTime = now();\n }\n }\n\n get started() {\n return this._started;\n }\n private _started = false;\n private _timingEvents: EventRecord[];\n\n private readonly _maxNumberEvents: number;\n\n private readonly _flushBatchSize: number;\n private readonly _flushIntervalInMilliseconds: number;\n\n private _flushTime: number;\n private _flushPointer = 0;\n}\n\n/**\n * returns a number to represent the current timestamp in a resolution as high as possible.\n */\nexport const now = (typeof performance !== 'undefined' && performance.now) ? () => performance.now() : Date.now;\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Graph} from './graph';\nimport {OperatorImplementation, OperatorInitialization} from './operators';\n\nexport interface OpSet {\n domain: string;\n version: number;\n}\nexport declare namespace OpSet {\n /**\n * Domain of an opset, it can be an empty string(default value, represent for ai.onnx), or 'ai.onnx.ml'\n */\n type Domain = ''|'ai.onnx.ml'|'com.microsoft';\n /**\n * A resolve rule consists of 4 or 5 items: opType, opSetDomain, versionSelector, operatorImplementation and\n * operatorInitialization (optional)\n */\n type ResolveRule = [\n string, Domain, string, OperatorImplementation\n ]|[string, Domain, string, OperatorImplementation, OperatorInitialization];\n}\n\nexport function resolveOperator(node: Graph.Node, opsets: readonly OpSet[], rules: readonly OpSet.ResolveRule[]) {\n for (const rule of rules) {\n const opType = rule[0];\n const domain = rule[1];\n const versionSelector = rule[2];\n const opImpl = rule[3];\n const opInit = rule[4];\n\n if (node.opType === opType) { // operator type matches\n for (const opset of opsets) {\n // opset '' and 'ai.onnx' are considered the same.\n if (opset.domain === domain || (opset.domain === 'ai.onnx' && domain === '')) { // opset domain found\n if (matchSelector(opset.version, versionSelector)) {\n return {opImpl, opInit};\n }\n }\n }\n }\n }\n\n throw new TypeError(`cannot resolve operator '${node.opType}' with opsets: ${\n opsets.map(set => `${set.domain || 'ai.onnx'} v${set.version}`).join(', ')}`);\n}\n\nfunction matchSelector(version: number, selector: string): boolean {\n if (selector.endsWith('+')) {\n // minimum version match ('7+' expects version>=7)\n const rangeStart = Number.parseInt(selector.substring(0, selector.length - 1), 10);\n return !isNaN(rangeStart) && rangeStart <= version;\n } else if (selector.split('-').length === 2) {\n // range match ('6-8' expects 6<=version<=8)\n const pair = selector.split('-');\n const rangeStart = Number.parseInt(pair[0], 10);\n const rangeEnd = Number.parseInt(pair[1], 10);\n return !isNaN(rangeStart) && !isNaN(rangeEnd) && rangeStart <= version && version <= rangeEnd;\n } else {\n // exact match ('7' expects version===7)\n return Number.parseInt(selector, 10) === version;\n }\n}\n","\"use strict\";\r\nexports.__esModule = true;\r\nvar Guid = /** @class */ (function () {\r\n function Guid(guid) {\r\n if (!guid) {\r\n throw new TypeError(\"Invalid argument; `value` has no value.\");\r\n }\r\n this.value = Guid.EMPTY;\r\n if (guid && Guid.isGuid(guid)) {\r\n this.value = guid;\r\n }\r\n }\r\n Guid.isGuid = function (guid) {\r\n var value = guid.toString();\r\n return guid && (guid instanceof Guid || Guid.validator.test(value));\r\n };\r\n Guid.create = function () {\r\n return new Guid([Guid.gen(2), Guid.gen(1), Guid.gen(1), Guid.gen(1), Guid.gen(3)].join(\"-\"));\r\n };\r\n Guid.createEmpty = function () {\r\n return new Guid(\"emptyguid\");\r\n };\r\n Guid.parse = function (guid) {\r\n return new Guid(guid);\r\n };\r\n Guid.raw = function () {\r\n return [Guid.gen(2), Guid.gen(1), Guid.gen(1), Guid.gen(1), Guid.gen(3)].join(\"-\");\r\n };\r\n Guid.gen = function (count) {\r\n var out = \"\";\r\n for (var i = 0; i < count; i++) {\r\n // tslint:disable-next-line:no-bitwise\r\n out += (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);\r\n }\r\n return out;\r\n };\r\n Guid.prototype.equals = function (other) {\r\n // Comparing string `value` against provided `guid` will auto-call\r\n // toString on `guid` for comparison\r\n return Guid.isGuid(other) && this.value === other.toString();\r\n };\r\n Guid.prototype.isEmpty = function () {\r\n return this.value === Guid.EMPTY;\r\n };\r\n Guid.prototype.toString = function () {\r\n return this.value;\r\n };\r\n Guid.prototype.toJSON = function () {\r\n return {\r\n value: this.value\r\n };\r\n };\r\n Guid.validator = new RegExp(\"^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$\", \"i\");\r\n Guid.EMPTY = \"00000000-0000-0000-0000-000000000000\";\r\n return Guid;\r\n}());\r\nexports.Guid = Guid;\r\n","/**\n * @license\n * Copyright 2009 The Closure Library Authors\n * Copyright 2020 Daniel Wirtz / The long.js Authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// WebAssembly optimizations to do native i64 multiplication and divide\nvar wasm = null;\ntry {\n wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11\n ])), {}).exports;\n} catch (e) {\n // no wasm support :(\n}\n\n/**\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\n * See the from* functions below for more convenient ways of constructing Longs.\n * @exports Long\n * @class A Long class for representing a 64 bit two's-complement integer value.\n * @param {number} low The low (signed) 32 bits of the long\n * @param {number} high The high (signed) 32 bits of the long\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @constructor\n */\nfunction Long(low, high, unsigned) {\n\n /**\n * The low 32 bits as a signed value.\n * @type {number}\n */\n this.low = low | 0;\n\n /**\n * The high 32 bits as a signed value.\n * @type {number}\n */\n this.high = high | 0;\n\n /**\n * Whether unsigned or not.\n * @type {boolean}\n */\n this.unsigned = !!unsigned;\n}\n\n// The internal representation of a long is the two given signed, 32-bit values.\n// We use 32-bit pieces because these are the size of integers on which\n// Javascript performs bit-operations. For operations like addition and\n// multiplication, we split each number into 16 bit pieces, which can easily be\n// multiplied within Javascript's floating-point representation without overflow\n// or change in sign.\n//\n// In the algorithms below, we frequently reduce the negative case to the\n// positive case by negating the input(s) and then post-processing the result.\n// Note that we must ALWAYS check specially whether those values are MIN_VALUE\n// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n// a positive number, it overflows back into a negative). Not handling this\n// case would often result in infinite recursion.\n//\n// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\n// methods on which they depend.\n\n/**\n * An indicator used to reliably determine if an object is a Long or not.\n * @type {boolean}\n * @const\n * @private\n */\nLong.prototype.__isLong__;\n\nObject.defineProperty(Long.prototype, \"__isLong__\", { value: true });\n\n/**\n * @function\n * @param {*} obj Object\n * @returns {boolean}\n * @inner\n */\nfunction isLong(obj) {\n return (obj && obj[\"__isLong__\"]) === true;\n}\n\n/**\n * @function\n * @param {*} value number\n * @returns {number}\n * @inner\n */\nfunction ctz32(value) {\n var c = Math.clz32(value & -value);\n return value ? 31 - c : c;\n}\n\n/**\n * Tests if the specified object is a Long.\n * @function\n * @param {*} obj Object\n * @returns {boolean}\n */\nLong.isLong = isLong;\n\n/**\n * A cache of the Long representations of small integer values.\n * @type {!Object}\n * @inner\n */\nvar INT_CACHE = {};\n\n/**\n * A cache of the Long representations of small unsigned integer values.\n * @type {!Object}\n * @inner\n */\nvar UINT_CACHE = {};\n\n/**\n * @param {number} value\n * @param {boolean=} unsigned\n * @returns {!Long}\n * @inner\n */\nfunction fromInt(value, unsigned) {\n var obj, cachedObj, cache;\n if (unsigned) {\n value >>>= 0;\n if (cache = (0 <= value && value < 256)) {\n cachedObj = UINT_CACHE[value];\n if (cachedObj)\n return cachedObj;\n }\n obj = fromBits(value, 0, true);\n if (cache)\n UINT_CACHE[value] = obj;\n return obj;\n } else {\n value |= 0;\n if (cache = (-128 <= value && value < 128)) {\n cachedObj = INT_CACHE[value];\n if (cachedObj)\n return cachedObj;\n }\n obj = fromBits(value, value < 0 ? -1 : 0, false);\n if (cache)\n INT_CACHE[value] = obj;\n return obj;\n }\n}\n\n/**\n * Returns a Long representing the given 32 bit integer value.\n * @function\n * @param {number} value The 32 bit integer in question\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @returns {!Long} The corresponding Long value\n */\nLong.fromInt = fromInt;\n\n/**\n * @param {number} value\n * @param {boolean=} unsigned\n * @returns {!Long}\n * @inner\n */\nfunction fromNumber(value, unsigned) {\n if (isNaN(value))\n return unsigned ? UZERO : ZERO;\n if (unsigned) {\n if (value < 0)\n return UZERO;\n if (value >= TWO_PWR_64_DBL)\n return MAX_UNSIGNED_VALUE;\n } else {\n if (value <= -TWO_PWR_63_DBL)\n return MIN_VALUE;\n if (value + 1 >= TWO_PWR_63_DBL)\n return MAX_VALUE;\n }\n if (value < 0)\n return fromNumber(-value, unsigned).neg();\n return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\n}\n\n/**\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\n * @function\n * @param {number} value The number in question\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @returns {!Long} The corresponding Long value\n */\nLong.fromNumber = fromNumber;\n\n/**\n * @param {number} lowBits\n * @param {number} highBits\n * @param {boolean=} unsigned\n * @returns {!Long}\n * @inner\n */\nfunction fromBits(lowBits, highBits, unsigned) {\n return new Long(lowBits, highBits, unsigned);\n}\n\n/**\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\n * assumed to use 32 bits.\n * @function\n * @param {number} lowBits The low 32 bits\n * @param {number} highBits The high 32 bits\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @returns {!Long} The corresponding Long value\n */\nLong.fromBits = fromBits;\n\n/**\n * @function\n * @param {number} base\n * @param {number} exponent\n * @returns {number}\n * @inner\n */\nvar pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)\n\n/**\n * @param {string} str\n * @param {(boolean|number)=} unsigned\n * @param {number=} radix\n * @returns {!Long}\n * @inner\n */\nfunction fromString(str, unsigned, radix) {\n if (str.length === 0)\n throw Error('empty string');\n if (typeof unsigned === 'number') {\n // For goog.math.long compatibility\n radix = unsigned;\n unsigned = false;\n } else {\n unsigned = !!unsigned;\n }\n if (str === \"NaN\" || str === \"Infinity\" || str === \"+Infinity\" || str === \"-Infinity\")\n return unsigned ? UZERO : ZERO;\n radix = radix || 10;\n if (radix < 2 || 36 < radix)\n throw RangeError('radix');\n\n var p;\n if ((p = str.indexOf('-')) > 0)\n throw Error('interior hyphen');\n else if (p === 0) {\n return fromString(str.substring(1), unsigned, radix).neg();\n }\n\n // Do several (8) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = fromNumber(pow_dbl(radix, 8));\n\n var result = ZERO;\n for (var i = 0; i < str.length; i += 8) {\n var size = Math.min(8, str.length - i),\n value = parseInt(str.substring(i, i + size), radix);\n if (size < 8) {\n var power = fromNumber(pow_dbl(radix, size));\n result = result.mul(power).add(fromNumber(value));\n } else {\n result = result.mul(radixToPower);\n result = result.add(fromNumber(value));\n }\n }\n result.unsigned = unsigned;\n return result;\n}\n\n/**\n * Returns a Long representation of the given string, written using the specified radix.\n * @function\n * @param {string} str The textual representation of the Long\n * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed\n * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\n * @returns {!Long} The corresponding Long value\n */\nLong.fromString = fromString;\n\n/**\n * @function\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val\n * @param {boolean=} unsigned\n * @returns {!Long}\n * @inner\n */\nfunction fromValue(val, unsigned) {\n if (typeof val === 'number')\n return fromNumber(val, unsigned);\n if (typeof val === 'string')\n return fromString(val, unsigned);\n // Throws for non-objects, converts non-instanceof Long:\n return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);\n}\n\n/**\n * Converts the specified value to a Long using the appropriate from* function for its type.\n * @function\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @returns {!Long}\n */\nLong.fromValue = fromValue;\n\n// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\n// no runtime penalty for these.\n\n/**\n * @type {number}\n * @const\n * @inner\n */\nvar TWO_PWR_16_DBL = 1 << 16;\n\n/**\n * @type {number}\n * @const\n * @inner\n */\nvar TWO_PWR_24_DBL = 1 << 24;\n\n/**\n * @type {number}\n * @const\n * @inner\n */\nvar TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\n\n/**\n * @type {number}\n * @const\n * @inner\n */\nvar TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\n\n/**\n * @type {number}\n * @const\n * @inner\n */\nvar TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\n\n/**\n * @type {!Long}\n * @const\n * @inner\n */\nvar TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);\n\n/**\n * @type {!Long}\n * @inner\n */\nvar ZERO = fromInt(0);\n\n/**\n * Signed zero.\n * @type {!Long}\n */\nLong.ZERO = ZERO;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar UZERO = fromInt(0, true);\n\n/**\n * Unsigned zero.\n * @type {!Long}\n */\nLong.UZERO = UZERO;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar ONE = fromInt(1);\n\n/**\n * Signed one.\n * @type {!Long}\n */\nLong.ONE = ONE;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar UONE = fromInt(1, true);\n\n/**\n * Unsigned one.\n * @type {!Long}\n */\nLong.UONE = UONE;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar NEG_ONE = fromInt(-1);\n\n/**\n * Signed negative one.\n * @type {!Long}\n */\nLong.NEG_ONE = NEG_ONE;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar MAX_VALUE = fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0, false);\n\n/**\n * Maximum signed value.\n * @type {!Long}\n */\nLong.MAX_VALUE = MAX_VALUE;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF | 0, 0xFFFFFFFF | 0, true);\n\n/**\n * Maximum unsigned value.\n * @type {!Long}\n */\nLong.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;\n\n/**\n * @type {!Long}\n * @inner\n */\nvar MIN_VALUE = fromBits(0, 0x80000000 | 0, false);\n\n/**\n * Minimum signed value.\n * @type {!Long}\n */\nLong.MIN_VALUE = MIN_VALUE;\n\n/**\n * @alias Long.prototype\n * @inner\n */\nvar LongPrototype = Long.prototype;\n\n/**\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\n * @this {!Long}\n * @returns {number}\n */\nLongPrototype.toInt = function toInt() {\n return this.unsigned ? this.low >>> 0 : this.low;\n};\n\n/**\n * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\n * @this {!Long}\n * @returns {number}\n */\nLongPrototype.toNumber = function toNumber() {\n if (this.unsigned)\n return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\n return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\n};\n\n/**\n * Converts the Long to a string written in the specified radix.\n * @this {!Long}\n * @param {number=} radix Radix (2-36), defaults to 10\n * @returns {string}\n * @override\n * @throws {RangeError} If `radix` is out of range\n */\nLongPrototype.toString = function toString(radix) {\n radix = radix || 10;\n if (radix < 2 || 36 < radix)\n throw RangeError('radix');\n if (this.isZero())\n return '0';\n if (this.isNegative()) { // Unsigned Longs are never negative\n if (this.eq(MIN_VALUE)) {\n // We need to change the Long value before it can be negated, so we remove\n // the bottom-most digit in this base and then recurse to do the rest.\n var radixLong = fromNumber(radix),\n div = this.div(radixLong),\n rem1 = div.mul(radixLong).sub(this);\n return div.toString(radix) + rem1.toInt().toString(radix);\n } else\n return '-' + this.neg().toString(radix);\n }\n\n // Do several (6) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),\n rem = this;\n var result = '';\n while (true) {\n var remDiv = rem.div(radixToPower),\n intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,\n digits = intval.toString(radix);\n rem = remDiv;\n if (rem.isZero())\n return digits + result;\n else {\n while (digits.length < 6)\n digits = '0' + digits;\n result = '' + digits + result;\n }\n }\n};\n\n/**\n * Gets the high 32 bits as a signed integer.\n * @this {!Long}\n * @returns {number} Signed high bits\n */\nLongPrototype.getHighBits = function getHighBits() {\n return this.high;\n};\n\n/**\n * Gets the high 32 bits as an unsigned integer.\n * @this {!Long}\n * @returns {number} Unsigned high bits\n */\nLongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\n return this.high >>> 0;\n};\n\n/**\n * Gets the low 32 bits as a signed integer.\n * @this {!Long}\n * @returns {number} Signed low bits\n */\nLongPrototype.getLowBits = function getLowBits() {\n return this.low;\n};\n\n/**\n * Gets the low 32 bits as an unsigned integer.\n * @this {!Long}\n * @returns {number} Unsigned low bits\n */\nLongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\n return this.low >>> 0;\n};\n\n/**\n * Gets the number of bits needed to represent the absolute value of this Long.\n * @this {!Long}\n * @returns {number}\n */\nLongPrototype.getNumBitsAbs = function getNumBitsAbs() {\n if (this.isNegative()) // Unsigned Longs are never negative\n return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();\n var val = this.high != 0 ? this.high : this.low;\n for (var bit = 31; bit > 0; bit--)\n if ((val & (1 << bit)) != 0)\n break;\n return this.high != 0 ? bit + 33 : bit + 1;\n};\n\n/**\n * Tests if this Long's value equals zero.\n * @this {!Long}\n * @returns {boolean}\n */\nLongPrototype.isZero = function isZero() {\n return this.high === 0 && this.low === 0;\n};\n\n/**\n * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.\n * @returns {boolean}\n */\nLongPrototype.eqz = LongPrototype.isZero;\n\n/**\n * Tests if this Long's value is negative.\n * @this {!Long}\n * @returns {boolean}\n */\nLongPrototype.isNegative = function isNegative() {\n return !this.unsigned && this.high < 0;\n};\n\n/**\n * Tests if this Long's value is positive or zero.\n * @this {!Long}\n * @returns {boolean}\n */\nLongPrototype.isPositive = function isPositive() {\n return this.unsigned || this.high >= 0;\n};\n\n/**\n * Tests if this Long's value is odd.\n * @this {!Long}\n * @returns {boolean}\n */\nLongPrototype.isOdd = function isOdd() {\n return (this.low & 1) === 1;\n};\n\n/**\n * Tests if this Long's value is even.\n * @this {!Long}\n * @returns {boolean}\n */\nLongPrototype.isEven = function isEven() {\n return (this.low & 1) === 0;\n};\n\n/**\n * Tests if this Long's value equals the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.equals = function equals(other) {\n if (!isLong(other))\n other = fromValue(other);\n if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\n return false;\n return this.high === other.high && this.low === other.low;\n};\n\n/**\n * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.eq = LongPrototype.equals;\n\n/**\n * Tests if this Long's value differs from the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.notEquals = function notEquals(other) {\n return !this.eq(/* validates */ other);\n};\n\n/**\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.neq = LongPrototype.notEquals;\n\n/**\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.ne = LongPrototype.notEquals;\n\n/**\n * Tests if this Long's value is less than the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.lessThan = function lessThan(other) {\n return this.comp(/* validates */ other) < 0;\n};\n\n/**\n * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.lt = LongPrototype.lessThan;\n\n/**\n * Tests if this Long's value is less than or equal the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {\n return this.comp(/* validates */ other) <= 0;\n};\n\n/**\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.lte = LongPrototype.lessThanOrEqual;\n\n/**\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.le = LongPrototype.lessThanOrEqual;\n\n/**\n * Tests if this Long's value is greater than the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.greaterThan = function greaterThan(other) {\n return this.comp(/* validates */ other) > 0;\n};\n\n/**\n * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.gt = LongPrototype.greaterThan;\n\n/**\n * Tests if this Long's value is greater than or equal the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\n return this.comp(/* validates */ other) >= 0;\n};\n\n/**\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.gte = LongPrototype.greaterThanOrEqual;\n\n/**\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {boolean}\n */\nLongPrototype.ge = LongPrototype.greaterThanOrEqual;\n\n/**\n * Compares this Long's value with the specified's.\n * @this {!Long}\n * @param {!Long|number|string} other Other value\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\n * if the given one is greater\n */\nLongPrototype.compare = function compare(other) {\n if (!isLong(other))\n other = fromValue(other);\n if (this.eq(other))\n return 0;\n var thisNeg = this.isNegative(),\n otherNeg = other.isNegative();\n if (thisNeg && !otherNeg)\n return -1;\n if (!thisNeg && otherNeg)\n return 1;\n // At this point the sign bits are the same\n if (!this.unsigned)\n return this.sub(other).isNegative() ? -1 : 1;\n // Both are positive if at least one is unsigned\n return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\n};\n\n/**\n * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.\n * @function\n * @param {!Long|number|string} other Other value\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\n * if the given one is greater\n */\nLongPrototype.comp = LongPrototype.compare;\n\n/**\n * Negates this Long's value.\n * @this {!Long}\n * @returns {!Long} Negated Long\n */\nLongPrototype.negate = function negate() {\n if (!this.unsigned && this.eq(MIN_VALUE))\n return MIN_VALUE;\n return this.not().add(ONE);\n};\n\n/**\n * Negates this Long's value. This is an alias of {@link Long#negate}.\n * @function\n * @returns {!Long} Negated Long\n */\nLongPrototype.neg = LongPrototype.negate;\n\n/**\n * Returns the sum of this and the specified Long.\n * @this {!Long}\n * @param {!Long|number|string} addend Addend\n * @returns {!Long} Sum\n */\nLongPrototype.add = function add(addend) {\n if (!isLong(addend))\n addend = fromValue(addend);\n\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\n\n var a48 = this.high >>> 16;\n var a32 = this.high & 0xFFFF;\n var a16 = this.low >>> 16;\n var a00 = this.low & 0xFFFF;\n\n var b48 = addend.high >>> 16;\n var b32 = addend.high & 0xFFFF;\n var b16 = addend.low >>> 16;\n var b00 = addend.low & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 + b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 + b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 + b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 + b48;\n c48 &= 0xFFFF;\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\n};\n\n/**\n * Returns the difference of this and the specified Long.\n * @this {!Long}\n * @param {!Long|number|string} subtrahend Subtrahend\n * @returns {!Long} Difference\n */\nLongPrototype.subtract = function subtract(subtrahend) {\n if (!isLong(subtrahend))\n subtrahend = fromValue(subtrahend);\n return this.add(subtrahend.neg());\n};\n\n/**\n * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\n * @function\n * @param {!Long|number|string} subtrahend Subtrahend\n * @returns {!Long} Difference\n */\nLongPrototype.sub = LongPrototype.subtract;\n\n/**\n * Returns the product of this and the specified Long.\n * @this {!Long}\n * @param {!Long|number|string} multiplier Multiplier\n * @returns {!Long} Product\n */\nLongPrototype.multiply = function multiply(multiplier) {\n if (this.isZero())\n return this;\n if (!isLong(multiplier))\n multiplier = fromValue(multiplier);\n\n // use wasm support if present\n if (wasm) {\n var low = wasm[\"mul\"](this.low,\n this.high,\n multiplier.low,\n multiplier.high);\n return fromBits(low, wasm[\"get_high\"](), this.unsigned);\n }\n\n if (multiplier.isZero())\n return this.unsigned ? UZERO : ZERO;\n if (this.eq(MIN_VALUE))\n return multiplier.isOdd() ? MIN_VALUE : ZERO;\n if (multiplier.eq(MIN_VALUE))\n return this.isOdd() ? MIN_VALUE : ZERO;\n\n if (this.isNegative()) {\n if (multiplier.isNegative())\n return this.neg().mul(multiplier.neg());\n else\n return this.neg().mul(multiplier).neg();\n } else if (multiplier.isNegative())\n return this.mul(multiplier.neg()).neg();\n\n // If both longs are small, use float multiplication\n if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))\n return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\n\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\n // We can skip products that would overflow.\n\n var a48 = this.high >>> 16;\n var a32 = this.high & 0xFFFF;\n var a16 = this.low >>> 16;\n var a00 = this.low & 0xFFFF;\n\n var b48 = multiplier.high >>> 16;\n var b32 = multiplier.high & 0xFFFF;\n var b16 = multiplier.low >>> 16;\n var b00 = multiplier.low & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 * b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 * b00;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c16 += a00 * b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 * b00;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a16 * b16;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a00 * b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\n c48 &= 0xFFFF;\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\n};\n\n/**\n * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\n * @function\n * @param {!Long|number|string} multiplier Multiplier\n * @returns {!Long} Product\n */\nLongPrototype.mul = LongPrototype.multiply;\n\n/**\n * Returns this Long divided by the specified. The result is signed if this Long is signed or\n * unsigned if this Long is unsigned.\n * @this {!Long}\n * @param {!Long|number|string} divisor Divisor\n * @returns {!Long} Quotient\n */\nLongPrototype.divide = function divide(divisor) {\n if (!isLong(divisor))\n divisor = fromValue(divisor);\n if (divisor.isZero())\n throw Error('division by zero');\n\n // use wasm support if present\n if (wasm) {\n // guard against signed division overflow: the largest\n // negative number / -1 would be 1 larger than the largest\n // positive number, due to two's complement.\n if (!this.unsigned &&\n this.high === -0x80000000 &&\n divisor.low === -1 && divisor.high === -1) {\n // be consistent with non-wasm code path\n return this;\n }\n var low = (this.unsigned ? wasm[\"div_u\"] : wasm[\"div_s\"])(\n this.low,\n this.high,\n divisor.low,\n divisor.high\n );\n return fromBits(low, wasm[\"get_high\"](), this.unsigned);\n }\n\n if (this.isZero())\n return this.unsigned ? UZERO : ZERO;\n var approx, rem, res;\n if (!this.unsigned) {\n // This section is only relevant for signed longs and is derived from the\n // closure library as a whole.\n if (this.eq(MIN_VALUE)) {\n if (divisor.eq(ONE) || divisor.eq(NEG_ONE))\n return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\n else if (divisor.eq(MIN_VALUE))\n return ONE;\n else {\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\n var halfThis = this.shr(1);\n approx = halfThis.div(divisor).shl(1);\n if (approx.eq(ZERO)) {\n return divisor.isNegative() ? ONE : NEG_ONE;\n } else {\n rem = this.sub(divisor.mul(approx));\n res = approx.add(rem.div(divisor));\n return res;\n }\n }\n } else if (divisor.eq(MIN_VALUE))\n return this.unsigned ? UZERO : ZERO;\n if (this.isNegative()) {\n if (divisor.isNegative())\n return this.neg().div(divisor.neg());\n return this.neg().div(divisor).neg();\n } else if (divisor.isNegative())\n return this.div(divisor.neg()).neg();\n res = ZERO;\n } else {\n // The algorithm below has not been made for unsigned longs. It's therefore\n // required to take special care of the MSB prior to running it.\n if (!divisor.unsigned)\n divisor = divisor.toUnsigned();\n if (divisor.gt(this))\n return UZERO;\n if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true\n return UONE;\n res = UZERO;\n }\n\n // Repeat the following until the remainder is less than other: find a\n // floating-point that approximates remainder / other *from below*, add this\n // into the result, and subtract it from the remainder. It is critical that\n // the approximate value is less than or equal to the real value so that the\n // remainder never becomes negative.\n rem = this;\n while (rem.gte(divisor)) {\n // Approximate the result of division. This may be a little greater or\n // smaller than the actual value.\n approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\n\n // We will tweak the approximate result by changing it in the 48-th digit or\n // the smallest non-fractional digit, whichever is larger.\n var log2 = Math.ceil(Math.log(approx) / Math.LN2),\n delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),\n\n // Decrease the approximation until it is smaller than the remainder. Note\n // that if it is too large, the product overflows and is negative.\n approxRes = fromNumber(approx),\n approxRem = approxRes.mul(divisor);\n while (approxRem.isNegative() || approxRem.gt(rem)) {\n approx -= delta;\n approxRes = fromNumber(approx, this.unsigned);\n approxRem = approxRes.mul(divisor);\n }\n\n // We know the answer can't be zero... and actually, zero would cause\n // infinite recursion since we would make no progress.\n if (approxRes.isZero())\n approxRes = ONE;\n\n res = res.add(approxRes);\n rem = rem.sub(approxRem);\n }\n return res;\n};\n\n/**\n * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\n * @function\n * @param {!Long|number|string} divisor Divisor\n * @returns {!Long} Quotient\n */\nLongPrototype.div = LongPrototype.divide;\n\n/**\n * Returns this Long modulo the specified.\n * @this {!Long}\n * @param {!Long|number|string} divisor Divisor\n * @returns {!Long} Remainder\n */\nLongPrototype.modulo = function modulo(divisor) {\n if (!isLong(divisor))\n divisor = fromValue(divisor);\n\n // use wasm support if present\n if (wasm) {\n var low = (this.unsigned ? wasm[\"rem_u\"] : wasm[\"rem_s\"])(\n this.low,\n this.high,\n divisor.low,\n divisor.high\n );\n return fromBits(low, wasm[\"get_high\"](), this.unsigned);\n }\n\n return this.sub(this.div(divisor).mul(divisor));\n};\n\n/**\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\n * @function\n * @param {!Long|number|string} divisor Divisor\n * @returns {!Long} Remainder\n */\nLongPrototype.mod = LongPrototype.modulo;\n\n/**\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\n * @function\n * @param {!Long|number|string} divisor Divisor\n * @returns {!Long} Remainder\n */\nLongPrototype.rem = LongPrototype.modulo;\n\n/**\n * Returns the bitwise NOT of this Long.\n * @this {!Long}\n * @returns {!Long}\n */\nLongPrototype.not = function not() {\n return fromBits(~this.low, ~this.high, this.unsigned);\n};\n\n/**\n * Returns count leading zeros of this Long.\n * @this {!Long}\n * @returns {!number}\n */\nLongPrototype.countLeadingZeros = function countLeadingZeros() {\n return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32;\n};\n\n/**\n * Returns count leading zeros. This is an alias of {@link Long#countLeadingZeros}.\n * @function\n * @param {!Long}\n * @returns {!number}\n */\nLongPrototype.clz = LongPrototype.countLeadingZeros;\n\n/**\n * Returns count trailing zeros of this Long.\n * @this {!Long}\n * @returns {!number}\n */\nLongPrototype.countTrailingZeros = function countTrailingZeros() {\n return this.low ? ctz32(this.low) : ctz32(this.high) + 32;\n};\n\n/**\n * Returns count trailing zeros. This is an alias of {@link Long#countTrailingZeros}.\n * @function\n * @param {!Long}\n * @returns {!number}\n */\nLongPrototype.ctz = LongPrototype.countTrailingZeros;\n\n/**\n * Returns the bitwise AND of this Long and the specified.\n * @this {!Long}\n * @param {!Long|number|string} other Other Long\n * @returns {!Long}\n */\nLongPrototype.and = function and(other) {\n if (!isLong(other))\n other = fromValue(other);\n return fromBits(this.low & other.low, this.high & other.high, this.unsigned);\n};\n\n/**\n * Returns the bitwise OR of this Long and the specified.\n * @this {!Long}\n * @param {!Long|number|string} other Other Long\n * @returns {!Long}\n */\nLongPrototype.or = function or(other) {\n if (!isLong(other))\n other = fromValue(other);\n return fromBits(this.low | other.low, this.high | other.high, this.unsigned);\n};\n\n/**\n * Returns the bitwise XOR of this Long and the given one.\n * @this {!Long}\n * @param {!Long|number|string} other Other Long\n * @returns {!Long}\n */\nLongPrototype.xor = function xor(other) {\n if (!isLong(other))\n other = fromValue(other);\n return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\n};\n\n/**\n * Returns this Long with bits shifted to the left by the given amount.\n * @this {!Long}\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shiftLeft = function shiftLeft(numBits) {\n if (isLong(numBits))\n numBits = numBits.toInt();\n if ((numBits &= 63) === 0)\n return this;\n else if (numBits < 32)\n return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\n else\n return fromBits(0, this.low << (numBits - 32), this.unsigned);\n};\n\n/**\n * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\n * @function\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shl = LongPrototype.shiftLeft;\n\n/**\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\n * @this {!Long}\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shiftRight = function shiftRight(numBits) {\n if (isLong(numBits))\n numBits = numBits.toInt();\n if ((numBits &= 63) === 0)\n return this;\n else if (numBits < 32)\n return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\n else\n return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\n};\n\n/**\n * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\n * @function\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shr = LongPrototype.shiftRight;\n\n/**\n * Returns this Long with bits logically shifted to the right by the given amount.\n * @this {!Long}\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\n if (isLong(numBits)) numBits = numBits.toInt();\n if ((numBits &= 63) === 0) return this;\n if (numBits < 32) return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >>> numBits, this.unsigned);\n if (numBits === 32) return fromBits(this.high, 0, this.unsigned);\n return fromBits(this.high >>> (numBits - 32), 0, this.unsigned);\n};\n\n/**\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\n * @function\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shru = LongPrototype.shiftRightUnsigned;\n\n/**\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\n * @function\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Shifted Long\n */\nLongPrototype.shr_u = LongPrototype.shiftRightUnsigned;\n\n/**\n * Returns this Long with bits rotated to the left by the given amount.\n * @this {!Long}\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Rotated Long\n */\nLongPrototype.rotateLeft = function rotateLeft(numBits) {\n var b;\n if (isLong(numBits)) numBits = numBits.toInt();\n if ((numBits &= 63) === 0) return this;\n if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);\n if (numBits < 32) {\n b = (32 - numBits);\n return fromBits(((this.low << numBits) | (this.high >>> b)), ((this.high << numBits) | (this.low >>> b)), this.unsigned);\n }\n numBits -= 32;\n b = (32 - numBits);\n return fromBits(((this.high << numBits) | (this.low >>> b)), ((this.low << numBits) | (this.high >>> b)), this.unsigned);\n}\n/**\n * Returns this Long with bits rotated to the left by the given amount. This is an alias of {@link Long#rotateLeft}.\n * @function\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Rotated Long\n */\nLongPrototype.rotl = LongPrototype.rotateLeft;\n\n/**\n * Returns this Long with bits rotated to the right by the given amount.\n * @this {!Long}\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Rotated Long\n */\nLongPrototype.rotateRight = function rotateRight(numBits) {\n var b;\n if (isLong(numBits)) numBits = numBits.toInt();\n if ((numBits &= 63) === 0) return this;\n if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);\n if (numBits < 32) {\n b = (32 - numBits);\n return fromBits(((this.high << b) | (this.low >>> numBits)), ((this.low << b) | (this.high >>> numBits)), this.unsigned);\n }\n numBits -= 32;\n b = (32 - numBits);\n return fromBits(((this.low << b) | (this.high >>> numBits)), ((this.high << b) | (this.low >>> numBits)), this.unsigned);\n}\n/**\n * Returns this Long with bits rotated to the right by the given amount. This is an alias of {@link Long#rotateRight}.\n * @function\n * @param {number|!Long} numBits Number of bits\n * @returns {!Long} Rotated Long\n */\nLongPrototype.rotr = LongPrototype.rotateRight;\n\n/**\n * Converts this Long to signed.\n * @this {!Long}\n * @returns {!Long} Signed long\n */\nLongPrototype.toSigned = function toSigned() {\n if (!this.unsigned)\n return this;\n return fromBits(this.low, this.high, false);\n};\n\n/**\n * Converts this Long to unsigned.\n * @this {!Long}\n * @returns {!Long} Unsigned long\n */\nLongPrototype.toUnsigned = function toUnsigned() {\n if (this.unsigned)\n return this;\n return fromBits(this.low, this.high, true);\n};\n\n/**\n * Converts this Long to its byte representation.\n * @param {boolean=} le Whether little or big endian, defaults to big endian\n * @this {!Long}\n * @returns {!Array.} Byte representation\n */\nLongPrototype.toBytes = function toBytes(le) {\n return le ? this.toBytesLE() : this.toBytesBE();\n};\n\n/**\n * Converts this Long to its little endian byte representation.\n * @this {!Long}\n * @returns {!Array.} Little endian byte representation\n */\nLongPrototype.toBytesLE = function toBytesLE() {\n var hi = this.high,\n lo = this.low;\n return [\n lo & 0xff,\n lo >>> 8 & 0xff,\n lo >>> 16 & 0xff,\n lo >>> 24,\n hi & 0xff,\n hi >>> 8 & 0xff,\n hi >>> 16 & 0xff,\n hi >>> 24\n ];\n};\n\n/**\n * Converts this Long to its big endian byte representation.\n * @this {!Long}\n * @returns {!Array.} Big endian byte representation\n */\nLongPrototype.toBytesBE = function toBytesBE() {\n var hi = this.high,\n lo = this.low;\n return [\n hi >>> 24,\n hi >>> 16 & 0xff,\n hi >>> 8 & 0xff,\n hi & 0xff,\n lo >>> 24,\n lo >>> 16 & 0xff,\n lo >>> 8 & 0xff,\n lo & 0xff\n ];\n};\n\n/**\n * Creates a Long from its byte representation.\n * @param {!Array.} bytes Byte representation\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @param {boolean=} le Whether little or big endian, defaults to big endian\n * @returns {Long} The corresponding Long value\n */\nLong.fromBytes = function fromBytes(bytes, unsigned, le) {\n return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);\n};\n\n/**\n * Creates a Long from its little endian byte representation.\n * @param {!Array.} bytes Little endian byte representation\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @returns {Long} The corresponding Long value\n */\nLong.fromBytesLE = function fromBytesLE(bytes, unsigned) {\n return new Long(\n bytes[0] |\n bytes[1] << 8 |\n bytes[2] << 16 |\n bytes[3] << 24,\n bytes[4] |\n bytes[5] << 8 |\n bytes[6] << 16 |\n bytes[7] << 24,\n unsigned\n );\n};\n\n/**\n * Creates a Long from its big endian byte representation.\n * @param {!Array.} bytes Big endian byte representation\n * @param {boolean=} unsigned Whether unsigned or not, defaults to signed\n * @returns {Long} The corresponding Long value\n */\nLong.fromBytesBE = function fromBytesBE(bytes, unsigned) {\n return new Long(\n bytes[4] << 24 |\n bytes[5] << 16 |\n bytes[6] << 8 |\n bytes[7],\n bytes[0] << 24 |\n bytes[1] << 16 |\n bytes[2] << 8 |\n bytes[3],\n unsigned\n );\n};\n\nexport default Long;\n","/// @file\n/// @addtogroup flatbuffers_javascript_api\n/// @{\n/// @cond FLATBUFFERS_INTERNAL\n\n/**\n * @fileoverview\n *\n * Need to suppress 'global this' error so the Node.js export line doesn't cause\n * closure compile to error out.\n * @suppress {globalThis}\n */\n\n/**\n * @const\n * @namespace\n */\nvar flatbuffers = {};\n\n/**\n * @typedef {number}\n */\nflatbuffers.Offset;\n\n/**\n * @typedef {{\n * bb: flatbuffers.ByteBuffer,\n * bb_pos: number\n * }}\n */\nflatbuffers.Table;\n\n/**\n * @type {number}\n * @const\n */\nflatbuffers.SIZEOF_SHORT = 2;\n\n/**\n * @type {number}\n * @const\n */\nflatbuffers.SIZEOF_INT = 4;\n\n/**\n * @type {number}\n * @const\n */\nflatbuffers.FILE_IDENTIFIER_LENGTH = 4;\n\n/**\n * @type {number}\n * @const\n */\nflatbuffers.SIZE_PREFIX_LENGTH = 4;\n\n/**\n * @enum {number}\n */\nflatbuffers.Encoding = {\n UTF8_BYTES: 1,\n UTF16_STRING: 2\n};\n\n/**\n * @type {Int32Array}\n * @const\n */\nflatbuffers.int32 = new Int32Array(2);\n\n/**\n * @type {Float32Array}\n * @const\n */\nflatbuffers.float32 = new Float32Array(flatbuffers.int32.buffer);\n\n/**\n * @type {Float64Array}\n * @const\n */\nflatbuffers.float64 = new Float64Array(flatbuffers.int32.buffer);\n\n/**\n * @type {boolean}\n * @const\n */\nflatbuffers.isLittleEndian = new Uint16Array(new Uint8Array([1, 0]).buffer)[0] === 1;\n\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * @constructor\n * @param {number} low\n * @param {number} high\n */\nflatbuffers.Long = function(low, high) {\n /**\n * @type {number}\n * @const\n */\n this.low = low | 0;\n\n /**\n * @type {number}\n * @const\n */\n this.high = high | 0;\n};\n\n/**\n * @param {number} low\n * @param {number} high\n * @returns {!flatbuffers.Long}\n */\nflatbuffers.Long.create = function(low, high) {\n // Special-case zero to avoid GC overhead for default values\n return low == 0 && high == 0 ? flatbuffers.Long.ZERO : new flatbuffers.Long(low, high);\n};\n\n/**\n * @returns {number}\n */\nflatbuffers.Long.prototype.toFloat64 = function() {\n return (this.low >>> 0) + this.high * 0x100000000;\n};\n\n/**\n * @param {flatbuffers.Long} other\n * @returns {boolean}\n */\nflatbuffers.Long.prototype.equals = function(other) {\n return this.low == other.low && this.high == other.high;\n};\n\n/**\n * @type {!flatbuffers.Long}\n * @const\n */\nflatbuffers.Long.ZERO = new flatbuffers.Long(0, 0);\n\n/// @endcond\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Create a FlatBufferBuilder.\n *\n * @constructor\n * @param {number=} opt_initial_size\n */\nflatbuffers.Builder = function(opt_initial_size) {\n if (!opt_initial_size) {\n var initial_size = 1024;\n } else {\n var initial_size = opt_initial_size;\n }\n\n /**\n * @type {flatbuffers.ByteBuffer}\n * @private\n */\n this.bb = flatbuffers.ByteBuffer.allocate(initial_size);\n\n /**\n * Remaining space in the ByteBuffer.\n *\n * @type {number}\n * @private\n */\n this.space = initial_size;\n\n /**\n * Minimum alignment encountered so far.\n *\n * @type {number}\n * @private\n */\n this.minalign = 1;\n\n /**\n * The vtable for the current table.\n *\n * @type {Array.}\n * @private\n */\n this.vtable = null;\n\n /**\n * The amount of fields we're actually using.\n *\n * @type {number}\n * @private\n */\n this.vtable_in_use = 0;\n\n /**\n * Whether we are currently serializing a table.\n *\n * @type {boolean}\n * @private\n */\n this.isNested = false;\n\n /**\n * Starting offset of the current struct/table.\n *\n * @type {number}\n * @private\n */\n this.object_start = 0;\n\n /**\n * List of offsets of all vtables.\n *\n * @type {Array.}\n * @private\n */\n this.vtables = [];\n\n /**\n * For the current vector being built.\n *\n * @type {number}\n * @private\n */\n this.vector_num_elems = 0;\n\n /**\n * False omits default values from the serialized data\n *\n * @type {boolean}\n * @private\n */\n this.force_defaults = false;\n};\n\nflatbuffers.Builder.prototype.clear = function() {\n this.bb.clear();\n this.space = this.bb.capacity();\n this.minalign = 1;\n this.vtable = null;\n this.vtable_in_use = 0;\n this.isNested = false;\n this.object_start = 0;\n this.vtables = [];\n this.vector_num_elems = 0;\n this.force_defaults = false;\n};\n\n/**\n * In order to save space, fields that are set to their default value\n * don't get serialized into the buffer. Forcing defaults provides a\n * way to manually disable this optimization.\n *\n * @param {boolean} forceDefaults true always serializes default values\n */\nflatbuffers.Builder.prototype.forceDefaults = function(forceDefaults) {\n this.force_defaults = forceDefaults;\n};\n\n/**\n * Get the ByteBuffer representing the FlatBuffer. Only call this after you've\n * called finish(). The actual data starts at the ByteBuffer's current position,\n * not necessarily at 0.\n *\n * @returns {flatbuffers.ByteBuffer}\n */\nflatbuffers.Builder.prototype.dataBuffer = function() {\n return this.bb;\n};\n\n/**\n * Get the bytes representing the FlatBuffer. Only call this after you've\n * called finish().\n *\n * @returns {!Uint8Array}\n */\nflatbuffers.Builder.prototype.asUint8Array = function() {\n return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset());\n};\n\n/// @cond FLATBUFFERS_INTERNAL\n/**\n * Prepare to write an element of `size` after `additional_bytes` have been\n * written, e.g. if you write a string, you need to align such the int length\n * field is aligned to 4 bytes, and the string data follows it directly. If all\n * you need to do is alignment, `additional_bytes` will be 0.\n *\n * @param {number} size This is the of the new element to write\n * @param {number} additional_bytes The padding size\n */\nflatbuffers.Builder.prototype.prep = function(size, additional_bytes) {\n // Track the biggest thing we've ever aligned to.\n if (size > this.minalign) {\n this.minalign = size;\n }\n\n // Find the amount of alignment needed such that `size` is properly\n // aligned after `additional_bytes`\n var align_size = ((~(this.bb.capacity() - this.space + additional_bytes)) + 1) & (size - 1);\n\n // Reallocate the buffer if needed.\n while (this.space < align_size + size + additional_bytes) {\n var old_buf_size = this.bb.capacity();\n this.bb = flatbuffers.Builder.growByteBuffer(this.bb);\n this.space += this.bb.capacity() - old_buf_size;\n }\n\n this.pad(align_size);\n};\n\n/**\n * @param {number} byte_size\n */\nflatbuffers.Builder.prototype.pad = function(byte_size) {\n for (var i = 0; i < byte_size; i++) {\n this.bb.writeInt8(--this.space, 0);\n }\n};\n\n/**\n * @param {number} value\n */\nflatbuffers.Builder.prototype.writeInt8 = function(value) {\n this.bb.writeInt8(this.space -= 1, value);\n};\n\n/**\n * @param {number} value\n */\nflatbuffers.Builder.prototype.writeInt16 = function(value) {\n this.bb.writeInt16(this.space -= 2, value);\n};\n\n/**\n * @param {number} value\n */\nflatbuffers.Builder.prototype.writeInt32 = function(value) {\n this.bb.writeInt32(this.space -= 4, value);\n};\n\n/**\n * @param {flatbuffers.Long} value\n */\nflatbuffers.Builder.prototype.writeInt64 = function(value) {\n this.bb.writeInt64(this.space -= 8, value);\n};\n\n/**\n * @param {number} value\n */\nflatbuffers.Builder.prototype.writeFloat32 = function(value) {\n this.bb.writeFloat32(this.space -= 4, value);\n};\n\n/**\n * @param {number} value\n */\nflatbuffers.Builder.prototype.writeFloat64 = function(value) {\n this.bb.writeFloat64(this.space -= 8, value);\n};\n/// @endcond\n\n/**\n * Add an `int8` to the buffer, properly aligned, and grows the buffer (if necessary).\n * @param {number} value The `int8` to add the the buffer.\n */\nflatbuffers.Builder.prototype.addInt8 = function(value) {\n this.prep(1, 0);\n this.writeInt8(value);\n};\n\n/**\n * Add an `int16` to the buffer, properly aligned, and grows the buffer (if necessary).\n * @param {number} value The `int16` to add the the buffer.\n */\nflatbuffers.Builder.prototype.addInt16 = function(value) {\n this.prep(2, 0);\n this.writeInt16(value);\n};\n\n/**\n * Add an `int32` to the buffer, properly aligned, and grows the buffer (if necessary).\n * @param {number} value The `int32` to add the the buffer.\n */\nflatbuffers.Builder.prototype.addInt32 = function(value) {\n this.prep(4, 0);\n this.writeInt32(value);\n};\n\n/**\n * Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary).\n * @param {flatbuffers.Long} value The `int64` to add the the buffer.\n */\nflatbuffers.Builder.prototype.addInt64 = function(value) {\n this.prep(8, 0);\n this.writeInt64(value);\n};\n\n/**\n * Add a `float32` to the buffer, properly aligned, and grows the buffer (if necessary).\n * @param {number} value The `float32` to add the the buffer.\n */\nflatbuffers.Builder.prototype.addFloat32 = function(value) {\n this.prep(4, 0);\n this.writeFloat32(value);\n};\n\n/**\n * Add a `float64` to the buffer, properly aligned, and grows the buffer (if necessary).\n * @param {number} value The `float64` to add the the buffer.\n */\nflatbuffers.Builder.prototype.addFloat64 = function(value) {\n this.prep(8, 0);\n this.writeFloat64(value);\n};\n\n/// @cond FLATBUFFERS_INTERNAL\n/**\n * @param {number} voffset\n * @param {number} value\n * @param {number} defaultValue\n */\nflatbuffers.Builder.prototype.addFieldInt8 = function(voffset, value, defaultValue) {\n if (this.force_defaults || value != defaultValue) {\n this.addInt8(value);\n this.slot(voffset);\n }\n};\n\n/**\n * @param {number} voffset\n * @param {number} value\n * @param {number} defaultValue\n */\nflatbuffers.Builder.prototype.addFieldInt16 = function(voffset, value, defaultValue) {\n if (this.force_defaults || value != defaultValue) {\n this.addInt16(value);\n this.slot(voffset);\n }\n};\n\n/**\n * @param {number} voffset\n * @param {number} value\n * @param {number} defaultValue\n */\nflatbuffers.Builder.prototype.addFieldInt32 = function(voffset, value, defaultValue) {\n if (this.force_defaults || value != defaultValue) {\n this.addInt32(value);\n this.slot(voffset);\n }\n};\n\n/**\n * @param {number} voffset\n * @param {flatbuffers.Long} value\n * @param {flatbuffers.Long} defaultValue\n */\nflatbuffers.Builder.prototype.addFieldInt64 = function(voffset, value, defaultValue) {\n if (this.force_defaults || !value.equals(defaultValue)) {\n this.addInt64(value);\n this.slot(voffset);\n }\n};\n\n/**\n * @param {number} voffset\n * @param {number} value\n * @param {number} defaultValue\n */\nflatbuffers.Builder.prototype.addFieldFloat32 = function(voffset, value, defaultValue) {\n if (this.force_defaults || value != defaultValue) {\n this.addFloat32(value);\n this.slot(voffset);\n }\n};\n\n/**\n * @param {number} voffset\n * @param {number} value\n * @param {number} defaultValue\n */\nflatbuffers.Builder.prototype.addFieldFloat64 = function(voffset, value, defaultValue) {\n if (this.force_defaults || value != defaultValue) {\n this.addFloat64(value);\n this.slot(voffset);\n }\n};\n\n/**\n * @param {number} voffset\n * @param {flatbuffers.Offset} value\n * @param {flatbuffers.Offset} defaultValue\n */\nflatbuffers.Builder.prototype.addFieldOffset = function(voffset, value, defaultValue) {\n if (this.force_defaults || value != defaultValue) {\n this.addOffset(value);\n this.slot(voffset);\n }\n};\n\n/**\n * Structs are stored inline, so nothing additional is being added. `d` is always 0.\n *\n * @param {number} voffset\n * @param {flatbuffers.Offset} value\n * @param {flatbuffers.Offset} defaultValue\n */\nflatbuffers.Builder.prototype.addFieldStruct = function(voffset, value, defaultValue) {\n if (value != defaultValue) {\n this.nested(value);\n this.slot(voffset);\n }\n};\n\n/**\n * Structures are always stored inline, they need to be created right\n * where they're used. You'll get this assertion failure if you\n * created it elsewhere.\n *\n * @param {flatbuffers.Offset} obj The offset of the created object\n */\nflatbuffers.Builder.prototype.nested = function(obj) {\n if (obj != this.offset()) {\n throw new Error('FlatBuffers: struct must be serialized inline.');\n }\n};\n\n/**\n * Should not be creating any other object, string or vector\n * while an object is being constructed\n */\nflatbuffers.Builder.prototype.notNested = function() {\n if (this.isNested) {\n throw new Error('FlatBuffers: object serialization must not be nested.');\n }\n};\n\n/**\n * Set the current vtable at `voffset` to the current location in the buffer.\n *\n * @param {number} voffset\n */\nflatbuffers.Builder.prototype.slot = function(voffset) {\n this.vtable[voffset] = this.offset();\n};\n\n/**\n * @returns {flatbuffers.Offset} Offset relative to the end of the buffer.\n */\nflatbuffers.Builder.prototype.offset = function() {\n return this.bb.capacity() - this.space;\n};\n\n/**\n * Doubles the size of the backing ByteBuffer and copies the old data towards\n * the end of the new buffer (since we build the buffer backwards).\n *\n * @param {flatbuffers.ByteBuffer} bb The current buffer with the existing data\n * @returns {!flatbuffers.ByteBuffer} A new byte buffer with the old data copied\n * to it. The data is located at the end of the buffer.\n *\n * uint8Array.set() formally takes {Array|ArrayBufferView}, so to pass\n * it a uint8Array we need to suppress the type check:\n * @suppress {checkTypes}\n */\nflatbuffers.Builder.growByteBuffer = function(bb) {\n var old_buf_size = bb.capacity();\n\n // Ensure we don't grow beyond what fits in an int.\n if (old_buf_size & 0xC0000000) {\n throw new Error('FlatBuffers: cannot grow buffer beyond 2 gigabytes.');\n }\n\n var new_buf_size = old_buf_size << 1;\n var nbb = flatbuffers.ByteBuffer.allocate(new_buf_size);\n nbb.setPosition(new_buf_size - old_buf_size);\n nbb.bytes().set(bb.bytes(), new_buf_size - old_buf_size);\n return nbb;\n};\n/// @endcond\n\n/**\n * Adds on offset, relative to where it will be written.\n *\n * @param {flatbuffers.Offset} offset The offset to add.\n */\nflatbuffers.Builder.prototype.addOffset = function(offset) {\n this.prep(flatbuffers.SIZEOF_INT, 0); // Ensure alignment is already done.\n this.writeInt32(this.offset() - offset + flatbuffers.SIZEOF_INT);\n};\n\n/// @cond FLATBUFFERS_INTERNAL\n/**\n * Start encoding a new object in the buffer. Users will not usually need to\n * call this directly. The FlatBuffers compiler will generate helper methods\n * that call this method internally.\n *\n * @param {number} numfields\n */\nflatbuffers.Builder.prototype.startObject = function(numfields) {\n this.notNested();\n if (this.vtable == null) {\n this.vtable = [];\n }\n this.vtable_in_use = numfields;\n for (var i = 0; i < numfields; i++) {\n this.vtable[i] = 0; // This will push additional elements as needed\n }\n this.isNested = true;\n this.object_start = this.offset();\n};\n\n/**\n * Finish off writing the object that is under construction.\n *\n * @returns {flatbuffers.Offset} The offset to the object inside `dataBuffer`\n */\nflatbuffers.Builder.prototype.endObject = function() {\n if (this.vtable == null || !this.isNested) {\n throw new Error('FlatBuffers: endObject called without startObject');\n }\n\n this.addInt32(0);\n var vtableloc = this.offset();\n\n // Trim trailing zeroes.\n var i = this.vtable_in_use - 1;\n for (; i >= 0 && this.vtable[i] == 0; i--) {}\n var trimmed_size = i + 1;\n\n // Write out the current vtable.\n for (; i >= 0; i--) {\n // Offset relative to the start of the table.\n this.addInt16(this.vtable[i] != 0 ? vtableloc - this.vtable[i] : 0);\n }\n\n var standard_fields = 2; // The fields below:\n this.addInt16(vtableloc - this.object_start);\n var len = (trimmed_size + standard_fields) * flatbuffers.SIZEOF_SHORT;\n this.addInt16(len);\n\n // Search for an existing vtable that matches the current one.\n var existing_vtable = 0;\n var vt1 = this.space;\nouter_loop:\n for (i = 0; i < this.vtables.length; i++) {\n var vt2 = this.bb.capacity() - this.vtables[i];\n if (len == this.bb.readInt16(vt2)) {\n for (var j = flatbuffers.SIZEOF_SHORT; j < len; j += flatbuffers.SIZEOF_SHORT) {\n if (this.bb.readInt16(vt1 + j) != this.bb.readInt16(vt2 + j)) {\n continue outer_loop;\n }\n }\n existing_vtable = this.vtables[i];\n break;\n }\n }\n\n if (existing_vtable) {\n // Found a match:\n // Remove the current vtable.\n this.space = this.bb.capacity() - vtableloc;\n\n // Point table to existing vtable.\n this.bb.writeInt32(this.space, existing_vtable - vtableloc);\n } else {\n // No match:\n // Add the location of the current vtable to the list of vtables.\n this.vtables.push(this.offset());\n\n // Point table to current vtable.\n this.bb.writeInt32(this.bb.capacity() - vtableloc, this.offset() - vtableloc);\n }\n\n this.isNested = false;\n return vtableloc;\n};\n/// @endcond\n\n/**\n * Finalize a buffer, poiting to the given `root_table`.\n *\n * @param {flatbuffers.Offset} root_table\n * @param {string=} opt_file_identifier\n * @param {boolean=} opt_size_prefix\n */\nflatbuffers.Builder.prototype.finish = function(root_table, opt_file_identifier, opt_size_prefix) {\n var size_prefix = opt_size_prefix ? flatbuffers.SIZE_PREFIX_LENGTH : 0;\n if (opt_file_identifier) {\n var file_identifier = opt_file_identifier;\n this.prep(this.minalign, flatbuffers.SIZEOF_INT +\n flatbuffers.FILE_IDENTIFIER_LENGTH + size_prefix);\n if (file_identifier.length != flatbuffers.FILE_IDENTIFIER_LENGTH) {\n throw new Error('FlatBuffers: file identifier must be length ' +\n flatbuffers.FILE_IDENTIFIER_LENGTH);\n }\n for (var i = flatbuffers.FILE_IDENTIFIER_LENGTH - 1; i >= 0; i--) {\n this.writeInt8(file_identifier.charCodeAt(i));\n }\n }\n this.prep(this.minalign, flatbuffers.SIZEOF_INT + size_prefix);\n this.addOffset(root_table);\n if (size_prefix) {\n this.addInt32(this.bb.capacity() - this.space);\n }\n this.bb.setPosition(this.space);\n};\n\n/**\n * Finalize a size prefixed buffer, pointing to the given `root_table`.\n *\n * @param {flatbuffers.Offset} root_table\n * @param {string=} opt_file_identifier\n */\nflatbuffers.Builder.prototype.finishSizePrefixed = function (root_table, opt_file_identifier) {\n this.finish(root_table, opt_file_identifier, true);\n};\n\n/// @cond FLATBUFFERS_INTERNAL\n/**\n * This checks a required field has been set in a given table that has\n * just been constructed.\n *\n * @param {flatbuffers.Offset} table\n * @param {number} field\n */\nflatbuffers.Builder.prototype.requiredField = function(table, field) {\n var table_start = this.bb.capacity() - table;\n var vtable_start = table_start - this.bb.readInt32(table_start);\n var ok = this.bb.readInt16(vtable_start + field) != 0;\n\n // If this fails, the caller will show what field needs to be set.\n if (!ok) {\n throw new Error('FlatBuffers: field ' + field + ' must be set');\n }\n};\n\n/**\n * Start a new array/vector of objects. Users usually will not call\n * this directly. The FlatBuffers compiler will create a start/end\n * method for vector types in generated code.\n *\n * @param {number} elem_size The size of each element in the array\n * @param {number} num_elems The number of elements in the array\n * @param {number} alignment The alignment of the array\n */\nflatbuffers.Builder.prototype.startVector = function(elem_size, num_elems, alignment) {\n this.notNested();\n this.vector_num_elems = num_elems;\n this.prep(flatbuffers.SIZEOF_INT, elem_size * num_elems);\n this.prep(alignment, elem_size * num_elems); // Just in case alignment > int.\n};\n\n/**\n * Finish off the creation of an array and all its elements. The array must be\n * created with `startVector`.\n *\n * @returns {flatbuffers.Offset} The offset at which the newly created array\n * starts.\n */\nflatbuffers.Builder.prototype.endVector = function() {\n this.writeInt32(this.vector_num_elems);\n return this.offset();\n};\n/// @endcond\n\n/**\n * Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed\n * instead of a string, it is assumed to contain valid UTF-8 encoded data.\n *\n * @param {string|Uint8Array} s The string to encode\n * @return {flatbuffers.Offset} The offset in the buffer where the encoded string starts\n */\nflatbuffers.Builder.prototype.createString = function(s) {\n if (s instanceof Uint8Array) {\n var utf8 = s;\n } else {\n var utf8 = [];\n var i = 0;\n\n while (i < s.length) {\n var codePoint;\n\n // Decode UTF-16\n var a = s.charCodeAt(i++);\n if (a < 0xD800 || a >= 0xDC00) {\n codePoint = a;\n } else {\n var b = s.charCodeAt(i++);\n codePoint = (a << 10) + b + (0x10000 - (0xD800 << 10) - 0xDC00);\n }\n\n // Encode UTF-8\n if (codePoint < 0x80) {\n utf8.push(codePoint);\n } else {\n if (codePoint < 0x800) {\n utf8.push(((codePoint >> 6) & 0x1F) | 0xC0);\n } else {\n if (codePoint < 0x10000) {\n utf8.push(((codePoint >> 12) & 0x0F) | 0xE0);\n } else {\n utf8.push(\n ((codePoint >> 18) & 0x07) | 0xF0,\n ((codePoint >> 12) & 0x3F) | 0x80);\n }\n utf8.push(((codePoint >> 6) & 0x3F) | 0x80);\n }\n utf8.push((codePoint & 0x3F) | 0x80);\n }\n }\n }\n\n this.addInt8(0);\n this.startVector(1, utf8.length, 1);\n this.bb.setPosition(this.space -= utf8.length);\n for (var i = 0, offset = this.space, bytes = this.bb.bytes(); i < utf8.length; i++) {\n bytes[offset++] = utf8[i];\n }\n return this.endVector();\n};\n\n/**\n * A helper function to avoid generated code depending on this file directly.\n *\n * @param {number} low\n * @param {number} high\n * @returns {!flatbuffers.Long}\n */\nflatbuffers.Builder.prototype.createLong = function(low, high) {\n return flatbuffers.Long.create(low, high);\n};\n////////////////////////////////////////////////////////////////////////////////\n/// @cond FLATBUFFERS_INTERNAL\n/**\n * Create a new ByteBuffer with a given array of bytes (`Uint8Array`).\n *\n * @constructor\n * @param {Uint8Array} bytes\n */\nflatbuffers.ByteBuffer = function(bytes) {\n /**\n * @type {Uint8Array}\n * @private\n */\n this.bytes_ = bytes;\n\n /**\n * @type {number}\n * @private\n */\n this.position_ = 0;\n};\n\n/**\n * Create and allocate a new ByteBuffer with a given size.\n *\n * @param {number} byte_size\n * @returns {!flatbuffers.ByteBuffer}\n */\nflatbuffers.ByteBuffer.allocate = function(byte_size) {\n return new flatbuffers.ByteBuffer(new Uint8Array(byte_size));\n};\n\nflatbuffers.ByteBuffer.prototype.clear = function() {\n this.position_ = 0;\n};\n\n/**\n * Get the underlying `Uint8Array`.\n *\n * @returns {Uint8Array}\n */\nflatbuffers.ByteBuffer.prototype.bytes = function() {\n return this.bytes_;\n};\n\n/**\n * Get the buffer's position.\n *\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.position = function() {\n return this.position_;\n};\n\n/**\n * Set the buffer's position.\n *\n * @param {number} position\n */\nflatbuffers.ByteBuffer.prototype.setPosition = function(position) {\n this.position_ = position;\n};\n\n/**\n * Get the buffer's capacity.\n *\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.capacity = function() {\n return this.bytes_.length;\n};\n\n/**\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.readInt8 = function(offset) {\n return this.readUint8(offset) << 24 >> 24;\n};\n\n/**\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.readUint8 = function(offset) {\n return this.bytes_[offset];\n};\n\n/**\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.readInt16 = function(offset) {\n return this.readUint16(offset) << 16 >> 16;\n};\n\n/**\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.readUint16 = function(offset) {\n return this.bytes_[offset] | this.bytes_[offset + 1] << 8;\n};\n\n/**\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.readInt32 = function(offset) {\n return this.bytes_[offset] | this.bytes_[offset + 1] << 8 | this.bytes_[offset + 2] << 16 | this.bytes_[offset + 3] << 24;\n};\n\n/**\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.readUint32 = function(offset) {\n return this.readInt32(offset) >>> 0;\n};\n\n/**\n * @param {number} offset\n * @returns {!flatbuffers.Long}\n */\nflatbuffers.ByteBuffer.prototype.readInt64 = function(offset) {\n return new flatbuffers.Long(this.readInt32(offset), this.readInt32(offset + 4));\n};\n\n/**\n * @param {number} offset\n * @returns {!flatbuffers.Long}\n */\nflatbuffers.ByteBuffer.prototype.readUint64 = function(offset) {\n return new flatbuffers.Long(this.readUint32(offset), this.readUint32(offset + 4));\n};\n\n/**\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.readFloat32 = function(offset) {\n flatbuffers.int32[0] = this.readInt32(offset);\n return flatbuffers.float32[0];\n};\n\n/**\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.readFloat64 = function(offset) {\n flatbuffers.int32[flatbuffers.isLittleEndian ? 0 : 1] = this.readInt32(offset);\n flatbuffers.int32[flatbuffers.isLittleEndian ? 1 : 0] = this.readInt32(offset + 4);\n return flatbuffers.float64[0];\n};\n\n/**\n * @param {number} offset\n * @param {number|boolean} value\n */\nflatbuffers.ByteBuffer.prototype.writeInt8 = function(offset, value) {\n this.bytes_[offset] = /** @type {number} */(value);\n};\n\n/**\n * @param {number} offset\n * @param {number} value\n */\nflatbuffers.ByteBuffer.prototype.writeUint8 = function(offset, value) {\n this.bytes_[offset] = value;\n};\n\n/**\n * @param {number} offset\n * @param {number} value\n */\nflatbuffers.ByteBuffer.prototype.writeInt16 = function(offset, value) {\n this.bytes_[offset] = value;\n this.bytes_[offset + 1] = value >> 8;\n};\n\n/**\n * @param {number} offset\n * @param {number} value\n */\nflatbuffers.ByteBuffer.prototype.writeUint16 = function(offset, value) {\n this.bytes_[offset] = value;\n this.bytes_[offset + 1] = value >> 8;\n};\n\n/**\n * @param {number} offset\n * @param {number} value\n */\nflatbuffers.ByteBuffer.prototype.writeInt32 = function(offset, value) {\n this.bytes_[offset] = value;\n this.bytes_[offset + 1] = value >> 8;\n this.bytes_[offset + 2] = value >> 16;\n this.bytes_[offset + 3] = value >> 24;\n};\n\n/**\n * @param {number} offset\n * @param {number} value\n */\nflatbuffers.ByteBuffer.prototype.writeUint32 = function(offset, value) {\n this.bytes_[offset] = value;\n this.bytes_[offset + 1] = value >> 8;\n this.bytes_[offset + 2] = value >> 16;\n this.bytes_[offset + 3] = value >> 24;\n};\n\n/**\n * @param {number} offset\n * @param {flatbuffers.Long} value\n */\nflatbuffers.ByteBuffer.prototype.writeInt64 = function(offset, value) {\n this.writeInt32(offset, value.low);\n this.writeInt32(offset + 4, value.high);\n};\n\n/**\n * @param {number} offset\n * @param {flatbuffers.Long} value\n */\nflatbuffers.ByteBuffer.prototype.writeUint64 = function(offset, value) {\n this.writeUint32(offset, value.low);\n this.writeUint32(offset + 4, value.high);\n};\n\n/**\n * @param {number} offset\n * @param {number} value\n */\nflatbuffers.ByteBuffer.prototype.writeFloat32 = function(offset, value) {\n flatbuffers.float32[0] = value;\n this.writeInt32(offset, flatbuffers.int32[0]);\n};\n\n/**\n * @param {number} offset\n * @param {number} value\n */\nflatbuffers.ByteBuffer.prototype.writeFloat64 = function(offset, value) {\n flatbuffers.float64[0] = value;\n this.writeInt32(offset, flatbuffers.int32[flatbuffers.isLittleEndian ? 0 : 1]);\n this.writeInt32(offset + 4, flatbuffers.int32[flatbuffers.isLittleEndian ? 1 : 0]);\n};\n\n/**\n * Return the file identifier. Behavior is undefined for FlatBuffers whose\n * schema does not include a file_identifier (likely points at padding or the\n * start of a the root vtable).\n * @returns {string}\n */\nflatbuffers.ByteBuffer.prototype.getBufferIdentifier = function() {\n if (this.bytes_.length < this.position_ + flatbuffers.SIZEOF_INT +\n flatbuffers.FILE_IDENTIFIER_LENGTH) {\n throw new Error(\n 'FlatBuffers: ByteBuffer is too short to contain an identifier.');\n }\n var result = \"\";\n for (var i = 0; i < flatbuffers.FILE_IDENTIFIER_LENGTH; i++) {\n result += String.fromCharCode(\n this.readInt8(this.position_ + flatbuffers.SIZEOF_INT + i));\n }\n return result;\n};\n\n/**\n * Look up a field in the vtable, return an offset into the object, or 0 if the\n * field is not present.\n *\n * @param {number} bb_pos\n * @param {number} vtable_offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.__offset = function(bb_pos, vtable_offset) {\n var vtable = bb_pos - this.readInt32(bb_pos);\n return vtable_offset < this.readInt16(vtable) ? this.readInt16(vtable + vtable_offset) : 0;\n};\n\n/**\n * Initialize any Table-derived type to point to the union at the given offset.\n *\n * @param {flatbuffers.Table} t\n * @param {number} offset\n * @returns {flatbuffers.Table}\n */\nflatbuffers.ByteBuffer.prototype.__union = function(t, offset) {\n t.bb_pos = offset + this.readInt32(offset);\n t.bb = this;\n return t;\n};\n\n/**\n * Create a JavaScript string from UTF-8 data stored inside the FlatBuffer.\n * This allocates a new string and converts to wide chars upon each access.\n *\n * To avoid the conversion to UTF-16, pass flatbuffers.Encoding.UTF8_BYTES as\n * the \"optionalEncoding\" argument. This is useful for avoiding conversion to\n * and from UTF-16 when the data will just be packaged back up in another\n * FlatBuffer later on.\n *\n * @param {number} offset\n * @param {flatbuffers.Encoding=} opt_encoding Defaults to UTF16_STRING\n * @returns {string|!Uint8Array}\n */\nflatbuffers.ByteBuffer.prototype.__string = function(offset, opt_encoding) {\n offset += this.readInt32(offset);\n\n var length = this.readInt32(offset);\n var result = '';\n var i = 0;\n\n offset += flatbuffers.SIZEOF_INT;\n\n if (opt_encoding === flatbuffers.Encoding.UTF8_BYTES) {\n return this.bytes_.subarray(offset, offset + length);\n }\n\n while (i < length) {\n var codePoint;\n\n // Decode UTF-8\n var a = this.readUint8(offset + i++);\n if (a < 0xC0) {\n codePoint = a;\n } else {\n var b = this.readUint8(offset + i++);\n if (a < 0xE0) {\n codePoint =\n ((a & 0x1F) << 6) |\n (b & 0x3F);\n } else {\n var c = this.readUint8(offset + i++);\n if (a < 0xF0) {\n codePoint =\n ((a & 0x0F) << 12) |\n ((b & 0x3F) << 6) |\n (c & 0x3F);\n } else {\n var d = this.readUint8(offset + i++);\n codePoint =\n ((a & 0x07) << 18) |\n ((b & 0x3F) << 12) |\n ((c & 0x3F) << 6) |\n (d & 0x3F);\n }\n }\n }\n\n // Encode UTF-16\n if (codePoint < 0x10000) {\n result += String.fromCharCode(codePoint);\n } else {\n codePoint -= 0x10000;\n result += String.fromCharCode(\n (codePoint >> 10) + 0xD800,\n (codePoint & ((1 << 10) - 1)) + 0xDC00);\n }\n }\n\n return result;\n};\n\n/**\n * Retrieve the relative offset stored at \"offset\"\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.__indirect = function(offset) {\n return offset + this.readInt32(offset);\n};\n\n/**\n * Get the start of data of a vector whose offset is stored at \"offset\" in this object.\n *\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.__vector = function(offset) {\n return offset + this.readInt32(offset) + flatbuffers.SIZEOF_INT; // data starts after the length\n};\n\n/**\n * Get the length of a vector whose offset is stored at \"offset\" in this object.\n *\n * @param {number} offset\n * @returns {number}\n */\nflatbuffers.ByteBuffer.prototype.__vector_len = function(offset) {\n return this.readInt32(offset + this.readInt32(offset));\n};\n\n/**\n * @param {string} ident\n * @returns {boolean}\n */\nflatbuffers.ByteBuffer.prototype.__has_identifier = function(ident) {\n if (ident.length != flatbuffers.FILE_IDENTIFIER_LENGTH) {\n throw new Error('FlatBuffers: file identifier must be length ' +\n flatbuffers.FILE_IDENTIFIER_LENGTH);\n }\n for (var i = 0; i < flatbuffers.FILE_IDENTIFIER_LENGTH; i++) {\n if (ident.charCodeAt(i) != this.readInt8(this.position_ + flatbuffers.SIZEOF_INT + i)) {\n return false;\n }\n }\n return true;\n};\n\n/**\n * A helper function to avoid generated code depending on this file directly.\n *\n * @param {number} low\n * @param {number} high\n * @returns {!flatbuffers.Long}\n */\nflatbuffers.ByteBuffer.prototype.createLong = function(low, high) {\n return flatbuffers.Long.create(low, high);\n};\n\n// Exports for Node.js and RequireJS\nexport { flatbuffers };\n\n/// @endcond\n/// @}\n","// automatically generated by the FlatBuffers compiler, do not modify\n/* eslint-disable */\n\nimport {flatbuffers} from 'flatbuffers';\n\n/**\n * @enum {number}\n */\nexport namespace onnxruntime.experimental.fbs {\n export enum AttributeType {\n UNDEFINED = 0,\n FLOAT = 1,\n INT = 2,\n STRING = 3,\n TENSOR = 4,\n GRAPH = 5,\n FLOATS = 6,\n INTS = 7,\n STRINGS = 8,\n TENSORS = 9,\n GRAPHS = 10,\n SPARSE_TENSOR = 11,\n SPARSE_TENSORS = 12\n }\n}\n\n/**\n * @enum {number}\n */\nexport namespace onnxruntime.experimental.fbs {\n export enum DimensionValueType {UNKNOWN = 0, VALUE = 1, PARAM = 2}\n}\n\n/**\n * @enum {number}\n */\nexport namespace onnxruntime.experimental.fbs {\n export enum TensorDataType {\n UNDEFINED = 0,\n FLOAT = 1,\n UINT8 = 2,\n INT8 = 3,\n UINT16 = 4,\n INT16 = 5,\n INT32 = 6,\n INT64 = 7,\n STRING = 8,\n BOOL = 9,\n FLOAT16 = 10,\n DOUBLE = 11,\n UINT32 = 12,\n UINT64 = 13,\n COMPLEX64 = 14,\n COMPLEX128 = 15,\n BFLOAT16 = 16,\n FLOAT8E4M3FN = 17,\n FLOAT8E4M3FNUZ = 18,\n FLOAT8E5M2 = 19,\n FLOAT8E5M2FNUZ = 20,\n }\n}\n\n/**\n * @enum {number}\n */\nexport namespace onnxruntime.experimental.fbs {\n export enum NodeType {Primitive = 0, Fused = 1}\n}\n\n/**\n * @enum {number}\n */\nexport namespace onnxruntime.experimental.fbs {\n export enum TypeInfoValue {NONE = 0, tensor_type = 1, sequence_type = 2, map_type = 3}\n}\n\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class Shape {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Shape\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Shape {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Shape= obj\n * @returns Shape\n */\n static getRootAsShape(bb: flatbuffers.ByteBuffer, obj?: Shape): Shape {\n return (obj || new Shape()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Shape= obj\n * @returns Shape\n */\n static getSizePrefixedRootAsShape(bb: flatbuffers.ByteBuffer, obj?: Shape): Shape {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new Shape()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param number index\n * @param onnxruntime.experimental.fbs.Dimension= obj\n * @returns onnxruntime.experimental.fbs.Dimension\n */\n dim(index: number, obj?: onnxruntime.experimental.fbs.Dimension): onnxruntime.experimental.fbs.Dimension|null {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? (obj || new onnxruntime.experimental.fbs.Dimension())\n .__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) :\n null;\n }\n\n /**\n * @returns number\n */\n dimLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startShape(builder: flatbuffers.Builder) {\n builder.startObject(1);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset dimOffset\n */\n static addDim(builder: flatbuffers.Builder, dimOffset: flatbuffers.Offset) {\n builder.addFieldOffset(0, dimOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createDimVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startDimVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endShape(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createShape(builder: flatbuffers.Builder, dimOffset: flatbuffers.Offset): flatbuffers.Offset {\n Shape.startShape(builder);\n Shape.addDim(builder, dimOffset);\n return Shape.endShape(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class Dimension {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Dimension\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Dimension {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Dimension= obj\n * @returns Dimension\n */\n static getRootAsDimension(bb: flatbuffers.ByteBuffer, obj?: Dimension): Dimension {\n return (obj || new Dimension()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Dimension= obj\n * @returns Dimension\n */\n static getSizePrefixedRootAsDimension(bb: flatbuffers.ByteBuffer, obj?: Dimension): Dimension {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new Dimension()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param onnxruntime.experimental.fbs.DimensionValue= obj\n * @returns onnxruntime.experimental.fbs.DimensionValue|null\n */\n value(obj?: onnxruntime.experimental.fbs.DimensionValue): onnxruntime.experimental.fbs.DimensionValue|null {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? (obj || new onnxruntime.experimental.fbs.DimensionValue())\n .__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) :\n null;\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n denotation(): string|null;\n denotation(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n denotation(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startDimension(builder: flatbuffers.Builder) {\n builder.startObject(2);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset valueOffset\n */\n static addValue(builder: flatbuffers.Builder, valueOffset: flatbuffers.Offset) {\n builder.addFieldOffset(0, valueOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset denotationOffset\n */\n static addDenotation(builder: flatbuffers.Builder, denotationOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, denotationOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endDimension(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createDimension(\n builder: flatbuffers.Builder, valueOffset: flatbuffers.Offset,\n denotationOffset: flatbuffers.Offset): flatbuffers.Offset {\n Dimension.startDimension(builder);\n Dimension.addValue(builder, valueOffset);\n Dimension.addDenotation(builder, denotationOffset);\n return Dimension.endDimension(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class DimensionValue {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns DimensionValue\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): DimensionValue {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param DimensionValue= obj\n * @returns DimensionValue\n */\n static getRootAsDimensionValue(bb: flatbuffers.ByteBuffer, obj?: DimensionValue): DimensionValue {\n return (obj || new DimensionValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param DimensionValue= obj\n * @returns DimensionValue\n */\n static getSizePrefixedRootAsDimensionValue(bb: flatbuffers.ByteBuffer, obj?: DimensionValue): DimensionValue {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new DimensionValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @returns onnxruntime.experimental.fbs.DimensionValueType\n */\n dimType(): onnxruntime.experimental.fbs.DimensionValueType {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? /** */ (this.bb!.readInt8(this.bb_pos + offset)) :\n onnxruntime.experimental.fbs.DimensionValueType.UNKNOWN;\n }\n\n /**\n * @returns flatbuffers.Long\n */\n dimValue(): flatbuffers.Long {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.readInt64(this.bb_pos + offset) : this.bb!.createLong(0, 0);\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n dimParam(): string|null;\n dimParam(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n dimParam(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startDimensionValue(builder: flatbuffers.Builder) {\n builder.startObject(3);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param onnxruntime.experimental.fbs.DimensionValueType dimType\n */\n static addDimType(builder: flatbuffers.Builder, dimType: onnxruntime.experimental.fbs.DimensionValueType) {\n builder.addFieldInt8(0, dimType, onnxruntime.experimental.fbs.DimensionValueType.UNKNOWN);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Long dimValue\n */\n static addDimValue(builder: flatbuffers.Builder, dimValue: flatbuffers.Long) {\n builder.addFieldInt64(1, dimValue, builder.createLong(0, 0));\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset dimParamOffset\n */\n static addDimParam(builder: flatbuffers.Builder, dimParamOffset: flatbuffers.Offset) {\n builder.addFieldOffset(2, dimParamOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endDimensionValue(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createDimensionValue(\n builder: flatbuffers.Builder, dimType: onnxruntime.experimental.fbs.DimensionValueType,\n dimValue: flatbuffers.Long, dimParamOffset: flatbuffers.Offset): flatbuffers.Offset {\n DimensionValue.startDimensionValue(builder);\n DimensionValue.addDimType(builder, dimType);\n DimensionValue.addDimValue(builder, dimValue);\n DimensionValue.addDimParam(builder, dimParamOffset);\n return DimensionValue.endDimensionValue(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class TensorTypeAndShape {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns TensorTypeAndShape\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): TensorTypeAndShape {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param TensorTypeAndShape= obj\n * @returns TensorTypeAndShape\n */\n static getRootAsTensorTypeAndShape(bb: flatbuffers.ByteBuffer, obj?: TensorTypeAndShape): TensorTypeAndShape {\n return (obj || new TensorTypeAndShape()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param TensorTypeAndShape= obj\n * @returns TensorTypeAndShape\n */\n static getSizePrefixedRootAsTensorTypeAndShape(bb: flatbuffers.ByteBuffer, obj?: TensorTypeAndShape):\n TensorTypeAndShape {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new TensorTypeAndShape()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @returns onnxruntime.experimental.fbs.TensorDataType\n */\n elemType(): onnxruntime.experimental.fbs.TensorDataType {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? /** */ (this.bb!.readInt32(this.bb_pos + offset)) :\n onnxruntime.experimental.fbs.TensorDataType.UNDEFINED;\n }\n\n /**\n * @param onnxruntime.experimental.fbs.Shape= obj\n * @returns onnxruntime.experimental.fbs.Shape|null\n */\n shape(obj?: onnxruntime.experimental.fbs.Shape): onnxruntime.experimental.fbs.Shape|null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? (obj || new onnxruntime.experimental.fbs.Shape())\n .__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) :\n null;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startTensorTypeAndShape(builder: flatbuffers.Builder) {\n builder.startObject(2);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param onnxruntime.experimental.fbs.TensorDataType elemType\n */\n static addElemType(builder: flatbuffers.Builder, elemType: onnxruntime.experimental.fbs.TensorDataType) {\n builder.addFieldInt32(0, elemType, onnxruntime.experimental.fbs.TensorDataType.UNDEFINED);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset shapeOffset\n */\n static addShape(builder: flatbuffers.Builder, shapeOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, shapeOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endTensorTypeAndShape(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createTensorTypeAndShape(\n builder: flatbuffers.Builder, elemType: onnxruntime.experimental.fbs.TensorDataType,\n shapeOffset: flatbuffers.Offset): flatbuffers.Offset {\n TensorTypeAndShape.startTensorTypeAndShape(builder);\n TensorTypeAndShape.addElemType(builder, elemType);\n TensorTypeAndShape.addShape(builder, shapeOffset);\n return TensorTypeAndShape.endTensorTypeAndShape(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class MapType {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns MapType\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): MapType {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param MapType= obj\n * @returns MapType\n */\n static getRootAsMapType(bb: flatbuffers.ByteBuffer, obj?: MapType): MapType {\n return (obj || new MapType()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param MapType= obj\n * @returns MapType\n */\n static getSizePrefixedRootAsMapType(bb: flatbuffers.ByteBuffer, obj?: MapType): MapType {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new MapType()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @returns onnxruntime.experimental.fbs.TensorDataType\n */\n keyType(): onnxruntime.experimental.fbs.TensorDataType {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? /** */ (this.bb!.readInt32(this.bb_pos + offset)) :\n onnxruntime.experimental.fbs.TensorDataType.UNDEFINED;\n }\n\n /**\n * @param onnxruntime.experimental.fbs.TypeInfo= obj\n * @returns onnxruntime.experimental.fbs.TypeInfo|null\n */\n valueType(obj?: onnxruntime.experimental.fbs.TypeInfo): onnxruntime.experimental.fbs.TypeInfo|null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? (obj || new onnxruntime.experimental.fbs.TypeInfo())\n .__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) :\n null;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startMapType(builder: flatbuffers.Builder) {\n builder.startObject(2);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param onnxruntime.experimental.fbs.TensorDataType keyType\n */\n static addKeyType(builder: flatbuffers.Builder, keyType: onnxruntime.experimental.fbs.TensorDataType) {\n builder.addFieldInt32(0, keyType, onnxruntime.experimental.fbs.TensorDataType.UNDEFINED);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset valueTypeOffset\n */\n static addValueType(builder: flatbuffers.Builder, valueTypeOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, valueTypeOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endMapType(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createMapType(\n builder: flatbuffers.Builder, keyType: onnxruntime.experimental.fbs.TensorDataType,\n valueTypeOffset: flatbuffers.Offset): flatbuffers.Offset {\n MapType.startMapType(builder);\n MapType.addKeyType(builder, keyType);\n MapType.addValueType(builder, valueTypeOffset);\n return MapType.endMapType(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class SequenceType {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns SequenceType\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): SequenceType {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param SequenceType= obj\n * @returns SequenceType\n */\n static getRootAsSequenceType(bb: flatbuffers.ByteBuffer, obj?: SequenceType): SequenceType {\n return (obj || new SequenceType()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param SequenceType= obj\n * @returns SequenceType\n */\n static getSizePrefixedRootAsSequenceType(bb: flatbuffers.ByteBuffer, obj?: SequenceType): SequenceType {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new SequenceType()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param onnxruntime.experimental.fbs.TypeInfo= obj\n * @returns onnxruntime.experimental.fbs.TypeInfo|null\n */\n elemType(obj?: onnxruntime.experimental.fbs.TypeInfo): onnxruntime.experimental.fbs.TypeInfo|null {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? (obj || new onnxruntime.experimental.fbs.TypeInfo())\n .__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) :\n null;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startSequenceType(builder: flatbuffers.Builder) {\n builder.startObject(1);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset elemTypeOffset\n */\n static addElemType(builder: flatbuffers.Builder, elemTypeOffset: flatbuffers.Offset) {\n builder.addFieldOffset(0, elemTypeOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endSequenceType(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createSequenceType(builder: flatbuffers.Builder, elemTypeOffset: flatbuffers.Offset): flatbuffers.Offset {\n SequenceType.startSequenceType(builder);\n SequenceType.addElemType(builder, elemTypeOffset);\n return SequenceType.endSequenceType(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class EdgeEnd {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns EdgeEnd\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): EdgeEnd {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @returns number\n */\n nodeIndex(): number {\n return this.bb!.readUint32(this.bb_pos);\n }\n\n /**\n * @returns number\n */\n srcArgIndex(): number {\n return this.bb!.readInt32(this.bb_pos + 4);\n }\n\n /**\n * @returns number\n */\n dstArgIndex(): number {\n return this.bb!.readInt32(this.bb_pos + 8);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number node_index\n * @param number src_arg_index\n * @param number dst_arg_index\n * @returns flatbuffers.Offset\n */\n static createEdgeEnd(\n builder: flatbuffers.Builder, node_index: number, src_arg_index: number,\n dst_arg_index: number): flatbuffers.Offset {\n builder.prep(4, 12);\n builder.writeInt32(dst_arg_index);\n builder.writeInt32(src_arg_index);\n builder.writeInt32(node_index);\n return builder.offset();\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class NodeEdge {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns NodeEdge\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): NodeEdge {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param NodeEdge= obj\n * @returns NodeEdge\n */\n static getRootAsNodeEdge(bb: flatbuffers.ByteBuffer, obj?: NodeEdge): NodeEdge {\n return (obj || new NodeEdge()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param NodeEdge= obj\n * @returns NodeEdge\n */\n static getSizePrefixedRootAsNodeEdge(bb: flatbuffers.ByteBuffer, obj?: NodeEdge): NodeEdge {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new NodeEdge()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @returns number\n */\n nodeIndex(): number {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param number index\n * @param onnxruntime.experimental.fbs.EdgeEnd= obj\n * @returns onnxruntime.experimental.fbs.EdgeEnd\n */\n inputEdges(index: number, obj?: onnxruntime.experimental.fbs.EdgeEnd): onnxruntime.experimental.fbs.EdgeEnd|null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? (obj || new onnxruntime.experimental.fbs.EdgeEnd())\n .__init(this.bb!.__vector(this.bb_pos + offset) + index * 12, this.bb!) :\n null;\n }\n\n /**\n * @returns number\n */\n inputEdgesLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param number index\n * @param onnxruntime.experimental.fbs.EdgeEnd= obj\n * @returns onnxruntime.experimental.fbs.EdgeEnd\n */\n outputEdges(index: number, obj?: onnxruntime.experimental.fbs.EdgeEnd): onnxruntime.experimental.fbs.EdgeEnd|null {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? (obj || new onnxruntime.experimental.fbs.EdgeEnd())\n .__init(this.bb!.__vector(this.bb_pos + offset) + index * 12, this.bb!) :\n null;\n }\n\n /**\n * @returns number\n */\n outputEdgesLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startNodeEdge(builder: flatbuffers.Builder) {\n builder.startObject(3);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number nodeIndex\n */\n static addNodeIndex(builder: flatbuffers.Builder, nodeIndex: number) {\n builder.addFieldInt32(0, nodeIndex, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset inputEdgesOffset\n */\n static addInputEdges(builder: flatbuffers.Builder, inputEdgesOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, inputEdgesOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startInputEdgesVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(12, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset outputEdgesOffset\n */\n static addOutputEdges(builder: flatbuffers.Builder, outputEdgesOffset: flatbuffers.Offset) {\n builder.addFieldOffset(2, outputEdgesOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startOutputEdgesVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(12, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endNodeEdge(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createNodeEdge(\n builder: flatbuffers.Builder, nodeIndex: number, inputEdgesOffset: flatbuffers.Offset,\n outputEdgesOffset: flatbuffers.Offset): flatbuffers.Offset {\n NodeEdge.startNodeEdge(builder);\n NodeEdge.addNodeIndex(builder, nodeIndex);\n NodeEdge.addInputEdges(builder, inputEdgesOffset);\n NodeEdge.addOutputEdges(builder, outputEdgesOffset);\n return NodeEdge.endNodeEdge(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class Node {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Node\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Node {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Node= obj\n * @returns Node\n */\n static getRootAsNode(bb: flatbuffers.ByteBuffer, obj?: Node): Node {\n return (obj || new Node()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Node= obj\n * @returns Node\n */\n static getSizePrefixedRootAsNode(bb: flatbuffers.ByteBuffer, obj?: Node): Node {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new Node()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n name(): string|null;\n name(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n name(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n docString(): string|null;\n docString(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n docString(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n domain(): string|null;\n domain(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n domain(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @returns number\n */\n sinceVersion(): number {\n let offset = this.bb!.__offset(this.bb_pos, 10);\n return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;\n }\n\n /**\n * @returns number\n */\n index(): number {\n let offset = this.bb!.__offset(this.bb_pos, 12);\n return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n opType(): string|null;\n opType(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n opType(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 14);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @returns onnxruntime.experimental.fbs.NodeType\n */\n type(): onnxruntime.experimental.fbs.NodeType {\n let offset = this.bb!.__offset(this.bb_pos, 16);\n return offset ? /** */ (this.bb!.readInt32(this.bb_pos + offset)) :\n onnxruntime.experimental.fbs.NodeType.Primitive;\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n executionProviderType(): string|null;\n executionProviderType(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n executionProviderType(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 18);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param number index\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array\n */\n inputs(index: number): string;\n inputs(index: number, optionalEncoding: flatbuffers.Encoding): string|Uint8Array;\n inputs(index: number, optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 20);\n return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;\n }\n\n /**\n * @returns number\n */\n inputsLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 20);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param number index\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array\n */\n outputs(index: number): string;\n outputs(index: number, optionalEncoding: flatbuffers.Encoding): string|Uint8Array;\n outputs(index: number, optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 22);\n return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;\n }\n\n /**\n * @returns number\n */\n outputsLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 22);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param number index\n * @param onnxruntime.experimental.fbs.Attribute= obj\n * @returns onnxruntime.experimental.fbs.Attribute\n */\n attributes(index: number, obj?: onnxruntime.experimental.fbs.Attribute): onnxruntime.experimental.fbs.Attribute\n |null {\n let offset = this.bb!.__offset(this.bb_pos, 24);\n return offset ? (obj || new onnxruntime.experimental.fbs.Attribute())\n .__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) :\n null;\n }\n\n /**\n * @returns number\n */\n attributesLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 24);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param number index\n * @returns number\n */\n inputArgCounts(index: number): number|null {\n let offset = this.bb!.__offset(this.bb_pos, 26);\n return offset ? this.bb!.readInt32(this.bb!.__vector(this.bb_pos + offset) + index * 4) : 0;\n }\n\n /**\n * @returns number\n */\n inputArgCountsLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 26);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @returns Int32Array\n */\n inputArgCountsArray(): Int32Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 26);\n return offset ?\n new Int32Array(\n this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset),\n this.bb!.__vector_len(this.bb_pos + offset)) :\n null;\n }\n\n /**\n * @param number index\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array\n */\n implicitInputs(index: number): string;\n implicitInputs(index: number, optionalEncoding: flatbuffers.Encoding): string|Uint8Array;\n implicitInputs(index: number, optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 28);\n return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;\n }\n\n /**\n * @returns number\n */\n implicitInputsLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 28);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startNode(builder: flatbuffers.Builder) {\n builder.startObject(13);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset nameOffset\n */\n static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset) {\n builder.addFieldOffset(0, nameOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset docStringOffset\n */\n static addDocString(builder: flatbuffers.Builder, docStringOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, docStringOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset domainOffset\n */\n static addDomain(builder: flatbuffers.Builder, domainOffset: flatbuffers.Offset) {\n builder.addFieldOffset(2, domainOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number sinceVersion\n */\n static addSinceVersion(builder: flatbuffers.Builder, sinceVersion: number) {\n builder.addFieldInt32(3, sinceVersion, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number index\n */\n static addIndex(builder: flatbuffers.Builder, index: number) {\n builder.addFieldInt32(4, index, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset opTypeOffset\n */\n static addOpType(builder: flatbuffers.Builder, opTypeOffset: flatbuffers.Offset) {\n builder.addFieldOffset(5, opTypeOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param onnxruntime.experimental.fbs.NodeType type\n */\n static addType(builder: flatbuffers.Builder, type: onnxruntime.experimental.fbs.NodeType) {\n builder.addFieldInt32(6, type, onnxruntime.experimental.fbs.NodeType.Primitive);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset executionProviderTypeOffset\n */\n static addExecutionProviderType(builder: flatbuffers.Builder, executionProviderTypeOffset: flatbuffers.Offset) {\n builder.addFieldOffset(7, executionProviderTypeOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset inputsOffset\n */\n static addInputs(builder: flatbuffers.Builder, inputsOffset: flatbuffers.Offset) {\n builder.addFieldOffset(8, inputsOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createInputsVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startInputsVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset outputsOffset\n */\n static addOutputs(builder: flatbuffers.Builder, outputsOffset: flatbuffers.Offset) {\n builder.addFieldOffset(9, outputsOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createOutputsVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startOutputsVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset attributesOffset\n */\n static addAttributes(builder: flatbuffers.Builder, attributesOffset: flatbuffers.Offset) {\n builder.addFieldOffset(10, attributesOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createAttributesVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startAttributesVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset inputArgCountsOffset\n */\n static addInputArgCounts(builder: flatbuffers.Builder, inputArgCountsOffset: flatbuffers.Offset) {\n builder.addFieldOffset(11, inputArgCountsOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createInputArgCountsVector(builder: flatbuffers.Builder, data: number[]|Uint8Array): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addInt32(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startInputArgCountsVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset implicitInputsOffset\n */\n static addImplicitInputs(builder: flatbuffers.Builder, implicitInputsOffset: flatbuffers.Offset) {\n builder.addFieldOffset(12, implicitInputsOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createImplicitInputsVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startImplicitInputsVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endNode(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createNode(\n builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset, docStringOffset: flatbuffers.Offset,\n domainOffset: flatbuffers.Offset, sinceVersion: number, index: number, opTypeOffset: flatbuffers.Offset,\n type: onnxruntime.experimental.fbs.NodeType, executionProviderTypeOffset: flatbuffers.Offset,\n inputsOffset: flatbuffers.Offset, outputsOffset: flatbuffers.Offset, attributesOffset: flatbuffers.Offset,\n inputArgCountsOffset: flatbuffers.Offset, implicitInputsOffset: flatbuffers.Offset): flatbuffers.Offset {\n Node.startNode(builder);\n Node.addName(builder, nameOffset);\n Node.addDocString(builder, docStringOffset);\n Node.addDomain(builder, domainOffset);\n Node.addSinceVersion(builder, sinceVersion);\n Node.addIndex(builder, index);\n Node.addOpType(builder, opTypeOffset);\n Node.addType(builder, type);\n Node.addExecutionProviderType(builder, executionProviderTypeOffset);\n Node.addInputs(builder, inputsOffset);\n Node.addOutputs(builder, outputsOffset);\n Node.addAttributes(builder, attributesOffset);\n Node.addInputArgCounts(builder, inputArgCountsOffset);\n Node.addImplicitInputs(builder, implicitInputsOffset);\n return Node.endNode(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class ValueInfo {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns ValueInfo\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): ValueInfo {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param ValueInfo= obj\n * @returns ValueInfo\n */\n static getRootAsValueInfo(bb: flatbuffers.ByteBuffer, obj?: ValueInfo): ValueInfo {\n return (obj || new ValueInfo()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param ValueInfo= obj\n * @returns ValueInfo\n */\n static getSizePrefixedRootAsValueInfo(bb: flatbuffers.ByteBuffer, obj?: ValueInfo): ValueInfo {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new ValueInfo()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n name(): string|null;\n name(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n name(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n docString(): string|null;\n docString(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n docString(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param onnxruntime.experimental.fbs.TypeInfo= obj\n * @returns onnxruntime.experimental.fbs.TypeInfo|null\n */\n type(obj?: onnxruntime.experimental.fbs.TypeInfo): onnxruntime.experimental.fbs.TypeInfo|null {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? (obj || new onnxruntime.experimental.fbs.TypeInfo())\n .__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) :\n null;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startValueInfo(builder: flatbuffers.Builder) {\n builder.startObject(3);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset nameOffset\n */\n static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset) {\n builder.addFieldOffset(0, nameOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset docStringOffset\n */\n static addDocString(builder: flatbuffers.Builder, docStringOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, docStringOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset typeOffset\n */\n static addType(builder: flatbuffers.Builder, typeOffset: flatbuffers.Offset) {\n builder.addFieldOffset(2, typeOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endValueInfo(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createValueInfo(\n builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset, docStringOffset: flatbuffers.Offset,\n typeOffset: flatbuffers.Offset): flatbuffers.Offset {\n ValueInfo.startValueInfo(builder);\n ValueInfo.addName(builder, nameOffset);\n ValueInfo.addDocString(builder, docStringOffset);\n ValueInfo.addType(builder, typeOffset);\n return ValueInfo.endValueInfo(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class TypeInfo {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns TypeInfo\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): TypeInfo {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param TypeInfo= obj\n * @returns TypeInfo\n */\n static getRootAsTypeInfo(bb: flatbuffers.ByteBuffer, obj?: TypeInfo): TypeInfo {\n return (obj || new TypeInfo()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param TypeInfo= obj\n * @returns TypeInfo\n */\n static getSizePrefixedRootAsTypeInfo(bb: flatbuffers.ByteBuffer, obj?: TypeInfo): TypeInfo {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new TypeInfo()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n denotation(): string|null;\n denotation(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n denotation(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @returns onnxruntime.experimental.fbs.TypeInfoValue\n */\n valueType(): onnxruntime.experimental.fbs.TypeInfoValue {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? /** */ (this.bb!.readUint8(this.bb_pos + offset)) :\n onnxruntime.experimental.fbs.TypeInfoValue.NONE;\n }\n\n /**\n * @param flatbuffers.Table obj\n * @returns ?flatbuffers.Table\n */\n value(obj: T): T|null {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startTypeInfo(builder: flatbuffers.Builder) {\n builder.startObject(3);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset denotationOffset\n */\n static addDenotation(builder: flatbuffers.Builder, denotationOffset: flatbuffers.Offset) {\n builder.addFieldOffset(0, denotationOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param onnxruntime.experimental.fbs.TypeInfoValue valueType\n */\n static addValueType(builder: flatbuffers.Builder, valueType: onnxruntime.experimental.fbs.TypeInfoValue) {\n builder.addFieldInt8(1, valueType, onnxruntime.experimental.fbs.TypeInfoValue.NONE);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset valueOffset\n */\n static addValue(builder: flatbuffers.Builder, valueOffset: flatbuffers.Offset) {\n builder.addFieldOffset(2, valueOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endTypeInfo(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createTypeInfo(\n builder: flatbuffers.Builder, denotationOffset: flatbuffers.Offset,\n valueType: onnxruntime.experimental.fbs.TypeInfoValue, valueOffset: flatbuffers.Offset): flatbuffers.Offset {\n TypeInfo.startTypeInfo(builder);\n TypeInfo.addDenotation(builder, denotationOffset);\n TypeInfo.addValueType(builder, valueType);\n TypeInfo.addValue(builder, valueOffset);\n return TypeInfo.endTypeInfo(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class OperatorSetId {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns OperatorSetId\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): OperatorSetId {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param OperatorSetId= obj\n * @returns OperatorSetId\n */\n static getRootAsOperatorSetId(bb: flatbuffers.ByteBuffer, obj?: OperatorSetId): OperatorSetId {\n return (obj || new OperatorSetId()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param OperatorSetId= obj\n * @returns OperatorSetId\n */\n static getSizePrefixedRootAsOperatorSetId(bb: flatbuffers.ByteBuffer, obj?: OperatorSetId): OperatorSetId {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new OperatorSetId()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n domain(): string|null;\n domain(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n domain(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @returns flatbuffers.Long\n */\n version(): flatbuffers.Long {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.readInt64(this.bb_pos + offset) : this.bb!.createLong(0, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startOperatorSetId(builder: flatbuffers.Builder) {\n builder.startObject(2);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset domainOffset\n */\n static addDomain(builder: flatbuffers.Builder, domainOffset: flatbuffers.Offset) {\n builder.addFieldOffset(0, domainOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Long version\n */\n static addVersion(builder: flatbuffers.Builder, version: flatbuffers.Long) {\n builder.addFieldInt64(1, version, builder.createLong(0, 0));\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endOperatorSetId(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createOperatorSetId(\n builder: flatbuffers.Builder, domainOffset: flatbuffers.Offset, version: flatbuffers.Long): flatbuffers.Offset {\n OperatorSetId.startOperatorSetId(builder);\n OperatorSetId.addDomain(builder, domainOffset);\n OperatorSetId.addVersion(builder, version);\n return OperatorSetId.endOperatorSetId(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class Tensor {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Tensor\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Tensor {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Tensor= obj\n * @returns Tensor\n */\n static getRootAsTensor(bb: flatbuffers.ByteBuffer, obj?: Tensor): Tensor {\n return (obj || new Tensor()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Tensor= obj\n * @returns Tensor\n */\n static getSizePrefixedRootAsTensor(bb: flatbuffers.ByteBuffer, obj?: Tensor): Tensor {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new Tensor()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n name(): string|null;\n name(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n name(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n docString(): string|null;\n docString(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n docString(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param number index\n * @returns flatbuffers.Long\n */\n dims(index: number): flatbuffers.Long|null {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? this.bb!.readInt64(this.bb!.__vector(this.bb_pos + offset) + index * 8) :\n this.bb!.createLong(0, 0);\n }\n\n /**\n * @returns number\n */\n dimsLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @returns onnxruntime.experimental.fbs.TensorDataType\n */\n dataType(): onnxruntime.experimental.fbs.TensorDataType {\n let offset = this.bb!.__offset(this.bb_pos, 10);\n return offset ? /** */ (this.bb!.readInt32(this.bb_pos + offset)) :\n onnxruntime.experimental.fbs.TensorDataType.UNDEFINED;\n }\n\n /**\n * @param number index\n * @returns number\n */\n rawData(index: number): number|null {\n let offset = this.bb!.__offset(this.bb_pos, 12);\n return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;\n }\n\n /**\n * @returns number\n */\n rawDataLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 12);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @returns Uint8Array\n */\n rawDataArray(): Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 12);\n return offset ?\n new Uint8Array(\n this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset),\n this.bb!.__vector_len(this.bb_pos + offset)) :\n null;\n }\n\n /**\n * @param number index\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array\n */\n stringData(index: number): string;\n stringData(index: number, optionalEncoding: flatbuffers.Encoding): string|Uint8Array;\n stringData(index: number, optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 14);\n return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;\n }\n\n /**\n * @returns number\n */\n stringDataLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 14);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startTensor(builder: flatbuffers.Builder) {\n builder.startObject(6);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset nameOffset\n */\n static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset) {\n builder.addFieldOffset(0, nameOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset docStringOffset\n */\n static addDocString(builder: flatbuffers.Builder, docStringOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, docStringOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset dimsOffset\n */\n static addDims(builder: flatbuffers.Builder, dimsOffset: flatbuffers.Offset) {\n builder.addFieldOffset(2, dimsOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createDimsVector(builder: flatbuffers.Builder, data: flatbuffers.Long[]): flatbuffers.Offset {\n builder.startVector(8, data.length, 8);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addInt64(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startDimsVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(8, numElems, 8);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param onnxruntime.experimental.fbs.TensorDataType dataType\n */\n static addDataType(builder: flatbuffers.Builder, dataType: onnxruntime.experimental.fbs.TensorDataType) {\n builder.addFieldInt32(3, dataType, onnxruntime.experimental.fbs.TensorDataType.UNDEFINED);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset rawDataOffset\n */\n static addRawData(builder: flatbuffers.Builder, rawDataOffset: flatbuffers.Offset) {\n builder.addFieldOffset(4, rawDataOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createRawDataVector(builder: flatbuffers.Builder, data: number[]|Uint8Array): flatbuffers.Offset {\n builder.startVector(1, data.length, 1);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addInt8(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startRawDataVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(1, numElems, 1);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset stringDataOffset\n */\n static addStringData(builder: flatbuffers.Builder, stringDataOffset: flatbuffers.Offset) {\n builder.addFieldOffset(5, stringDataOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createStringDataVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startStringDataVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endTensor(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createTensor(\n builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset, docStringOffset: flatbuffers.Offset,\n dimsOffset: flatbuffers.Offset, dataType: onnxruntime.experimental.fbs.TensorDataType,\n rawDataOffset: flatbuffers.Offset, stringDataOffset: flatbuffers.Offset): flatbuffers.Offset {\n Tensor.startTensor(builder);\n Tensor.addName(builder, nameOffset);\n Tensor.addDocString(builder, docStringOffset);\n Tensor.addDims(builder, dimsOffset);\n Tensor.addDataType(builder, dataType);\n Tensor.addRawData(builder, rawDataOffset);\n Tensor.addStringData(builder, stringDataOffset);\n return Tensor.endTensor(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class SparseTensor {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns SparseTensor\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): SparseTensor {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param SparseTensor= obj\n * @returns SparseTensor\n */\n static getRootAsSparseTensor(bb: flatbuffers.ByteBuffer, obj?: SparseTensor): SparseTensor {\n return (obj || new SparseTensor()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param SparseTensor= obj\n * @returns SparseTensor\n */\n static getSizePrefixedRootAsSparseTensor(bb: flatbuffers.ByteBuffer, obj?: SparseTensor): SparseTensor {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new SparseTensor()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param onnxruntime.experimental.fbs.Tensor= obj\n * @returns onnxruntime.experimental.fbs.Tensor|null\n */\n values(obj?: onnxruntime.experimental.fbs.Tensor): onnxruntime.experimental.fbs.Tensor|null {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? (obj || new onnxruntime.experimental.fbs.Tensor())\n .__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) :\n null;\n }\n\n /**\n * @param onnxruntime.experimental.fbs.Tensor= obj\n * @returns onnxruntime.experimental.fbs.Tensor|null\n */\n indices(obj?: onnxruntime.experimental.fbs.Tensor): onnxruntime.experimental.fbs.Tensor|null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? (obj || new onnxruntime.experimental.fbs.Tensor())\n .__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) :\n null;\n }\n\n /**\n * @param number index\n * @returns flatbuffers.Long\n */\n dims(index: number): flatbuffers.Long|null {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? this.bb!.readInt64(this.bb!.__vector(this.bb_pos + offset) + index * 8) :\n this.bb!.createLong(0, 0);\n }\n\n /**\n * @returns number\n */\n dimsLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startSparseTensor(builder: flatbuffers.Builder) {\n builder.startObject(3);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset valuesOffset\n */\n static addValues(builder: flatbuffers.Builder, valuesOffset: flatbuffers.Offset) {\n builder.addFieldOffset(0, valuesOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset indicesOffset\n */\n static addIndices(builder: flatbuffers.Builder, indicesOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, indicesOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset dimsOffset\n */\n static addDims(builder: flatbuffers.Builder, dimsOffset: flatbuffers.Offset) {\n builder.addFieldOffset(2, dimsOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createDimsVector(builder: flatbuffers.Builder, data: flatbuffers.Long[]): flatbuffers.Offset {\n builder.startVector(8, data.length, 8);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addInt64(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startDimsVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(8, numElems, 8);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endSparseTensor(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createSparseTensor(\n builder: flatbuffers.Builder, valuesOffset: flatbuffers.Offset, indicesOffset: flatbuffers.Offset,\n dimsOffset: flatbuffers.Offset): flatbuffers.Offset {\n SparseTensor.startSparseTensor(builder);\n SparseTensor.addValues(builder, valuesOffset);\n SparseTensor.addIndices(builder, indicesOffset);\n SparseTensor.addDims(builder, dimsOffset);\n return SparseTensor.endSparseTensor(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class Attribute {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Attribute\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Attribute {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Attribute= obj\n * @returns Attribute\n */\n static getRootAsAttribute(bb: flatbuffers.ByteBuffer, obj?: Attribute): Attribute {\n return (obj || new Attribute()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Attribute= obj\n * @returns Attribute\n */\n static getSizePrefixedRootAsAttribute(bb: flatbuffers.ByteBuffer, obj?: Attribute): Attribute {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new Attribute()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n name(): string|null;\n name(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n name(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n docString(): string|null;\n docString(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n docString(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @returns onnxruntime.experimental.fbs.AttributeType\n */\n type(): onnxruntime.experimental.fbs.AttributeType {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? /** */ (this.bb!.readInt32(this.bb_pos + offset)) :\n onnxruntime.experimental.fbs.AttributeType.UNDEFINED;\n }\n\n /**\n * @returns number\n */\n f(): number {\n let offset = this.bb!.__offset(this.bb_pos, 10);\n return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;\n }\n\n /**\n * @returns flatbuffers.Long\n */\n i(): flatbuffers.Long {\n let offset = this.bb!.__offset(this.bb_pos, 12);\n return offset ? this.bb!.readInt64(this.bb_pos + offset) : this.bb!.createLong(0, 0);\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n s(): string|null;\n s(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n s(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 14);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param onnxruntime.experimental.fbs.Tensor= obj\n * @returns onnxruntime.experimental.fbs.Tensor|null\n */\n t(obj?: onnxruntime.experimental.fbs.Tensor): onnxruntime.experimental.fbs.Tensor|null {\n let offset = this.bb!.__offset(this.bb_pos, 16);\n return offset ? (obj || new onnxruntime.experimental.fbs.Tensor())\n .__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) :\n null;\n }\n\n /**\n * @param onnxruntime.experimental.fbs.Graph= obj\n * @returns onnxruntime.experimental.fbs.Graph|null\n */\n g(obj?: onnxruntime.experimental.fbs.Graph): onnxruntime.experimental.fbs.Graph|null {\n let offset = this.bb!.__offset(this.bb_pos, 18);\n return offset ? (obj || new onnxruntime.experimental.fbs.Graph())\n .__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) :\n null;\n }\n\n /**\n * @param number index\n * @returns number\n */\n floats(index: number): number|null {\n let offset = this.bb!.__offset(this.bb_pos, 20);\n return offset ? this.bb!.readFloat32(this.bb!.__vector(this.bb_pos + offset) + index * 4) : 0;\n }\n\n /**\n * @returns number\n */\n floatsLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 20);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @returns Float32Array\n */\n floatsArray(): Float32Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 20);\n return offset ?\n new Float32Array(\n this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset),\n this.bb!.__vector_len(this.bb_pos + offset)) :\n null;\n }\n\n /**\n * @param number index\n * @returns flatbuffers.Long\n */\n ints(index: number): flatbuffers.Long|null {\n let offset = this.bb!.__offset(this.bb_pos, 22);\n return offset ? this.bb!.readInt64(this.bb!.__vector(this.bb_pos + offset) + index * 8) :\n this.bb!.createLong(0, 0);\n }\n\n /**\n * @returns number\n */\n intsLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 22);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param number index\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array\n */\n strings(index: number): string;\n strings(index: number, optionalEncoding: flatbuffers.Encoding): string|Uint8Array;\n strings(index: number, optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 24);\n return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;\n }\n\n /**\n * @returns number\n */\n stringsLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 24);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param number index\n * @param onnxruntime.experimental.fbs.Tensor= obj\n * @returns onnxruntime.experimental.fbs.Tensor\n */\n tensors(index: number, obj?: onnxruntime.experimental.fbs.Tensor): onnxruntime.experimental.fbs.Tensor|null {\n let offset = this.bb!.__offset(this.bb_pos, 26);\n return offset ? (obj || new onnxruntime.experimental.fbs.Tensor())\n .__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) :\n null;\n }\n\n /**\n * @returns number\n */\n tensorsLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 26);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param number index\n * @param onnxruntime.experimental.fbs.Graph= obj\n * @returns onnxruntime.experimental.fbs.Graph\n */\n graphs(index: number, obj?: onnxruntime.experimental.fbs.Graph): onnxruntime.experimental.fbs.Graph|null {\n let offset = this.bb!.__offset(this.bb_pos, 28);\n return offset ? (obj || new onnxruntime.experimental.fbs.Graph())\n .__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) :\n null;\n }\n\n /**\n * @returns number\n */\n graphsLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 28);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startAttribute(builder: flatbuffers.Builder) {\n builder.startObject(13);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset nameOffset\n */\n static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset) {\n builder.addFieldOffset(0, nameOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset docStringOffset\n */\n static addDocString(builder: flatbuffers.Builder, docStringOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, docStringOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param onnxruntime.experimental.fbs.AttributeType type\n */\n static addType(builder: flatbuffers.Builder, type: onnxruntime.experimental.fbs.AttributeType) {\n builder.addFieldInt32(2, type, onnxruntime.experimental.fbs.AttributeType.UNDEFINED);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number f\n */\n static addF(builder: flatbuffers.Builder, f: number) {\n builder.addFieldFloat32(3, f, 0.0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Long i\n */\n static addI(builder: flatbuffers.Builder, i: flatbuffers.Long) {\n builder.addFieldInt64(4, i, builder.createLong(0, 0));\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset sOffset\n */\n static addS(builder: flatbuffers.Builder, sOffset: flatbuffers.Offset) {\n builder.addFieldOffset(5, sOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset tOffset\n */\n static addT(builder: flatbuffers.Builder, tOffset: flatbuffers.Offset) {\n builder.addFieldOffset(6, tOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset gOffset\n */\n static addG(builder: flatbuffers.Builder, gOffset: flatbuffers.Offset) {\n builder.addFieldOffset(7, gOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset floatsOffset\n */\n static addFloats(builder: flatbuffers.Builder, floatsOffset: flatbuffers.Offset) {\n builder.addFieldOffset(8, floatsOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createFloatsVector(builder: flatbuffers.Builder, data: number[]|Uint8Array): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addFloat32(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startFloatsVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset intsOffset\n */\n static addInts(builder: flatbuffers.Builder, intsOffset: flatbuffers.Offset) {\n builder.addFieldOffset(9, intsOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createIntsVector(builder: flatbuffers.Builder, data: flatbuffers.Long[]): flatbuffers.Offset {\n builder.startVector(8, data.length, 8);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addInt64(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startIntsVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(8, numElems, 8);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset stringsOffset\n */\n static addStrings(builder: flatbuffers.Builder, stringsOffset: flatbuffers.Offset) {\n builder.addFieldOffset(10, stringsOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createStringsVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startStringsVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset tensorsOffset\n */\n static addTensors(builder: flatbuffers.Builder, tensorsOffset: flatbuffers.Offset) {\n builder.addFieldOffset(11, tensorsOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createTensorsVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startTensorsVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset graphsOffset\n */\n static addGraphs(builder: flatbuffers.Builder, graphsOffset: flatbuffers.Offset) {\n builder.addFieldOffset(12, graphsOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createGraphsVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startGraphsVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endAttribute(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createAttribute(\n builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset, docStringOffset: flatbuffers.Offset,\n type: onnxruntime.experimental.fbs.AttributeType, f: number, i: flatbuffers.Long, sOffset: flatbuffers.Offset,\n tOffset: flatbuffers.Offset, gOffset: flatbuffers.Offset, floatsOffset: flatbuffers.Offset,\n intsOffset: flatbuffers.Offset, stringsOffset: flatbuffers.Offset, tensorsOffset: flatbuffers.Offset,\n graphsOffset: flatbuffers.Offset): flatbuffers.Offset {\n Attribute.startAttribute(builder);\n Attribute.addName(builder, nameOffset);\n Attribute.addDocString(builder, docStringOffset);\n Attribute.addType(builder, type);\n Attribute.addF(builder, f);\n Attribute.addI(builder, i);\n Attribute.addS(builder, sOffset);\n Attribute.addT(builder, tOffset);\n Attribute.addG(builder, gOffset);\n Attribute.addFloats(builder, floatsOffset);\n Attribute.addInts(builder, intsOffset);\n Attribute.addStrings(builder, stringsOffset);\n Attribute.addTensors(builder, tensorsOffset);\n Attribute.addGraphs(builder, graphsOffset);\n return Attribute.endAttribute(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class Graph {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Graph\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Graph {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Graph= obj\n * @returns Graph\n */\n static getRootAsGraph(bb: flatbuffers.ByteBuffer, obj?: Graph): Graph {\n return (obj || new Graph()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Graph= obj\n * @returns Graph\n */\n static getSizePrefixedRootAsGraph(bb: flatbuffers.ByteBuffer, obj?: Graph): Graph {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new Graph()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param number index\n * @param onnxruntime.experimental.fbs.Tensor= obj\n * @returns onnxruntime.experimental.fbs.Tensor\n */\n initializers(index: number, obj?: onnxruntime.experimental.fbs.Tensor): onnxruntime.experimental.fbs.Tensor|null {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? (obj || new onnxruntime.experimental.fbs.Tensor())\n .__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) :\n null;\n }\n\n /**\n * @returns number\n */\n initializersLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param number index\n * @param onnxruntime.experimental.fbs.ValueInfo= obj\n * @returns onnxruntime.experimental.fbs.ValueInfo\n */\n nodeArgs(index: number, obj?: onnxruntime.experimental.fbs.ValueInfo): onnxruntime.experimental.fbs.ValueInfo|null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? (obj || new onnxruntime.experimental.fbs.ValueInfo())\n .__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) :\n null;\n }\n\n /**\n * @returns number\n */\n nodeArgsLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param number index\n * @param onnxruntime.experimental.fbs.Node= obj\n * @returns onnxruntime.experimental.fbs.Node\n */\n nodes(index: number, obj?: onnxruntime.experimental.fbs.Node): onnxruntime.experimental.fbs.Node|null {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? (obj || new onnxruntime.experimental.fbs.Node())\n .__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) :\n null;\n }\n\n /**\n * @returns number\n */\n nodesLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @returns number\n */\n maxNodeIndex(): number {\n let offset = this.bb!.__offset(this.bb_pos, 10);\n return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param number index\n * @param onnxruntime.experimental.fbs.NodeEdge= obj\n * @returns onnxruntime.experimental.fbs.NodeEdge\n */\n nodeEdges(index: number, obj?: onnxruntime.experimental.fbs.NodeEdge): onnxruntime.experimental.fbs.NodeEdge|null {\n let offset = this.bb!.__offset(this.bb_pos, 12);\n return offset ? (obj || new onnxruntime.experimental.fbs.NodeEdge())\n .__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) :\n null;\n }\n\n /**\n * @returns number\n */\n nodeEdgesLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 12);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param number index\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array\n */\n inputs(index: number): string;\n inputs(index: number, optionalEncoding: flatbuffers.Encoding): string|Uint8Array;\n inputs(index: number, optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 14);\n return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;\n }\n\n /**\n * @returns number\n */\n inputsLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 14);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param number index\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array\n */\n outputs(index: number): string;\n outputs(index: number, optionalEncoding: flatbuffers.Encoding): string|Uint8Array;\n outputs(index: number, optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 16);\n return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;\n }\n\n /**\n * @returns number\n */\n outputsLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 16);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param number index\n * @param onnxruntime.experimental.fbs.SparseTensor= obj\n * @returns onnxruntime.experimental.fbs.SparseTensor\n */\n sparseInitializers(index: number, obj?: onnxruntime.experimental.fbs.SparseTensor):\n onnxruntime.experimental.fbs.SparseTensor|null {\n let offset = this.bb!.__offset(this.bb_pos, 18);\n return offset ? (obj || new onnxruntime.experimental.fbs.SparseTensor())\n .__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) :\n null;\n }\n\n /**\n * @returns number\n */\n sparseInitializersLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 18);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startGraph(builder: flatbuffers.Builder) {\n builder.startObject(8);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset initializersOffset\n */\n static addInitializers(builder: flatbuffers.Builder, initializersOffset: flatbuffers.Offset) {\n builder.addFieldOffset(0, initializersOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createInitializersVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startInitializersVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset nodeArgsOffset\n */\n static addNodeArgs(builder: flatbuffers.Builder, nodeArgsOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, nodeArgsOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createNodeArgsVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startNodeArgsVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset nodesOffset\n */\n static addNodes(builder: flatbuffers.Builder, nodesOffset: flatbuffers.Offset) {\n builder.addFieldOffset(2, nodesOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createNodesVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startNodesVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number maxNodeIndex\n */\n static addMaxNodeIndex(builder: flatbuffers.Builder, maxNodeIndex: number) {\n builder.addFieldInt32(3, maxNodeIndex, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset nodeEdgesOffset\n */\n static addNodeEdges(builder: flatbuffers.Builder, nodeEdgesOffset: flatbuffers.Offset) {\n builder.addFieldOffset(4, nodeEdgesOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createNodeEdgesVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startNodeEdgesVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset inputsOffset\n */\n static addInputs(builder: flatbuffers.Builder, inputsOffset: flatbuffers.Offset) {\n builder.addFieldOffset(5, inputsOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createInputsVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startInputsVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset outputsOffset\n */\n static addOutputs(builder: flatbuffers.Builder, outputsOffset: flatbuffers.Offset) {\n builder.addFieldOffset(6, outputsOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createOutputsVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startOutputsVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset sparseInitializersOffset\n */\n static addSparseInitializers(builder: flatbuffers.Builder, sparseInitializersOffset: flatbuffers.Offset) {\n builder.addFieldOffset(7, sparseInitializersOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createSparseInitializersVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]):\n flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startSparseInitializersVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endGraph(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createGraph(\n builder: flatbuffers.Builder, initializersOffset: flatbuffers.Offset, nodeArgsOffset: flatbuffers.Offset,\n nodesOffset: flatbuffers.Offset, maxNodeIndex: number, nodeEdgesOffset: flatbuffers.Offset,\n inputsOffset: flatbuffers.Offset, outputsOffset: flatbuffers.Offset,\n sparseInitializersOffset: flatbuffers.Offset): flatbuffers.Offset {\n Graph.startGraph(builder);\n Graph.addInitializers(builder, initializersOffset);\n Graph.addNodeArgs(builder, nodeArgsOffset);\n Graph.addNodes(builder, nodesOffset);\n Graph.addMaxNodeIndex(builder, maxNodeIndex);\n Graph.addNodeEdges(builder, nodeEdgesOffset);\n Graph.addInputs(builder, inputsOffset);\n Graph.addOutputs(builder, outputsOffset);\n Graph.addSparseInitializers(builder, sparseInitializersOffset);\n return Graph.endGraph(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class Model {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns Model\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): Model {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Model= obj\n * @returns Model\n */\n static getRootAsModel(bb: flatbuffers.ByteBuffer, obj?: Model): Model {\n return (obj || new Model()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param Model= obj\n * @returns Model\n */\n static getSizePrefixedRootAsModel(bb: flatbuffers.ByteBuffer, obj?: Model): Model {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new Model()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @returns flatbuffers.Long\n */\n irVersion(): flatbuffers.Long {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.readInt64(this.bb_pos + offset) : this.bb!.createLong(0, 0);\n }\n\n /**\n * @param number index\n * @param onnxruntime.experimental.fbs.OperatorSetId= obj\n * @returns onnxruntime.experimental.fbs.OperatorSetId\n */\n opsetImport(index: number, obj?: onnxruntime.experimental.fbs.OperatorSetId):\n onnxruntime.experimental.fbs.OperatorSetId|null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? (obj || new onnxruntime.experimental.fbs.OperatorSetId())\n .__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) :\n null;\n }\n\n /**\n * @returns number\n */\n opsetImportLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n producerName(): string|null;\n producerName(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n producerName(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n producerVersion(): string|null;\n producerVersion(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n producerVersion(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 10);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n domain(): string|null;\n domain(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n domain(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 12);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @returns flatbuffers.Long\n */\n modelVersion(): flatbuffers.Long {\n let offset = this.bb!.__offset(this.bb_pos, 14);\n return offset ? this.bb!.readInt64(this.bb_pos + offset) : this.bb!.createLong(0, 0);\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n docString(): string|null;\n docString(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n docString(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 16);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param onnxruntime.experimental.fbs.Graph= obj\n * @returns onnxruntime.experimental.fbs.Graph|null\n */\n graph(obj?: onnxruntime.experimental.fbs.Graph): onnxruntime.experimental.fbs.Graph|null {\n let offset = this.bb!.__offset(this.bb_pos, 18);\n return offset ? (obj || new onnxruntime.experimental.fbs.Graph())\n .__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) :\n null;\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n graphDocString(): string|null;\n graphDocString(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n graphDocString(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 20);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startModel(builder: flatbuffers.Builder) {\n builder.startObject(9);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Long irVersion\n */\n static addIrVersion(builder: flatbuffers.Builder, irVersion: flatbuffers.Long) {\n builder.addFieldInt64(0, irVersion, builder.createLong(0, 0));\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset opsetImportOffset\n */\n static addOpsetImport(builder: flatbuffers.Builder, opsetImportOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, opsetImportOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createOpsetImportVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startOpsetImportVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset producerNameOffset\n */\n static addProducerName(builder: flatbuffers.Builder, producerNameOffset: flatbuffers.Offset) {\n builder.addFieldOffset(2, producerNameOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset producerVersionOffset\n */\n static addProducerVersion(builder: flatbuffers.Builder, producerVersionOffset: flatbuffers.Offset) {\n builder.addFieldOffset(3, producerVersionOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset domainOffset\n */\n static addDomain(builder: flatbuffers.Builder, domainOffset: flatbuffers.Offset) {\n builder.addFieldOffset(4, domainOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Long modelVersion\n */\n static addModelVersion(builder: flatbuffers.Builder, modelVersion: flatbuffers.Long) {\n builder.addFieldInt64(5, modelVersion, builder.createLong(0, 0));\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset docStringOffset\n */\n static addDocString(builder: flatbuffers.Builder, docStringOffset: flatbuffers.Offset) {\n builder.addFieldOffset(6, docStringOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset graphOffset\n */\n static addGraph(builder: flatbuffers.Builder, graphOffset: flatbuffers.Offset) {\n builder.addFieldOffset(7, graphOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset graphDocStringOffset\n */\n static addGraphDocString(builder: flatbuffers.Builder, graphDocStringOffset: flatbuffers.Offset) {\n builder.addFieldOffset(8, graphDocStringOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endModel(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createModel(\n builder: flatbuffers.Builder, irVersion: flatbuffers.Long, opsetImportOffset: flatbuffers.Offset,\n producerNameOffset: flatbuffers.Offset, producerVersionOffset: flatbuffers.Offset,\n domainOffset: flatbuffers.Offset, modelVersion: flatbuffers.Long, docStringOffset: flatbuffers.Offset,\n graphOffset: flatbuffers.Offset, graphDocStringOffset: flatbuffers.Offset): flatbuffers.Offset {\n Model.startModel(builder);\n Model.addIrVersion(builder, irVersion);\n Model.addOpsetImport(builder, opsetImportOffset);\n Model.addProducerName(builder, producerNameOffset);\n Model.addProducerVersion(builder, producerVersionOffset);\n Model.addDomain(builder, domainOffset);\n Model.addModelVersion(builder, modelVersion);\n Model.addDocString(builder, docStringOffset);\n Model.addGraph(builder, graphOffset);\n Model.addGraphDocString(builder, graphDocStringOffset);\n return Model.endModel(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class KernelCreateInfos {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns KernelCreateInfos\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): KernelCreateInfos {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param KernelCreateInfos= obj\n * @returns KernelCreateInfos\n */\n static getRootAsKernelCreateInfos(bb: flatbuffers.ByteBuffer, obj?: KernelCreateInfos): KernelCreateInfos {\n return (obj || new KernelCreateInfos()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param KernelCreateInfos= obj\n * @returns KernelCreateInfos\n */\n static getSizePrefixedRootAsKernelCreateInfos(bb: flatbuffers.ByteBuffer, obj?: KernelCreateInfos):\n KernelCreateInfos {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new KernelCreateInfos()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param number index\n * @returns number\n */\n nodeIndices(index: number): number|null {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.readUint32(this.bb!.__vector(this.bb_pos + offset) + index * 4) : 0;\n }\n\n /**\n * @returns number\n */\n nodeIndicesLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @returns Uint32Array\n */\n nodeIndicesArray(): Uint32Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ?\n new Uint32Array(\n this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset),\n this.bb!.__vector_len(this.bb_pos + offset)) :\n null;\n }\n\n /**\n * @param number index\n * @returns flatbuffers.Long\n */\n kernelDefHashes(index: number): flatbuffers.Long|null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) :\n this.bb!.createLong(0, 0);\n }\n\n /**\n * @returns number\n */\n kernelDefHashesLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startKernelCreateInfos(builder: flatbuffers.Builder) {\n builder.startObject(2);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset nodeIndicesOffset\n */\n static addNodeIndices(builder: flatbuffers.Builder, nodeIndicesOffset: flatbuffers.Offset) {\n builder.addFieldOffset(0, nodeIndicesOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createNodeIndicesVector(builder: flatbuffers.Builder, data: number[]|Uint8Array): flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addInt32(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startNodeIndicesVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset kernelDefHashesOffset\n */\n static addKernelDefHashes(builder: flatbuffers.Builder, kernelDefHashesOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, kernelDefHashesOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createKernelDefHashesVector(builder: flatbuffers.Builder, data: flatbuffers.Long[]): flatbuffers.Offset {\n builder.startVector(8, data.length, 8);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addInt64(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startKernelDefHashesVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(8, numElems, 8);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endKernelCreateInfos(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createKernelCreateInfos(\n builder: flatbuffers.Builder, nodeIndicesOffset: flatbuffers.Offset,\n kernelDefHashesOffset: flatbuffers.Offset): flatbuffers.Offset {\n KernelCreateInfos.startKernelCreateInfos(builder);\n KernelCreateInfos.addNodeIndices(builder, nodeIndicesOffset);\n KernelCreateInfos.addKernelDefHashes(builder, kernelDefHashesOffset);\n return KernelCreateInfos.endKernelCreateInfos(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class SubGraphSessionState {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns SubGraphSessionState\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): SubGraphSessionState {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param SubGraphSessionState= obj\n * @returns SubGraphSessionState\n */\n static getRootAsSubGraphSessionState(bb: flatbuffers.ByteBuffer, obj?: SubGraphSessionState): SubGraphSessionState {\n return (obj || new SubGraphSessionState()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param SubGraphSessionState= obj\n * @returns SubGraphSessionState\n */\n static getSizePrefixedRootAsSubGraphSessionState(bb: flatbuffers.ByteBuffer, obj?: SubGraphSessionState):\n SubGraphSessionState {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new SubGraphSessionState()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n graphId(): string|null;\n graphId(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n graphId(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param onnxruntime.experimental.fbs.SessionState= obj\n * @returns onnxruntime.experimental.fbs.SessionState|null\n */\n sessionState(obj?: onnxruntime.experimental.fbs.SessionState): onnxruntime.experimental.fbs.SessionState|null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? (obj || new onnxruntime.experimental.fbs.SessionState())\n .__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) :\n null;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startSubGraphSessionState(builder: flatbuffers.Builder) {\n builder.startObject(2);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset graphIdOffset\n */\n static addGraphId(builder: flatbuffers.Builder, graphIdOffset: flatbuffers.Offset) {\n builder.addFieldOffset(0, graphIdOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset sessionStateOffset\n */\n static addSessionState(builder: flatbuffers.Builder, sessionStateOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, sessionStateOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endSubGraphSessionState(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n builder.requiredField(offset, 4); // graph_id\n return offset;\n }\n\n static createSubGraphSessionState(\n builder: flatbuffers.Builder, graphIdOffset: flatbuffers.Offset,\n sessionStateOffset: flatbuffers.Offset): flatbuffers.Offset {\n SubGraphSessionState.startSubGraphSessionState(builder);\n SubGraphSessionState.addGraphId(builder, graphIdOffset);\n SubGraphSessionState.addSessionState(builder, sessionStateOffset);\n return SubGraphSessionState.endSubGraphSessionState(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class SessionState {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns SessionState\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): SessionState {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param SessionState= obj\n * @returns SessionState\n */\n static getRootAsSessionState(bb: flatbuffers.ByteBuffer, obj?: SessionState): SessionState {\n return (obj || new SessionState()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param SessionState= obj\n * @returns SessionState\n */\n static getSizePrefixedRootAsSessionState(bb: flatbuffers.ByteBuffer, obj?: SessionState): SessionState {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new SessionState()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param onnxruntime.experimental.fbs.KernelCreateInfos= obj\n * @returns onnxruntime.experimental.fbs.KernelCreateInfos|null\n */\n kernels(obj?: onnxruntime.experimental.fbs.KernelCreateInfos): onnxruntime.experimental.fbs.KernelCreateInfos|null {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? (obj || new onnxruntime.experimental.fbs.KernelCreateInfos())\n .__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) :\n null;\n }\n\n /**\n * @param number index\n * @param onnxruntime.experimental.fbs.SubGraphSessionState= obj\n * @returns onnxruntime.experimental.fbs.SubGraphSessionState\n */\n subGraphSessionStates(index: number, obj?: onnxruntime.experimental.fbs.SubGraphSessionState):\n onnxruntime.experimental.fbs.SubGraphSessionState|null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? (obj || new onnxruntime.experimental.fbs.SubGraphSessionState())\n .__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) :\n null;\n }\n\n /**\n * @returns number\n */\n subGraphSessionStatesLength(): number {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startSessionState(builder: flatbuffers.Builder) {\n builder.startObject(2);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset kernelsOffset\n */\n static addKernels(builder: flatbuffers.Builder, kernelsOffset: flatbuffers.Offset) {\n builder.addFieldOffset(0, kernelsOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset subGraphSessionStatesOffset\n */\n static addSubGraphSessionStates(builder: flatbuffers.Builder, subGraphSessionStatesOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, subGraphSessionStatesOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param Array. data\n * @returns flatbuffers.Offset\n */\n static createSubGraphSessionStatesVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]):\n flatbuffers.Offset {\n builder.startVector(4, data.length, 4);\n for (let i = data.length - 1; i >= 0; i--) {\n builder.addOffset(data[i]);\n }\n return builder.endVector();\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param number numElems\n */\n static startSubGraphSessionStatesVector(builder: flatbuffers.Builder, numElems: number) {\n builder.startVector(4, numElems, 4);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endSessionState(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n static createSessionState(\n builder: flatbuffers.Builder, kernelsOffset: flatbuffers.Offset,\n subGraphSessionStatesOffset: flatbuffers.Offset): flatbuffers.Offset {\n SessionState.startSessionState(builder);\n SessionState.addKernels(builder, kernelsOffset);\n SessionState.addSubGraphSessionStates(builder, subGraphSessionStatesOffset);\n return SessionState.endSessionState(builder);\n }\n }\n}\n/**\n * @constructor\n */\nexport namespace onnxruntime.experimental.fbs {\n export class InferenceSession {\n bb: flatbuffers.ByteBuffer|null = null;\n\n bb_pos = 0;\n /**\n * @param number i\n * @param flatbuffers.ByteBuffer bb\n * @returns InferenceSession\n */\n __init(i: number, bb: flatbuffers.ByteBuffer): InferenceSession {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param InferenceSession= obj\n * @returns InferenceSession\n */\n static getRootAsInferenceSession(bb: flatbuffers.ByteBuffer, obj?: InferenceSession): InferenceSession {\n return (obj || new InferenceSession()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @param InferenceSession= obj\n * @returns InferenceSession\n */\n static getSizePrefixedRootAsInferenceSession(bb: flatbuffers.ByteBuffer, obj?: InferenceSession): InferenceSession {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new InferenceSession()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n\n /**\n * @param flatbuffers.ByteBuffer bb\n * @returns boolean\n */\n static bufferHasIdentifier(bb: flatbuffers.ByteBuffer): boolean {\n return bb.__has_identifier('ORTM');\n }\n\n /**\n * @param flatbuffers.Encoding= optionalEncoding\n * @returns string|Uint8Array|null\n */\n ortVersion(): string|null;\n ortVersion(optionalEncoding: flatbuffers.Encoding): string|Uint8Array|null;\n ortVersion(optionalEncoding?: any): string|Uint8Array|null {\n let offset = this.bb!.__offset(this.bb_pos, 4);\n return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n\n /**\n * @param onnxruntime.experimental.fbs.Model= obj\n * @returns onnxruntime.experimental.fbs.Model|null\n */\n model(obj?: onnxruntime.experimental.fbs.Model): onnxruntime.experimental.fbs.Model|null {\n let offset = this.bb!.__offset(this.bb_pos, 6);\n return offset ? (obj || new onnxruntime.experimental.fbs.Model())\n .__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) :\n null;\n }\n\n /**\n * @param onnxruntime.experimental.fbs.SessionState= obj\n * @returns onnxruntime.experimental.fbs.SessionState|null\n */\n sessionState(obj?: onnxruntime.experimental.fbs.SessionState): onnxruntime.experimental.fbs.SessionState|null {\n let offset = this.bb!.__offset(this.bb_pos, 8);\n return offset ? (obj || new onnxruntime.experimental.fbs.SessionState())\n .__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) :\n null;\n }\n\n /**\n * @param flatbuffers.Builder builder\n */\n static startInferenceSession(builder: flatbuffers.Builder) {\n builder.startObject(3);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset ortVersionOffset\n */\n static addOrtVersion(builder: flatbuffers.Builder, ortVersionOffset: flatbuffers.Offset) {\n builder.addFieldOffset(0, ortVersionOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset modelOffset\n */\n static addModel(builder: flatbuffers.Builder, modelOffset: flatbuffers.Offset) {\n builder.addFieldOffset(1, modelOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset sessionStateOffset\n */\n static addSessionState(builder: flatbuffers.Builder, sessionStateOffset: flatbuffers.Offset) {\n builder.addFieldOffset(2, sessionStateOffset, 0);\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @returns flatbuffers.Offset\n */\n static endInferenceSession(builder: flatbuffers.Builder): flatbuffers.Offset {\n let offset = builder.endObject();\n return offset;\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset offset\n */\n static finishInferenceSessionBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset) {\n builder.finish(offset, 'ORTM');\n }\n\n /**\n * @param flatbuffers.Builder builder\n * @param flatbuffers.Offset offset\n */\n static finishSizePrefixedInferenceSessionBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset) {\n builder.finish(offset, 'ORTM', true);\n }\n\n static createInferenceSession(\n builder: flatbuffers.Builder, ortVersionOffset: flatbuffers.Offset, modelOffset: flatbuffers.Offset,\n sessionStateOffset: flatbuffers.Offset): flatbuffers.Offset {\n InferenceSession.startInferenceSession(builder);\n InferenceSession.addOrtVersion(builder, ortVersionOffset);\n InferenceSession.addModel(builder, modelOffset);\n InferenceSession.addSessionState(builder, sessionStateOffset);\n return InferenceSession.endInferenceSession(builder);\n }\n }\n}\n","\"use strict\";\r\nmodule.exports = asPromise;\r\n\r\n/**\r\n * Callback as used by {@link util.asPromise}.\r\n * @typedef asPromiseCallback\r\n * @type {function}\r\n * @param {Error|null} error Error, if any\r\n * @param {...*} params Additional arguments\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Returns a promise from a node-style callback function.\r\n * @memberof util\r\n * @param {asPromiseCallback} fn Function to call\r\n * @param {*} ctx Function context\r\n * @param {...*} params Function arguments\r\n * @returns {Promise<*>} Promisified function\r\n */\r\nfunction asPromise(fn, ctx/*, varargs */) {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0,\r\n index = 2,\r\n pending = true;\r\n while (index < arguments.length)\r\n params[offset++] = arguments[index++];\r\n return new Promise(function executor(resolve, reject) {\r\n params[offset] = function callback(err/*, varargs */) {\r\n if (pending) {\r\n pending = false;\r\n if (err)\r\n reject(err);\r\n else {\r\n var params = new Array(arguments.length - 1),\r\n offset = 0;\r\n while (offset < params.length)\r\n params[offset++] = arguments[offset];\r\n resolve.apply(null, params);\r\n }\r\n }\r\n };\r\n try {\r\n fn.apply(ctx || null, params);\r\n } catch (err) {\r\n if (pending) {\r\n pending = false;\r\n reject(err);\r\n }\r\n }\r\n });\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal base64 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar base64 = exports;\r\n\r\n/**\r\n * Calculates the byte length of a base64 encoded string.\r\n * @param {string} string Base64 encoded string\r\n * @returns {number} Byte length\r\n */\r\nbase64.length = function length(string) {\r\n var p = string.length;\r\n if (!p)\r\n return 0;\r\n var n = 0;\r\n while (--p % 4 > 1 && string.charAt(p) === \"=\")\r\n ++n;\r\n return Math.ceil(string.length * 3) / 4 - n;\r\n};\r\n\r\n// Base64 encoding table\r\nvar b64 = new Array(64);\r\n\r\n// Base64 decoding table\r\nvar s64 = new Array(123);\r\n\r\n// 65..90, 97..122, 48..57, 43, 47\r\nfor (var i = 0; i < 64;)\r\n s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r\n\r\n/**\r\n * Encodes a buffer to a base64 encoded string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} Base64 encoded string\r\n */\r\nbase64.encode = function encode(buffer, start, end) {\r\n var parts = null,\r\n chunk = [];\r\n var i = 0, // output index\r\n j = 0, // goto index\r\n t; // temporary\r\n while (start < end) {\r\n var b = buffer[start++];\r\n switch (j) {\r\n case 0:\r\n chunk[i++] = b64[b >> 2];\r\n t = (b & 3) << 4;\r\n j = 1;\r\n break;\r\n case 1:\r\n chunk[i++] = b64[t | b >> 4];\r\n t = (b & 15) << 2;\r\n j = 2;\r\n break;\r\n case 2:\r\n chunk[i++] = b64[t | b >> 6];\r\n chunk[i++] = b64[b & 63];\r\n j = 0;\r\n break;\r\n }\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (j) {\r\n chunk[i++] = b64[t];\r\n chunk[i++] = 61;\r\n if (j === 1)\r\n chunk[i++] = 61;\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\nvar invalidEncoding = \"invalid encoding\";\r\n\r\n/**\r\n * Decodes a base64 encoded string to a buffer.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Number of bytes written\r\n * @throws {Error} If encoding is invalid\r\n */\r\nbase64.decode = function decode(string, buffer, offset) {\r\n var start = offset;\r\n var j = 0, // goto index\r\n t; // temporary\r\n for (var i = 0; i < string.length;) {\r\n var c = string.charCodeAt(i++);\r\n if (c === 61 && j > 1)\r\n break;\r\n if ((c = s64[c]) === undefined)\r\n throw Error(invalidEncoding);\r\n switch (j) {\r\n case 0:\r\n t = c;\r\n j = 1;\r\n break;\r\n case 1:\r\n buffer[offset++] = t << 2 | (c & 48) >> 4;\r\n t = c;\r\n j = 2;\r\n break;\r\n case 2:\r\n buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;\r\n t = c;\r\n j = 3;\r\n break;\r\n case 3:\r\n buffer[offset++] = (t & 3) << 6 | c;\r\n j = 0;\r\n break;\r\n }\r\n }\r\n if (j === 1)\r\n throw Error(invalidEncoding);\r\n return offset - start;\r\n};\r\n\r\n/**\r\n * Tests if the specified string appears to be base64 encoded.\r\n * @param {string} string String to test\r\n * @returns {boolean} `true` if probably base64 encoded, otherwise false\r\n */\r\nbase64.test = function test(string) {\r\n return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);\r\n};\r\n","\"use strict\";\r\nmodule.exports = EventEmitter;\r\n\r\n/**\r\n * Constructs a new event emitter instance.\r\n * @classdesc A minimal event emitter.\r\n * @memberof util\r\n * @constructor\r\n */\r\nfunction EventEmitter() {\r\n\r\n /**\r\n * Registered listeners.\r\n * @type {Object.}\r\n * @private\r\n */\r\n this._listeners = {};\r\n}\r\n\r\n/**\r\n * Registers an event listener.\r\n * @param {string} evt Event name\r\n * @param {function} fn Listener\r\n * @param {*} [ctx] Listener context\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.on = function on(evt, fn, ctx) {\r\n (this._listeners[evt] || (this._listeners[evt] = [])).push({\r\n fn : fn,\r\n ctx : ctx || this\r\n });\r\n return this;\r\n};\r\n\r\n/**\r\n * Removes an event listener or any matching listeners if arguments are omitted.\r\n * @param {string} [evt] Event name. Removes all listeners if omitted.\r\n * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted.\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.off = function off(evt, fn) {\r\n if (evt === undefined)\r\n this._listeners = {};\r\n else {\r\n if (fn === undefined)\r\n this._listeners[evt] = [];\r\n else {\r\n var listeners = this._listeners[evt];\r\n for (var i = 0; i < listeners.length;)\r\n if (listeners[i].fn === fn)\r\n listeners.splice(i, 1);\r\n else\r\n ++i;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emits an event by calling its listeners with the specified arguments.\r\n * @param {string} evt Event name\r\n * @param {...*} args Arguments\r\n * @returns {util.EventEmitter} `this`\r\n */\r\nEventEmitter.prototype.emit = function emit(evt) {\r\n var listeners = this._listeners[evt];\r\n if (listeners) {\r\n var args = [],\r\n i = 1;\r\n for (; i < arguments.length;)\r\n args.push(arguments[i++]);\r\n for (i = 0; i < listeners.length;)\r\n listeners[i].fn.apply(listeners[i++].ctx, args);\r\n }\r\n return this;\r\n};\r\n","\"use strict\";\r\n\r\nmodule.exports = factory(factory);\r\n\r\n/**\r\n * Reads / writes floats / doubles from / to buffers.\r\n * @name util.float\r\n * @namespace\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using little endian byte order.\r\n * @name util.float.writeFloatLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 32 bit float to a buffer using big endian byte order.\r\n * @name util.float.writeFloatBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using little endian byte order.\r\n * @name util.float.readFloatLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 32 bit float from a buffer using big endian byte order.\r\n * @name util.float.readFloatBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using little endian byte order.\r\n * @name util.float.writeDoubleLE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Writes a 64 bit double to a buffer using big endian byte order.\r\n * @name util.float.writeDoubleBE\r\n * @function\r\n * @param {number} val Value to write\r\n * @param {Uint8Array} buf Target buffer\r\n * @param {number} pos Target buffer offset\r\n * @returns {undefined}\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using little endian byte order.\r\n * @name util.float.readDoubleLE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n/**\r\n * Reads a 64 bit double from a buffer using big endian byte order.\r\n * @name util.float.readDoubleBE\r\n * @function\r\n * @param {Uint8Array} buf Source buffer\r\n * @param {number} pos Source buffer offset\r\n * @returns {number} Value read\r\n */\r\n\r\n// Factory function for the purpose of node-based testing in modified global environments\r\nfunction factory(exports) {\r\n\r\n // float: typed array\r\n if (typeof Float32Array !== \"undefined\") (function() {\r\n\r\n var f32 = new Float32Array([ -0 ]),\r\n f8b = new Uint8Array(f32.buffer),\r\n le = f8b[3] === 128;\r\n\r\n function writeFloat_f32_cpy(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n }\r\n\r\n function writeFloat_f32_rev(val, buf, pos) {\r\n f32[0] = val;\r\n buf[pos ] = f8b[3];\r\n buf[pos + 1] = f8b[2];\r\n buf[pos + 2] = f8b[1];\r\n buf[pos + 3] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;\r\n\r\n function readFloat_f32_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n function readFloat_f32_rev(buf, pos) {\r\n f8b[3] = buf[pos ];\r\n f8b[2] = buf[pos + 1];\r\n f8b[1] = buf[pos + 2];\r\n f8b[0] = buf[pos + 3];\r\n return f32[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;\r\n /* istanbul ignore next */\r\n exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;\r\n\r\n // float: ieee754\r\n })(); else (function() {\r\n\r\n function writeFloat_ieee754(writeUint, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0)\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos);\r\n else if (isNaN(val))\r\n writeUint(2143289344, buf, pos);\r\n else if (val > 3.4028234663852886e+38) // +-Infinity\r\n writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);\r\n else if (val < 1.1754943508222875e-38) // denormal\r\n writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos);\r\n else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2),\r\n mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;\r\n writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);\r\n }\r\n }\r\n\r\n exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);\r\n exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);\r\n\r\n function readFloat_ieee754(readUint, buf, pos) {\r\n var uint = readUint(buf, pos),\r\n sign = (uint >> 31) * 2 + 1,\r\n exponent = uint >>> 23 & 255,\r\n mantissa = uint & 8388607;\r\n return exponent === 255\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 1.401298464324817e-45 * mantissa\r\n : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);\r\n }\r\n\r\n exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);\r\n exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);\r\n\r\n })();\r\n\r\n // double: typed array\r\n if (typeof Float64Array !== \"undefined\") (function() {\r\n\r\n var f64 = new Float64Array([-0]),\r\n f8b = new Uint8Array(f64.buffer),\r\n le = f8b[7] === 128;\r\n\r\n function writeDouble_f64_cpy(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[0];\r\n buf[pos + 1] = f8b[1];\r\n buf[pos + 2] = f8b[2];\r\n buf[pos + 3] = f8b[3];\r\n buf[pos + 4] = f8b[4];\r\n buf[pos + 5] = f8b[5];\r\n buf[pos + 6] = f8b[6];\r\n buf[pos + 7] = f8b[7];\r\n }\r\n\r\n function writeDouble_f64_rev(val, buf, pos) {\r\n f64[0] = val;\r\n buf[pos ] = f8b[7];\r\n buf[pos + 1] = f8b[6];\r\n buf[pos + 2] = f8b[5];\r\n buf[pos + 3] = f8b[4];\r\n buf[pos + 4] = f8b[3];\r\n buf[pos + 5] = f8b[2];\r\n buf[pos + 6] = f8b[1];\r\n buf[pos + 7] = f8b[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;\r\n\r\n function readDouble_f64_cpy(buf, pos) {\r\n f8b[0] = buf[pos ];\r\n f8b[1] = buf[pos + 1];\r\n f8b[2] = buf[pos + 2];\r\n f8b[3] = buf[pos + 3];\r\n f8b[4] = buf[pos + 4];\r\n f8b[5] = buf[pos + 5];\r\n f8b[6] = buf[pos + 6];\r\n f8b[7] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n function readDouble_f64_rev(buf, pos) {\r\n f8b[7] = buf[pos ];\r\n f8b[6] = buf[pos + 1];\r\n f8b[5] = buf[pos + 2];\r\n f8b[4] = buf[pos + 3];\r\n f8b[3] = buf[pos + 4];\r\n f8b[2] = buf[pos + 5];\r\n f8b[1] = buf[pos + 6];\r\n f8b[0] = buf[pos + 7];\r\n return f64[0];\r\n }\r\n\r\n /* istanbul ignore next */\r\n exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;\r\n /* istanbul ignore next */\r\n exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;\r\n\r\n // double: ieee754\r\n })(); else (function() {\r\n\r\n function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {\r\n var sign = val < 0 ? 1 : 0;\r\n if (sign)\r\n val = -val;\r\n if (val === 0) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1);\r\n } else if (isNaN(val)) {\r\n writeUint(0, buf, pos + off0);\r\n writeUint(2146959360, buf, pos + off1);\r\n } else if (val > 1.7976931348623157e+308) { // +-Infinity\r\n writeUint(0, buf, pos + off0);\r\n writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);\r\n } else {\r\n var mantissa;\r\n if (val < 2.2250738585072014e-308) { // denormal\r\n mantissa = val / 5e-324;\r\n writeUint(mantissa >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);\r\n } else {\r\n var exponent = Math.floor(Math.log(val) / Math.LN2);\r\n if (exponent === 1024)\r\n exponent = 1023;\r\n mantissa = val * Math.pow(2, -exponent);\r\n writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);\r\n writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);\r\n }\r\n }\r\n }\r\n\r\n exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);\r\n exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);\r\n\r\n function readDouble_ieee754(readUint, off0, off1, buf, pos) {\r\n var lo = readUint(buf, pos + off0),\r\n hi = readUint(buf, pos + off1);\r\n var sign = (hi >> 31) * 2 + 1,\r\n exponent = hi >>> 20 & 2047,\r\n mantissa = 4294967296 * (hi & 1048575) + lo;\r\n return exponent === 2047\r\n ? mantissa\r\n ? NaN\r\n : sign * Infinity\r\n : exponent === 0 // denormal\r\n ? sign * 5e-324 * mantissa\r\n : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);\r\n }\r\n\r\n exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);\r\n exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);\r\n\r\n })();\r\n\r\n return exports;\r\n}\r\n\r\n// uint helpers\r\n\r\nfunction writeUintLE(val, buf, pos) {\r\n buf[pos ] = val & 255;\r\n buf[pos + 1] = val >>> 8 & 255;\r\n buf[pos + 2] = val >>> 16 & 255;\r\n buf[pos + 3] = val >>> 24;\r\n}\r\n\r\nfunction writeUintBE(val, buf, pos) {\r\n buf[pos ] = val >>> 24;\r\n buf[pos + 1] = val >>> 16 & 255;\r\n buf[pos + 2] = val >>> 8 & 255;\r\n buf[pos + 3] = val & 255;\r\n}\r\n\r\nfunction readUintLE(buf, pos) {\r\n return (buf[pos ]\r\n | buf[pos + 1] << 8\r\n | buf[pos + 2] << 16\r\n | buf[pos + 3] << 24) >>> 0;\r\n}\r\n\r\nfunction readUintBE(buf, pos) {\r\n return (buf[pos ] << 24\r\n | buf[pos + 1] << 16\r\n | buf[pos + 2] << 8\r\n | buf[pos + 3]) >>> 0;\r\n}\r\n","\"use strict\";\r\nmodule.exports = inquire;\r\n\r\n/**\r\n * Requires a module only if available.\r\n * @memberof util\r\n * @param {string} moduleName Module to require\r\n * @returns {?Object} Required module if available and not empty, otherwise `null`\r\n */\r\nfunction inquire(moduleName) {\r\n try {\r\n var mod = eval(\"quire\".replace(/^/,\"re\"))(moduleName); // eslint-disable-line no-eval\r\n if (mod && (mod.length || Object.keys(mod).length))\r\n return mod;\r\n } catch (e) {} // eslint-disable-line no-empty\r\n return null;\r\n}\r\n","\"use strict\";\r\n\r\n/**\r\n * A minimal UTF8 implementation for number arrays.\r\n * @memberof util\r\n * @namespace\r\n */\r\nvar utf8 = exports;\r\n\r\n/**\r\n * Calculates the UTF8 byte length of a string.\r\n * @param {string} string String\r\n * @returns {number} Byte length\r\n */\r\nutf8.length = function utf8_length(string) {\r\n var len = 0,\r\n c = 0;\r\n for (var i = 0; i < string.length; ++i) {\r\n c = string.charCodeAt(i);\r\n if (c < 128)\r\n len += 1;\r\n else if (c < 2048)\r\n len += 2;\r\n else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {\r\n ++i;\r\n len += 4;\r\n } else\r\n len += 3;\r\n }\r\n return len;\r\n};\r\n\r\n/**\r\n * Reads UTF8 bytes as a string.\r\n * @param {Uint8Array} buffer Source buffer\r\n * @param {number} start Source start\r\n * @param {number} end Source end\r\n * @returns {string} String read\r\n */\r\nutf8.read = function utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null,\r\n chunk = [],\r\n i = 0, // char offset\r\n t; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128)\r\n chunk[i++] = t;\r\n else if (t > 191 && t < 224)\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n } else\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n};\r\n\r\n/**\r\n * Writes a string as UTF8 bytes.\r\n * @param {string} string Source string\r\n * @param {Uint8Array} buffer Destination buffer\r\n * @param {number} offset Destination offset\r\n * @returns {number} Bytes written\r\n */\r\nutf8.write = function utf8_write(string, buffer, offset) {\r\n var start = offset,\r\n c1, // character 1\r\n c2; // character 2\r\n for (var i = 0; i < string.length; ++i) {\r\n c1 = string.charCodeAt(i);\r\n if (c1 < 128) {\r\n buffer[offset++] = c1;\r\n } else if (c1 < 2048) {\r\n buffer[offset++] = c1 >> 6 | 192;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {\r\n c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);\r\n ++i;\r\n buffer[offset++] = c1 >> 18 | 240;\r\n buffer[offset++] = c1 >> 12 & 63 | 128;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n } else {\r\n buffer[offset++] = c1 >> 12 | 224;\r\n buffer[offset++] = c1 >> 6 & 63 | 128;\r\n buffer[offset++] = c1 & 63 | 128;\r\n }\r\n }\r\n return offset - start;\r\n};\r\n","\"use strict\";\r\nmodule.exports = pool;\r\n\r\n/**\r\n * An allocator as used by {@link util.pool}.\r\n * @typedef PoolAllocator\r\n * @type {function}\r\n * @param {number} size Buffer size\r\n * @returns {Uint8Array} Buffer\r\n */\r\n\r\n/**\r\n * A slicer as used by {@link util.pool}.\r\n * @typedef PoolSlicer\r\n * @type {function}\r\n * @param {number} start Start offset\r\n * @param {number} end End offset\r\n * @returns {Uint8Array} Buffer slice\r\n * @this {Uint8Array}\r\n */\r\n\r\n/**\r\n * A general purpose buffer pool.\r\n * @memberof util\r\n * @function\r\n * @param {PoolAllocator} alloc Allocator\r\n * @param {PoolSlicer} slice Slicer\r\n * @param {number} [size=8192] Slab size\r\n * @returns {PoolAllocator} Pooled allocator\r\n */\r\nfunction pool(alloc, slice, size) {\r\n var SIZE = size || 8192;\r\n var MAX = SIZE >>> 1;\r\n var slab = null;\r\n var offset = SIZE;\r\n return function pool_alloc(size) {\r\n if (size < 1 || size > MAX)\r\n return alloc(size);\r\n if (offset + size > SIZE) {\r\n slab = alloc(SIZE);\r\n offset = 0;\r\n }\r\n var buf = slice.call(slab, offset, offset += size);\r\n if (offset & 7) // align to 32 bit\r\n offset = (offset | 7) + 1;\r\n return buf;\r\n };\r\n}\r\n","\"use strict\";\nmodule.exports = LongBits;\n\nvar util = require(\"../util/minimal\");\n\n/**\n * Constructs new long bits.\n * @classdesc Helper class for working with the low and high bits of a 64 bit value.\n * @memberof util\n * @constructor\n * @param {number} lo Low 32 bits, unsigned\n * @param {number} hi High 32 bits, unsigned\n */\nfunction LongBits(lo, hi) {\n\n // note that the casts below are theoretically unnecessary as of today, but older statically\n // generated converter code might still call the ctor with signed 32bits. kept for compat.\n\n /**\n * Low bits.\n * @type {number}\n */\n this.lo = lo >>> 0;\n\n /**\n * High bits.\n * @type {number}\n */\n this.hi = hi >>> 0;\n}\n\n/**\n * Zero bits.\n * @memberof util.LongBits\n * @type {util.LongBits}\n */\nvar zero = LongBits.zero = new LongBits(0, 0);\n\nzero.toNumber = function() { return 0; };\nzero.zzEncode = zero.zzDecode = function() { return this; };\nzero.length = function() { return 1; };\n\n/**\n * Zero hash.\n * @memberof util.LongBits\n * @type {string}\n */\nvar zeroHash = LongBits.zeroHash = \"\\0\\0\\0\\0\\0\\0\\0\\0\";\n\n/**\n * Constructs new long bits from the specified number.\n * @param {number} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.fromNumber = function fromNumber(value) {\n if (value === 0)\n return zero;\n var sign = value < 0;\n if (sign)\n value = -value;\n var lo = value >>> 0,\n hi = (value - lo) / 4294967296 >>> 0;\n if (sign) {\n hi = ~hi >>> 0;\n lo = ~lo >>> 0;\n if (++lo > 4294967295) {\n lo = 0;\n if (++hi > 4294967295)\n hi = 0;\n }\n }\n return new LongBits(lo, hi);\n};\n\n/**\n * Constructs new long bits from a number, long or string.\n * @param {Long|number|string} value Value\n * @returns {util.LongBits} Instance\n */\nLongBits.from = function from(value) {\n if (typeof value === \"number\")\n return LongBits.fromNumber(value);\n if (util.isString(value)) {\n /* istanbul ignore else */\n if (util.Long)\n value = util.Long.fromString(value);\n else\n return LongBits.fromNumber(parseInt(value, 10));\n }\n return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;\n};\n\n/**\n * Converts this long bits to a possibly unsafe JavaScript number.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {number} Possibly unsafe number\n */\nLongBits.prototype.toNumber = function toNumber(unsigned) {\n if (!unsigned && this.hi >>> 31) {\n var lo = ~this.lo + 1 >>> 0,\n hi = ~this.hi >>> 0;\n if (!lo)\n hi = hi + 1 >>> 0;\n return -(lo + hi * 4294967296);\n }\n return this.lo + this.hi * 4294967296;\n};\n\n/**\n * Converts this long bits to a long.\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long} Long\n */\nLongBits.prototype.toLong = function toLong(unsigned) {\n return util.Long\n ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned))\n /* istanbul ignore next */\n : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };\n};\n\nvar charCodeAt = String.prototype.charCodeAt;\n\n/**\n * Constructs new long bits from the specified 8 characters long hash.\n * @param {string} hash Hash\n * @returns {util.LongBits} Bits\n */\nLongBits.fromHash = function fromHash(hash) {\n if (hash === zeroHash)\n return zero;\n return new LongBits(\n ( charCodeAt.call(hash, 0)\n | charCodeAt.call(hash, 1) << 8\n | charCodeAt.call(hash, 2) << 16\n | charCodeAt.call(hash, 3) << 24) >>> 0\n ,\n ( charCodeAt.call(hash, 4)\n | charCodeAt.call(hash, 5) << 8\n | charCodeAt.call(hash, 6) << 16\n | charCodeAt.call(hash, 7) << 24) >>> 0\n );\n};\n\n/**\n * Converts this long bits to a 8 characters long hash.\n * @returns {string} Hash\n */\nLongBits.prototype.toHash = function toHash() {\n return String.fromCharCode(\n this.lo & 255,\n this.lo >>> 8 & 255,\n this.lo >>> 16 & 255,\n this.lo >>> 24 ,\n this.hi & 255,\n this.hi >>> 8 & 255,\n this.hi >>> 16 & 255,\n this.hi >>> 24\n );\n};\n\n/**\n * Zig-zag encodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzEncode = function zzEncode() {\n var mask = this.hi >> 31;\n this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;\n this.lo = ( this.lo << 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Zig-zag decodes this long bits.\n * @returns {util.LongBits} `this`\n */\nLongBits.prototype.zzDecode = function zzDecode() {\n var mask = -(this.lo & 1);\n this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;\n this.hi = ( this.hi >>> 1 ^ mask) >>> 0;\n return this;\n};\n\n/**\n * Calculates the length of this longbits when encoded as a varint.\n * @returns {number} Length\n */\nLongBits.prototype.length = function length() {\n var part0 = this.lo,\n part1 = (this.lo >>> 28 | this.hi << 4) >>> 0,\n part2 = this.hi >>> 24;\n return part2 === 0\n ? part1 === 0\n ? part0 < 16384\n ? part0 < 128 ? 1 : 2\n : part0 < 2097152 ? 3 : 4\n : part1 < 16384\n ? part1 < 128 ? 5 : 6\n : part1 < 2097152 ? 7 : 8\n : part2 < 128 ? 9 : 10;\n};\n","\"use strict\";\nvar util = exports;\n\n// used to return a Promise where callback is omitted\nutil.asPromise = require(\"@protobufjs/aspromise\");\n\n// converts to / from base64 encoded strings\nutil.base64 = require(\"@protobufjs/base64\");\n\n// base class of rpc.Service\nutil.EventEmitter = require(\"@protobufjs/eventemitter\");\n\n// float handling accross browsers\nutil.float = require(\"@protobufjs/float\");\n\n// requires modules optionally and hides the call from bundlers\nutil.inquire = require(\"@protobufjs/inquire\");\n\n// converts to / from utf8 encoded strings\nutil.utf8 = require(\"@protobufjs/utf8\");\n\n// provides a node-like buffer pool in the browser\nutil.pool = require(\"@protobufjs/pool\");\n\n// utility to work with the low and high bits of a 64 bit value\nutil.LongBits = require(\"./longbits\");\n\n/**\n * Whether running within node or not.\n * @memberof util\n * @type {boolean}\n */\nutil.isNode = Boolean(typeof global !== \"undefined\"\n && global\n && global.process\n && global.process.versions\n && global.process.versions.node);\n\n/**\n * Global object reference.\n * @memberof util\n * @type {Object}\n */\nutil.global = util.isNode && global\n || typeof window !== \"undefined\" && window\n || typeof self !== \"undefined\" && self\n || this; // eslint-disable-line no-invalid-this\n\n/**\n * An immuable empty array.\n * @memberof util\n * @type {Array.<*>}\n * @const\n */\nutil.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes\n\n/**\n * An immutable empty object.\n * @type {Object}\n * @const\n */\nutil.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes\n\n/**\n * Tests if the specified value is an integer.\n * @function\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is an integer\n */\nutil.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) {\n return typeof value === \"number\" && isFinite(value) && Math.floor(value) === value;\n};\n\n/**\n * Tests if the specified value is a string.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a string\n */\nutil.isString = function isString(value) {\n return typeof value === \"string\" || value instanceof String;\n};\n\n/**\n * Tests if the specified value is a non-null object.\n * @param {*} value Value to test\n * @returns {boolean} `true` if the value is a non-null object\n */\nutil.isObject = function isObject(value) {\n return value && typeof value === \"object\";\n};\n\n/**\n * Checks if a property on a message is considered to be present.\n * This is an alias of {@link util.isSet}.\n * @function\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isset =\n\n/**\n * Checks if a property on a message is considered to be present.\n * @param {Object} obj Plain object or message instance\n * @param {string} prop Property name\n * @returns {boolean} `true` if considered to be present, otherwise `false`\n */\nutil.isSet = function isSet(obj, prop) {\n var value = obj[prop];\n if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins\n return typeof value !== \"object\" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;\n return false;\n};\n\n/**\n * Any compatible Buffer instance.\n * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings.\n * @interface Buffer\n * @extends Uint8Array\n */\n\n/**\n * Node's Buffer class if available.\n * @type {Constructor}\n */\nutil.Buffer = (function() {\n try {\n var Buffer = util.inquire(\"buffer\").Buffer;\n // refuse to use non-node buffers if not explicitly assigned (perf reasons):\n return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null;\n } catch (e) {\n /* istanbul ignore next */\n return null;\n }\n})();\n\n// Internal alias of or polyfull for Buffer.from.\nutil._Buffer_from = null;\n\n// Internal alias of or polyfill for Buffer.allocUnsafe.\nutil._Buffer_allocUnsafe = null;\n\n/**\n * Creates a new buffer of whatever type supported by the environment.\n * @param {number|number[]} [sizeOrArray=0] Buffer size or number array\n * @returns {Uint8Array|Buffer} Buffer\n */\nutil.newBuffer = function newBuffer(sizeOrArray) {\n /* istanbul ignore next */\n return typeof sizeOrArray === \"number\"\n ? util.Buffer\n ? util._Buffer_allocUnsafe(sizeOrArray)\n : new util.Array(sizeOrArray)\n : util.Buffer\n ? util._Buffer_from(sizeOrArray)\n : typeof Uint8Array === \"undefined\"\n ? sizeOrArray\n : new Uint8Array(sizeOrArray);\n};\n\n/**\n * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`.\n * @type {Constructor}\n */\nutil.Array = typeof Uint8Array !== \"undefined\" ? Uint8Array /* istanbul ignore next */ : Array;\n\n/**\n * Any compatible Long instance.\n * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js.\n * @interface Long\n * @property {number} low Low bits\n * @property {number} high High bits\n * @property {boolean} unsigned Whether unsigned or not\n */\n\n/**\n * Long.js's Long class if available.\n * @type {Constructor}\n */\nutil.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long\n || /* istanbul ignore next */ util.global.Long\n || util.inquire(\"long\");\n\n/**\n * Regular expression used to verify 2 bit (`bool`) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key2Re = /^true|false|0|1$/;\n\n/**\n * Regular expression used to verify 32 bit (`int32` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key32Re = /^-?(?:0|[1-9][0-9]*)$/;\n\n/**\n * Regular expression used to verify 64 bit (`int64` etc.) map keys.\n * @type {RegExp}\n * @const\n */\nutil.key64Re = /^(?:[\\\\x00-\\\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;\n\n/**\n * Converts a number or long to an 8 characters long hash string.\n * @param {Long|number} value Value to convert\n * @returns {string} Hash\n */\nutil.longToHash = function longToHash(value) {\n return value\n ? util.LongBits.from(value).toHash()\n : util.LongBits.zeroHash;\n};\n\n/**\n * Converts an 8 characters long hash string to a long or number.\n * @param {string} hash Hash\n * @param {boolean} [unsigned=false] Whether unsigned or not\n * @returns {Long|number} Original value\n */\nutil.longFromHash = function longFromHash(hash, unsigned) {\n var bits = util.LongBits.fromHash(hash);\n if (util.Long)\n return util.Long.fromBits(bits.lo, bits.hi, unsigned);\n return bits.toNumber(Boolean(unsigned));\n};\n\n/**\n * Merges the properties of the source object into the destination object.\n * @memberof util\n * @param {Object.} dst Destination object\n * @param {Object.} src Source object\n * @param {boolean} [ifNotSet=false] Merges only if the key is not already set\n * @returns {Object.} Destination object\n */\nfunction merge(dst, src, ifNotSet) { // used by converters\n for (var keys = Object.keys(src), i = 0; i < keys.length; ++i)\n if (dst[keys[i]] === undefined || !ifNotSet)\n dst[keys[i]] = src[keys[i]];\n return dst;\n}\n\nutil.merge = merge;\n\n/**\n * Converts the first character of a string to lower case.\n * @param {string} str String to convert\n * @returns {string} Converted string\n */\nutil.lcFirst = function lcFirst(str) {\n return str.charAt(0).toLowerCase() + str.substring(1);\n};\n\n/**\n * Creates a custom error constructor.\n * @memberof util\n * @param {string} name Error name\n * @returns {Constructor} Custom error constructor\n */\nfunction newError(name) {\n\n function CustomError(message, properties) {\n\n if (!(this instanceof CustomError))\n return new CustomError(message, properties);\n\n // Error.call(this, message);\n // ^ just returns a new error instance because the ctor can be called as a function\n\n Object.defineProperty(this, \"message\", { get: function() { return message; } });\n\n /* istanbul ignore next */\n if (Error.captureStackTrace) // node\n Error.captureStackTrace(this, CustomError);\n else\n Object.defineProperty(this, \"stack\", { value: new Error().stack || \"\" });\n\n if (properties)\n merge(this, properties);\n }\n\n CustomError.prototype = Object.create(Error.prototype, {\n constructor: {\n value: CustomError,\n writable: true,\n enumerable: false,\n configurable: true,\n },\n name: {\n get: function get() { return name; },\n set: undefined,\n enumerable: false,\n // configurable: false would accurately preserve the behavior of\n // the original, but I'm guessing that was not intentional.\n // For an actual error subclass, this property would\n // be configurable.\n configurable: true,\n },\n toString: {\n value: function value() { return this.name + \": \" + this.message; },\n writable: true,\n enumerable: false,\n configurable: true,\n },\n });\n\n return CustomError;\n}\n\nutil.newError = newError;\n\n/**\n * Constructs a new protocol error.\n * @classdesc Error subclass indicating a protocol specifc error.\n * @memberof util\n * @extends Error\n * @template T extends Message\n * @constructor\n * @param {string} message Error message\n * @param {Object.} [properties] Additional properties\n * @example\n * try {\n * MyMessage.decode(someBuffer); // throws if required fields are missing\n * } catch (e) {\n * if (e instanceof ProtocolError && e.instance)\n * console.log(\"decoded so far: \" + JSON.stringify(e.instance));\n * }\n */\nutil.ProtocolError = newError(\"ProtocolError\");\n\n/**\n * So far decoded message instance.\n * @name util.ProtocolError#instance\n * @type {Message}\n */\n\n/**\n * A OneOf getter as returned by {@link util.oneOfGetter}.\n * @typedef OneOfGetter\n * @type {function}\n * @returns {string|undefined} Set field name, if any\n */\n\n/**\n * Builds a getter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfGetter} Unbound getter\n */\nutil.oneOfGetter = function getOneOf(fieldNames) {\n var fieldMap = {};\n for (var i = 0; i < fieldNames.length; ++i)\n fieldMap[fieldNames[i]] = 1;\n\n /**\n * @returns {string|undefined} Set field name, if any\n * @this Object\n * @ignore\n */\n return function() { // eslint-disable-line consistent-return\n for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i)\n if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null)\n return keys[i];\n };\n};\n\n/**\n * A OneOf setter as returned by {@link util.oneOfSetter}.\n * @typedef OneOfSetter\n * @type {function}\n * @param {string|undefined} value Field name\n * @returns {undefined}\n */\n\n/**\n * Builds a setter for a oneof's present field name.\n * @param {string[]} fieldNames Field names\n * @returns {OneOfSetter} Unbound setter\n */\nutil.oneOfSetter = function setOneOf(fieldNames) {\n\n /**\n * @param {string} name Field name\n * @returns {undefined}\n * @this Object\n * @ignore\n */\n return function(name) {\n for (var i = 0; i < fieldNames.length; ++i)\n if (fieldNames[i] !== name)\n delete this[fieldNames[i]];\n };\n};\n\n/**\n * Default conversion options used for {@link Message#toJSON} implementations.\n *\n * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely:\n *\n * - Longs become strings\n * - Enums become string keys\n * - Bytes become base64 encoded strings\n * - (Sub-)Messages become plain objects\n * - Maps become plain objects with all string keys\n * - Repeated fields become arrays\n * - NaN and Infinity for float and double fields become strings\n *\n * @type {IConversionOptions}\n * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json\n */\nutil.toJSONOptions = {\n longs: String,\n enums: String,\n bytes: String,\n json: true\n};\n\n// Sets up buffer utility according to the environment (called in index-minimal)\nutil._configure = function() {\n var Buffer = util.Buffer;\n /* istanbul ignore if */\n if (!Buffer) {\n util._Buffer_from = util._Buffer_allocUnsafe = null;\n return;\n }\n // because node 4.x buffers are incompatible & immutable\n // see: https://github.com/dcodeIO/protobuf.js/pull/665\n util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from ||\n /* istanbul ignore next */\n function Buffer_from(value, encoding) {\n return new Buffer(value, encoding);\n };\n util._Buffer_allocUnsafe = Buffer.allocUnsafe ||\n /* istanbul ignore next */\n function Buffer_allocUnsafe(size) {\n return new Buffer(size);\n };\n};\n","\"use strict\";\nmodule.exports = Writer;\n\nvar util = require(\"./util/minimal\");\n\nvar BufferWriter; // cyclic\n\nvar LongBits = util.LongBits,\n base64 = util.base64,\n utf8 = util.utf8;\n\n/**\n * Constructs a new writer operation instance.\n * @classdesc Scheduled writer operation.\n * @constructor\n * @param {function(*, Uint8Array, number)} fn Function to call\n * @param {number} len Value byte length\n * @param {*} val Value to write\n * @ignore\n */\nfunction Op(fn, len, val) {\n\n /**\n * Function to call.\n * @type {function(Uint8Array, number, *)}\n */\n this.fn = fn;\n\n /**\n * Value byte length.\n * @type {number}\n */\n this.len = len;\n\n /**\n * Next operation.\n * @type {Writer.Op|undefined}\n */\n this.next = undefined;\n\n /**\n * Value to write.\n * @type {*}\n */\n this.val = val; // type varies\n}\n\n/* istanbul ignore next */\nfunction noop() {} // eslint-disable-line no-empty-function\n\n/**\n * Constructs a new writer state instance.\n * @classdesc Copied writer state.\n * @memberof Writer\n * @constructor\n * @param {Writer} writer Writer to copy state from\n * @ignore\n */\nfunction State(writer) {\n\n /**\n * Current head.\n * @type {Writer.Op}\n */\n this.head = writer.head;\n\n /**\n * Current tail.\n * @type {Writer.Op}\n */\n this.tail = writer.tail;\n\n /**\n * Current buffer length.\n * @type {number}\n */\n this.len = writer.len;\n\n /**\n * Next state.\n * @type {State|null}\n */\n this.next = writer.states;\n}\n\n/**\n * Constructs a new writer instance.\n * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n */\nfunction Writer() {\n\n /**\n * Current length.\n * @type {number}\n */\n this.len = 0;\n\n /**\n * Operations head.\n * @type {Object}\n */\n this.head = new Op(noop, 0, 0);\n\n /**\n * Operations tail\n * @type {Object}\n */\n this.tail = this.head;\n\n /**\n * Linked forked states.\n * @type {Object|null}\n */\n this.states = null;\n\n // When a value is written, the writer calculates its byte length and puts it into a linked\n // list of operations to perform when finish() is called. This both allows us to allocate\n // buffers of the exact required size and reduces the amount of work we have to do compared\n // to first calculating over objects and then encoding over objects. In our case, the encoding\n // part is just a linked list walk calling operations with already prepared values.\n}\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup() {\n return (Writer.create = function create_buffer() {\n return new BufferWriter();\n })();\n }\n /* istanbul ignore next */\n : function create_array() {\n return new Writer();\n };\n};\n\n/**\n * Creates a new writer.\n * @function\n * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer}\n */\nWriter.create = create();\n\n/**\n * Allocates a buffer of the specified size.\n * @param {number} size Buffer size\n * @returns {Uint8Array} Buffer\n */\nWriter.alloc = function alloc(size) {\n return new util.Array(size);\n};\n\n// Use Uint8Array buffer pool in the browser, just like node does with buffers\n/* istanbul ignore else */\nif (util.Array !== Array)\n Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray);\n\n/**\n * Pushes a new operation to the queue.\n * @param {function(Uint8Array, number, *)} fn Function to call\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @returns {Writer} `this`\n * @private\n */\nWriter.prototype._push = function push(fn, len, val) {\n this.tail = this.tail.next = new Op(fn, len, val);\n this.len += len;\n return this;\n};\n\nfunction writeByte(val, buf, pos) {\n buf[pos] = val & 255;\n}\n\nfunction writeVarint32(val, buf, pos) {\n while (val > 127) {\n buf[pos++] = val & 127 | 128;\n val >>>= 7;\n }\n buf[pos] = val;\n}\n\n/**\n * Constructs a new varint writer operation instance.\n * @classdesc Scheduled varint writer operation.\n * @extends Op\n * @constructor\n * @param {number} len Value byte length\n * @param {number} val Value to write\n * @ignore\n */\nfunction VarintOp(len, val) {\n this.len = len;\n this.next = undefined;\n this.val = val;\n}\n\nVarintOp.prototype = Object.create(Op.prototype);\nVarintOp.prototype.fn = writeVarint32;\n\n/**\n * Writes an unsigned 32 bit value as a varint.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.uint32 = function write_uint32(value) {\n // here, the call to this.push has been inlined and a varint specific Op subclass is used.\n // uint32 is by far the most frequently used operation and benefits significantly from this.\n this.len += (this.tail = this.tail.next = new VarintOp(\n (value = value >>> 0)\n < 128 ? 1\n : value < 16384 ? 2\n : value < 2097152 ? 3\n : value < 268435456 ? 4\n : 5,\n value)).len;\n return this;\n};\n\n/**\n * Writes a signed 32 bit value as a varint.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.int32 = function write_int32(value) {\n return value < 0\n ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec\n : this.uint32(value);\n};\n\n/**\n * Writes a 32 bit value as a varint, zig-zag encoded.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sint32 = function write_sint32(value) {\n return this.uint32((value << 1 ^ value >> 31) >>> 0);\n};\n\nfunction writeVarint64(val, buf, pos) {\n while (val.hi) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;\n val.hi >>>= 7;\n }\n while (val.lo > 127) {\n buf[pos++] = val.lo & 127 | 128;\n val.lo = val.lo >>> 7;\n }\n buf[pos++] = val.lo;\n}\n\n/**\n * Writes an unsigned 64 bit value as a varint.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.uint64 = function write_uint64(value) {\n var bits = LongBits.from(value);\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a signed 64 bit value as a varint.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.int64 = Writer.prototype.uint64;\n\n/**\n * Writes a signed 64 bit value as a varint, zig-zag encoded.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sint64 = function write_sint64(value) {\n var bits = LongBits.from(value).zzEncode();\n return this._push(writeVarint64, bits.length(), bits);\n};\n\n/**\n * Writes a boolish value as a varint.\n * @param {boolean} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bool = function write_bool(value) {\n return this._push(writeByte, 1, value ? 1 : 0);\n};\n\nfunction writeFixed32(val, buf, pos) {\n buf[pos ] = val & 255;\n buf[pos + 1] = val >>> 8 & 255;\n buf[pos + 2] = val >>> 16 & 255;\n buf[pos + 3] = val >>> 24;\n}\n\n/**\n * Writes an unsigned 32 bit value as fixed 32 bits.\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.fixed32 = function write_fixed32(value) {\n return this._push(writeFixed32, 4, value >>> 0);\n};\n\n/**\n * Writes a signed 32 bit value as fixed 32 bits.\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.sfixed32 = Writer.prototype.fixed32;\n\n/**\n * Writes an unsigned 64 bit value as fixed 64 bits.\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.fixed64 = function write_fixed64(value) {\n var bits = LongBits.from(value);\n return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi);\n};\n\n/**\n * Writes a signed 64 bit value as fixed 64 bits.\n * @function\n * @param {Long|number|string} value Value to write\n * @returns {Writer} `this`\n * @throws {TypeError} If `value` is a string and no long library is present.\n */\nWriter.prototype.sfixed64 = Writer.prototype.fixed64;\n\n/**\n * Writes a float (32 bit).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.float = function write_float(value) {\n return this._push(util.float.writeFloatLE, 4, value);\n};\n\n/**\n * Writes a double (64 bit float).\n * @function\n * @param {number} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.double = function write_double(value) {\n return this._push(util.float.writeDoubleLE, 8, value);\n};\n\nvar writeBytes = util.Array.prototype.set\n ? function writeBytes_set(val, buf, pos) {\n buf.set(val, pos); // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytes_for(val, buf, pos) {\n for (var i = 0; i < val.length; ++i)\n buf[pos + i] = val[i];\n };\n\n/**\n * Writes a sequence of bytes.\n * @param {Uint8Array|string} value Buffer or base64 encoded string to write\n * @returns {Writer} `this`\n */\nWriter.prototype.bytes = function write_bytes(value) {\n var len = value.length >>> 0;\n if (!len)\n return this._push(writeByte, 1, 0);\n if (util.isString(value)) {\n var buf = Writer.alloc(len = base64.length(value));\n base64.decode(value, buf, 0);\n value = buf;\n }\n return this.uint32(len)._push(writeBytes, len, value);\n};\n\n/**\n * Writes a string.\n * @param {string} value Value to write\n * @returns {Writer} `this`\n */\nWriter.prototype.string = function write_string(value) {\n var len = utf8.length(value);\n return len\n ? this.uint32(len)._push(utf8.write, len, value)\n : this._push(writeByte, 1, 0);\n};\n\n/**\n * Forks this writer's state by pushing it to a stack.\n * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state.\n * @returns {Writer} `this`\n */\nWriter.prototype.fork = function fork() {\n this.states = new State(this);\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n return this;\n};\n\n/**\n * Resets this instance to the last state.\n * @returns {Writer} `this`\n */\nWriter.prototype.reset = function reset() {\n if (this.states) {\n this.head = this.states.head;\n this.tail = this.states.tail;\n this.len = this.states.len;\n this.states = this.states.next;\n } else {\n this.head = this.tail = new Op(noop, 0, 0);\n this.len = 0;\n }\n return this;\n};\n\n/**\n * Resets to the last state and appends the fork state's current write length as a varint followed by its operations.\n * @returns {Writer} `this`\n */\nWriter.prototype.ldelim = function ldelim() {\n var head = this.head,\n tail = this.tail,\n len = this.len;\n this.reset().uint32(len);\n if (len) {\n this.tail.next = head.next; // skip noop\n this.tail = tail;\n this.len += len;\n }\n return this;\n};\n\n/**\n * Finishes the write operation.\n * @returns {Uint8Array} Finished buffer\n */\nWriter.prototype.finish = function finish() {\n var head = this.head.next, // skip noop\n buf = this.constructor.alloc(this.len),\n pos = 0;\n while (head) {\n head.fn(head.val, buf, pos);\n pos += head.len;\n head = head.next;\n }\n // this.head = this.tail = null;\n return buf;\n};\n\nWriter._configure = function(BufferWriter_) {\n BufferWriter = BufferWriter_;\n Writer.create = create();\n BufferWriter._configure();\n};\n","\"use strict\";\nmodule.exports = BufferWriter;\n\n// extends Writer\nvar Writer = require(\"./writer\");\n(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;\n\nvar util = require(\"./util/minimal\");\n\n/**\n * Constructs a new buffer writer instance.\n * @classdesc Wire format writer using node buffers.\n * @extends Writer\n * @constructor\n */\nfunction BufferWriter() {\n Writer.call(this);\n}\n\nBufferWriter._configure = function () {\n /**\n * Allocates a buffer of the specified size.\n * @function\n * @param {number} size Buffer size\n * @returns {Buffer} Buffer\n */\n BufferWriter.alloc = util._Buffer_allocUnsafe;\n\n BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === \"set\"\n ? function writeBytesBuffer_set(val, buf, pos) {\n buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited)\n // also works for plain array values\n }\n /* istanbul ignore next */\n : function writeBytesBuffer_copy(val, buf, pos) {\n if (val.copy) // Buffer values\n val.copy(buf, pos, 0, val.length);\n else for (var i = 0; i < val.length;) // plain array values\n buf[pos++] = val[i++];\n };\n};\n\n\n/**\n * @override\n */\nBufferWriter.prototype.bytes = function write_bytes_buffer(value) {\n if (util.isString(value))\n value = util._Buffer_from(value, \"base64\");\n var len = value.length >>> 0;\n this.uint32(len);\n if (len)\n this._push(BufferWriter.writeBytesBuffer, len, value);\n return this;\n};\n\nfunction writeStringBuffer(val, buf, pos) {\n if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions)\n util.utf8.write(val, buf, pos);\n else if (buf.utf8Write)\n buf.utf8Write(val, pos);\n else\n buf.write(val, pos);\n}\n\n/**\n * @override\n */\nBufferWriter.prototype.string = function write_string_buffer(value) {\n var len = util.Buffer.byteLength(value);\n this.uint32(len);\n if (len)\n this._push(writeStringBuffer, len, value);\n return this;\n};\n\n\n/**\n * Finishes the write operation.\n * @name BufferWriter#finish\n * @function\n * @returns {Buffer} Finished buffer\n */\n\nBufferWriter._configure();\n","\"use strict\";\nmodule.exports = Reader;\n\nvar util = require(\"./util/minimal\");\n\nvar BufferReader; // cyclic\n\nvar LongBits = util.LongBits,\n utf8 = util.utf8;\n\n/* istanbul ignore next */\nfunction indexOutOfRange(reader, writeLength) {\n return RangeError(\"index out of range: \" + reader.pos + \" + \" + (writeLength || 1) + \" > \" + reader.len);\n}\n\n/**\n * Constructs a new reader instance using the specified buffer.\n * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`.\n * @constructor\n * @param {Uint8Array} buffer Buffer to read from\n */\nfunction Reader(buffer) {\n\n /**\n * Read buffer.\n * @type {Uint8Array}\n */\n this.buf = buffer;\n\n /**\n * Read buffer position.\n * @type {number}\n */\n this.pos = 0;\n\n /**\n * Read buffer length.\n * @type {number}\n */\n this.len = buffer.length;\n}\n\nvar create_array = typeof Uint8Array !== \"undefined\"\n ? function create_typed_array(buffer) {\n if (buffer instanceof Uint8Array || Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n }\n /* istanbul ignore next */\n : function create_array(buffer) {\n if (Array.isArray(buffer))\n return new Reader(buffer);\n throw Error(\"illegal buffer\");\n };\n\nvar create = function create() {\n return util.Buffer\n ? function create_buffer_setup(buffer) {\n return (Reader.create = function create_buffer(buffer) {\n return util.Buffer.isBuffer(buffer)\n ? new BufferReader(buffer)\n /* istanbul ignore next */\n : create_array(buffer);\n })(buffer);\n }\n /* istanbul ignore next */\n : create_array;\n};\n\n/**\n * Creates a new reader using the specified buffer.\n * @function\n * @param {Uint8Array|Buffer} buffer Buffer to read from\n * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader}\n * @throws {Error} If `buffer` is not a valid buffer\n */\nReader.create = create();\n\nReader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice;\n\n/**\n * Reads a varint as an unsigned 32 bit value.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.uint32 = (function read_uint32_setup() {\n var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!)\n return function read_uint32() {\n value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value;\n value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value;\n\n /* istanbul ignore if */\n if ((this.pos += 5) > this.len) {\n this.pos = this.len;\n throw indexOutOfRange(this, 10);\n }\n return value;\n };\n})();\n\n/**\n * Reads a varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.int32 = function read_int32() {\n return this.uint32() | 0;\n};\n\n/**\n * Reads a zig-zag encoded varint as a signed 32 bit value.\n * @returns {number} Value read\n */\nReader.prototype.sint32 = function read_sint32() {\n var value = this.uint32();\n return value >>> 1 ^ -(value & 1) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readLongVarint() {\n // tends to deopt with local vars for octet etc.\n var bits = new LongBits(0, 0);\n var i = 0;\n if (this.len - this.pos > 4) { // fast route (lo)\n for (; i < 4; ++i) {\n // 1st..4th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 5th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n i = 0;\n } else {\n for (; i < 3; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 1st..3th\n bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n // 4th\n bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;\n return bits;\n }\n if (this.len - this.pos > 4) { // fast route (hi)\n for (; i < 5; ++i) {\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n } else {\n for (; i < 5; ++i) {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n // 6th..10th\n bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;\n if (this.buf[this.pos++] < 128)\n return bits;\n }\n }\n /* istanbul ignore next */\n throw Error(\"invalid varint encoding\");\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads a varint as a signed 64 bit value.\n * @name Reader#int64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as an unsigned 64 bit value.\n * @name Reader#uint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a zig-zag encoded varint as a signed 64 bit value.\n * @name Reader#sint64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a varint as a boolean.\n * @returns {boolean} Value read\n */\nReader.prototype.bool = function read_bool() {\n return this.uint32() !== 0;\n};\n\nfunction readFixed32_end(buf, end) { // note that this uses `end`, not `pos`\n return (buf[end - 4]\n | buf[end - 3] << 8\n | buf[end - 2] << 16\n | buf[end - 1] << 24) >>> 0;\n}\n\n/**\n * Reads fixed 32 bits as an unsigned 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.fixed32 = function read_fixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4);\n};\n\n/**\n * Reads fixed 32 bits as a signed 32 bit integer.\n * @returns {number} Value read\n */\nReader.prototype.sfixed32 = function read_sfixed32() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n return readFixed32_end(this.buf, this.pos += 4) | 0;\n};\n\n/* eslint-disable no-invalid-this */\n\nfunction readFixed64(/* this: Reader */) {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 8);\n\n return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));\n}\n\n/* eslint-enable no-invalid-this */\n\n/**\n * Reads fixed 64 bits.\n * @name Reader#fixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads zig-zag encoded fixed 64 bits.\n * @name Reader#sfixed64\n * @function\n * @returns {Long} Value read\n */\n\n/**\n * Reads a float (32 bit) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.float = function read_float() {\n\n /* istanbul ignore if */\n if (this.pos + 4 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readFloatLE(this.buf, this.pos);\n this.pos += 4;\n return value;\n};\n\n/**\n * Reads a double (64 bit float) as a number.\n * @function\n * @returns {number} Value read\n */\nReader.prototype.double = function read_double() {\n\n /* istanbul ignore if */\n if (this.pos + 8 > this.len)\n throw indexOutOfRange(this, 4);\n\n var value = util.float.readDoubleLE(this.buf, this.pos);\n this.pos += 8;\n return value;\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @returns {Uint8Array} Value read\n */\nReader.prototype.bytes = function read_bytes() {\n var length = this.uint32(),\n start = this.pos,\n end = this.pos + length;\n\n /* istanbul ignore if */\n if (end > this.len)\n throw indexOutOfRange(this, length);\n\n this.pos += length;\n if (Array.isArray(this.buf)) // plain array\n return this.buf.slice(start, end);\n\n if (start === end) { // fix for IE 10/Win8 and others' subarray returning array of size 1\n var nativeBuffer = util.Buffer;\n return nativeBuffer\n ? nativeBuffer.alloc(0)\n : new this.buf.constructor(0);\n }\n return this._slice.call(this.buf, start, end);\n};\n\n/**\n * Reads a string preceeded by its byte length as a varint.\n * @returns {string} Value read\n */\nReader.prototype.string = function read_string() {\n var bytes = this.bytes();\n return utf8.read(bytes, 0, bytes.length);\n};\n\n/**\n * Skips the specified number of bytes if specified, otherwise skips a varint.\n * @param {number} [length] Length if known, otherwise a varint is assumed\n * @returns {Reader} `this`\n */\nReader.prototype.skip = function skip(length) {\n if (typeof length === \"number\") {\n /* istanbul ignore if */\n if (this.pos + length > this.len)\n throw indexOutOfRange(this, length);\n this.pos += length;\n } else {\n do {\n /* istanbul ignore if */\n if (this.pos >= this.len)\n throw indexOutOfRange(this);\n } while (this.buf[this.pos++] & 128);\n }\n return this;\n};\n\n/**\n * Skips the next element of the specified wire type.\n * @param {number} wireType Wire type received\n * @returns {Reader} `this`\n */\nReader.prototype.skipType = function(wireType) {\n switch (wireType) {\n case 0:\n this.skip();\n break;\n case 1:\n this.skip(8);\n break;\n case 2:\n this.skip(this.uint32());\n break;\n case 3:\n while ((wireType = this.uint32() & 7) !== 4) {\n this.skipType(wireType);\n }\n break;\n case 5:\n this.skip(4);\n break;\n\n /* istanbul ignore next */\n default:\n throw Error(\"invalid wire type \" + wireType + \" at offset \" + this.pos);\n }\n return this;\n};\n\nReader._configure = function(BufferReader_) {\n BufferReader = BufferReader_;\n Reader.create = create();\n BufferReader._configure();\n\n var fn = util.Long ? \"toLong\" : /* istanbul ignore next */ \"toNumber\";\n util.merge(Reader.prototype, {\n\n int64: function read_int64() {\n return readLongVarint.call(this)[fn](false);\n },\n\n uint64: function read_uint64() {\n return readLongVarint.call(this)[fn](true);\n },\n\n sint64: function read_sint64() {\n return readLongVarint.call(this).zzDecode()[fn](false);\n },\n\n fixed64: function read_fixed64() {\n return readFixed64.call(this)[fn](true);\n },\n\n sfixed64: function read_sfixed64() {\n return readFixed64.call(this)[fn](false);\n }\n\n });\n};\n","\"use strict\";\nmodule.exports = BufferReader;\n\n// extends Reader\nvar Reader = require(\"./reader\");\n(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;\n\nvar util = require(\"./util/minimal\");\n\n/**\n * Constructs a new buffer reader instance.\n * @classdesc Wire format reader using node buffers.\n * @extends Reader\n * @constructor\n * @param {Buffer} buffer Buffer to read from\n */\nfunction BufferReader(buffer) {\n Reader.call(this, buffer);\n\n /**\n * Read buffer.\n * @name BufferReader#buf\n * @type {Buffer}\n */\n}\n\nBufferReader._configure = function () {\n /* istanbul ignore else */\n if (util.Buffer)\n BufferReader.prototype._slice = util.Buffer.prototype.slice;\n};\n\n\n/**\n * @override\n */\nBufferReader.prototype.string = function read_string_buffer() {\n var len = this.uint32(); // modifies pos\n return this.buf.utf8Slice\n ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len))\n : this.buf.toString(\"utf-8\", this.pos, this.pos = Math.min(this.pos + len, this.len));\n};\n\n/**\n * Reads a sequence of bytes preceeded by its length as a varint.\n * @name BufferReader#bytes\n * @function\n * @returns {Buffer} Value read\n */\n\nBufferReader._configure();\n","\"use strict\";\nmodule.exports = Service;\n\nvar util = require(\"../util/minimal\");\n\n// Extends EventEmitter\n(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;\n\n/**\n * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}.\n *\n * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`.\n * @typedef rpc.ServiceMethodCallback\n * @template TRes extends Message\n * @type {function}\n * @param {Error|null} error Error, if any\n * @param {TRes} [response] Response message\n * @returns {undefined}\n */\n\n/**\n * A service method part of a {@link rpc.Service} as created by {@link Service.create}.\n * @typedef rpc.ServiceMethod\n * @template TReq extends Message\n * @template TRes extends Message\n * @type {function}\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message\n * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined`\n */\n\n/**\n * Constructs a new RPC service instance.\n * @classdesc An RPC service as returned by {@link Service#create}.\n * @exports rpc.Service\n * @extends util.EventEmitter\n * @constructor\n * @param {RPCImpl} rpcImpl RPC implementation\n * @param {boolean} [requestDelimited=false] Whether requests are length-delimited\n * @param {boolean} [responseDelimited=false] Whether responses are length-delimited\n */\nfunction Service(rpcImpl, requestDelimited, responseDelimited) {\n\n if (typeof rpcImpl !== \"function\")\n throw TypeError(\"rpcImpl must be a function\");\n\n util.EventEmitter.call(this);\n\n /**\n * RPC implementation. Becomes `null` once the service is ended.\n * @type {RPCImpl|null}\n */\n this.rpcImpl = rpcImpl;\n\n /**\n * Whether requests are length-delimited.\n * @type {boolean}\n */\n this.requestDelimited = Boolean(requestDelimited);\n\n /**\n * Whether responses are length-delimited.\n * @type {boolean}\n */\n this.responseDelimited = Boolean(responseDelimited);\n}\n\n/**\n * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}.\n * @param {Method|rpc.ServiceMethod} method Reflected or static method\n * @param {Constructor} requestCtor Request constructor\n * @param {Constructor} responseCtor Response constructor\n * @param {TReq|Properties} request Request message or plain object\n * @param {rpc.ServiceMethodCallback} callback Service callback\n * @returns {undefined}\n * @template TReq extends Message\n * @template TRes extends Message\n */\nService.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {\n\n if (!request)\n throw TypeError(\"request must be specified\");\n\n var self = this;\n if (!callback)\n return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request);\n\n if (!self.rpcImpl) {\n setTimeout(function() { callback(Error(\"already ended\")); }, 0);\n return undefined;\n }\n\n try {\n return self.rpcImpl(\n method,\n requestCtor[self.requestDelimited ? \"encodeDelimited\" : \"encode\"](request).finish(),\n function rpcCallback(err, response) {\n\n if (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n\n if (response === null) {\n self.end(/* endedByRPC */ true);\n return undefined;\n }\n\n if (!(response instanceof responseCtor)) {\n try {\n response = responseCtor[self.responseDelimited ? \"decodeDelimited\" : \"decode\"](response);\n } catch (err) {\n self.emit(\"error\", err, method);\n return callback(err);\n }\n }\n\n self.emit(\"data\", response, method);\n return callback(null, response);\n }\n );\n } catch (err) {\n self.emit(\"error\", err, method);\n setTimeout(function() { callback(err); }, 0);\n return undefined;\n }\n};\n\n/**\n * Ends this service and emits the `end` event.\n * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation.\n * @returns {rpc.Service} `this`\n */\nService.prototype.end = function end(endedByRPC) {\n if (this.rpcImpl) {\n if (!endedByRPC) // signal end to rpcImpl\n this.rpcImpl(null, null, null);\n this.rpcImpl = null;\n this.emit(\"end\").off();\n }\n return this;\n};\n","\"use strict\";\n\n/**\n * Streaming RPC helpers.\n * @namespace\n */\nvar rpc = exports;\n\n/**\n * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.\n * @typedef RPCImpl\n * @type {function}\n * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called\n * @param {Uint8Array} requestData Request data\n * @param {RPCImplCallback} callback Callback function\n * @returns {undefined}\n * @example\n * function rpcImpl(method, requestData, callback) {\n * if (protobuf.util.lcFirst(method.name) !== \"myMethod\") // compatible with static code\n * throw Error(\"no such method\");\n * asynchronouslyObtainAResponse(requestData, function(err, responseData) {\n * callback(err, responseData);\n * });\n * }\n */\n\n/**\n * Node-style callback as used by {@link RPCImpl}.\n * @typedef RPCImplCallback\n * @type {function}\n * @param {Error|null} error Error, if any, otherwise `null`\n * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error\n * @returns {undefined}\n */\n\nrpc.Service = require(\"./rpc/service\");\n","\"use strict\";\nmodule.exports = {};\n\n/**\n * Named roots.\n * This is where pbjs stores generated structures (the option `-r, --root` specifies a name).\n * Can also be used manually to make roots available across modules.\n * @name roots\n * @type {Object.}\n * @example\n * // pbjs -r myroot -o compiled.js ...\n *\n * // in another module:\n * require(\"./compiled.js\");\n *\n * // in any subsequent module:\n * var root = protobuf.roots[\"myroot\"];\n */\n","\"use strict\";\nvar protobuf = exports;\n\n/**\n * Build type, one of `\"full\"`, `\"light\"` or `\"minimal\"`.\n * @name build\n * @type {string}\n * @const\n */\nprotobuf.build = \"minimal\";\n\n// Serialization\nprotobuf.Writer = require(\"./writer\");\nprotobuf.BufferWriter = require(\"./writer_buffer\");\nprotobuf.Reader = require(\"./reader\");\nprotobuf.BufferReader = require(\"./reader_buffer\");\n\n// Utility\nprotobuf.util = require(\"./util/minimal\");\nprotobuf.rpc = require(\"./rpc\");\nprotobuf.roots = require(\"./roots\");\nprotobuf.configure = configure;\n\n/* istanbul ignore next */\n/**\n * Reconfigures the library according to the environment.\n * @returns {undefined}\n */\nfunction configure() {\n protobuf.util._configure();\n protobuf.Writer._configure(protobuf.BufferWriter);\n protobuf.Reader._configure(protobuf.BufferReader);\n}\n\n// Set up buffer utility according to the environment\nconfigure();\n","// minimal library entry point.\n\n\"use strict\";\nmodule.exports = require(\"./src/index-minimal\");\n","/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/\n\"use strict\";\n\nvar $protobuf = require(\"protobufjs/minimal\");\n\n// Common aliases\nvar $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;\n\n// Exported root namespace\nvar $root = $protobuf.roots[\"default\"] || ($protobuf.roots[\"default\"] = {});\n\n$root.onnx = (function() {\n\n /**\n * Namespace onnx.\n * @exports onnx\n * @namespace\n */\n var onnx = {};\n\n /**\n * Version enum.\n * @name onnx.Version\n * @enum {number}\n * @property {number} _START_VERSION=0 _START_VERSION value\n * @property {number} IR_VERSION_2017_10_10=1 IR_VERSION_2017_10_10 value\n * @property {number} IR_VERSION_2017_10_30=2 IR_VERSION_2017_10_30 value\n * @property {number} IR_VERSION_2017_11_3=3 IR_VERSION_2017_11_3 value\n * @property {number} IR_VERSION_2019_1_22=4 IR_VERSION_2019_1_22 value\n * @property {number} IR_VERSION_2019_3_18=5 IR_VERSION_2019_3_18 value\n * @property {number} IR_VERSION_2019_9_19=6 IR_VERSION_2019_9_19 value\n * @property {number} IR_VERSION_2020_5_8=7 IR_VERSION_2020_5_8 value\n * @property {number} IR_VERSION_2021_7_30=8 IR_VERSION_2021_7_30 value\n * @property {number} IR_VERSION=9 IR_VERSION value\n */\n onnx.Version = (function() {\n var valuesById = {}, values = Object.create(valuesById);\n values[valuesById[0] = \"_START_VERSION\"] = 0;\n values[valuesById[1] = \"IR_VERSION_2017_10_10\"] = 1;\n values[valuesById[2] = \"IR_VERSION_2017_10_30\"] = 2;\n values[valuesById[3] = \"IR_VERSION_2017_11_3\"] = 3;\n values[valuesById[4] = \"IR_VERSION_2019_1_22\"] = 4;\n values[valuesById[5] = \"IR_VERSION_2019_3_18\"] = 5;\n values[valuesById[6] = \"IR_VERSION_2019_9_19\"] = 6;\n values[valuesById[7] = \"IR_VERSION_2020_5_8\"] = 7;\n values[valuesById[8] = \"IR_VERSION_2021_7_30\"] = 8;\n values[valuesById[9] = \"IR_VERSION\"] = 9;\n return values;\n })();\n\n onnx.AttributeProto = (function() {\n\n /**\n * Properties of an AttributeProto.\n * @memberof onnx\n * @interface IAttributeProto\n * @property {string|null} [name] AttributeProto name\n * @property {string|null} [refAttrName] AttributeProto refAttrName\n * @property {string|null} [docString] AttributeProto docString\n * @property {onnx.AttributeProto.AttributeType|null} [type] AttributeProto type\n * @property {number|null} [f] AttributeProto f\n * @property {number|Long|null} [i] AttributeProto i\n * @property {Uint8Array|null} [s] AttributeProto s\n * @property {onnx.ITensorProto|null} [t] AttributeProto t\n * @property {onnx.IGraphProto|null} [g] AttributeProto g\n * @property {onnx.ISparseTensorProto|null} [sparseTensor] AttributeProto sparseTensor\n * @property {onnx.ITypeProto|null} [tp] AttributeProto tp\n * @property {Array.|null} [floats] AttributeProto floats\n * @property {Array.|null} [ints] AttributeProto ints\n * @property {Array.|null} [strings] AttributeProto strings\n * @property {Array.|null} [tensors] AttributeProto tensors\n * @property {Array.|null} [graphs] AttributeProto graphs\n * @property {Array.|null} [sparseTensors] AttributeProto sparseTensors\n * @property {Array.|null} [typeProtos] AttributeProto typeProtos\n */\n\n /**\n * Constructs a new AttributeProto.\n * @memberof onnx\n * @classdesc Represents an AttributeProto.\n * @implements IAttributeProto\n * @constructor\n * @param {onnx.IAttributeProto=} [properties] Properties to set\n */\n function AttributeProto(properties) {\n this.floats = [];\n this.ints = [];\n this.strings = [];\n this.tensors = [];\n this.graphs = [];\n this.sparseTensors = [];\n this.typeProtos = [];\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * AttributeProto name.\n * @member {string} name\n * @memberof onnx.AttributeProto\n * @instance\n */\n AttributeProto.prototype.name = \"\";\n\n /**\n * AttributeProto refAttrName.\n * @member {string} refAttrName\n * @memberof onnx.AttributeProto\n * @instance\n */\n AttributeProto.prototype.refAttrName = \"\";\n\n /**\n * AttributeProto docString.\n * @member {string} docString\n * @memberof onnx.AttributeProto\n * @instance\n */\n AttributeProto.prototype.docString = \"\";\n\n /**\n * AttributeProto type.\n * @member {onnx.AttributeProto.AttributeType} type\n * @memberof onnx.AttributeProto\n * @instance\n */\n AttributeProto.prototype.type = 0;\n\n /**\n * AttributeProto f.\n * @member {number} f\n * @memberof onnx.AttributeProto\n * @instance\n */\n AttributeProto.prototype.f = 0;\n\n /**\n * AttributeProto i.\n * @member {number|Long} i\n * @memberof onnx.AttributeProto\n * @instance\n */\n AttributeProto.prototype.i = $util.Long ? $util.Long.fromBits(0,0,false) : 0;\n\n /**\n * AttributeProto s.\n * @member {Uint8Array} s\n * @memberof onnx.AttributeProto\n * @instance\n */\n AttributeProto.prototype.s = $util.newBuffer([]);\n\n /**\n * AttributeProto t.\n * @member {onnx.ITensorProto|null|undefined} t\n * @memberof onnx.AttributeProto\n * @instance\n */\n AttributeProto.prototype.t = null;\n\n /**\n * AttributeProto g.\n * @member {onnx.IGraphProto|null|undefined} g\n * @memberof onnx.AttributeProto\n * @instance\n */\n AttributeProto.prototype.g = null;\n\n /**\n * AttributeProto sparseTensor.\n * @member {onnx.ISparseTensorProto|null|undefined} sparseTensor\n * @memberof onnx.AttributeProto\n * @instance\n */\n AttributeProto.prototype.sparseTensor = null;\n\n /**\n * AttributeProto tp.\n * @member {onnx.ITypeProto|null|undefined} tp\n * @memberof onnx.AttributeProto\n * @instance\n */\n AttributeProto.prototype.tp = null;\n\n /**\n * AttributeProto floats.\n * @member {Array.} floats\n * @memberof onnx.AttributeProto\n * @instance\n */\n AttributeProto.prototype.floats = $util.emptyArray;\n\n /**\n * AttributeProto ints.\n * @member {Array.} ints\n * @memberof onnx.AttributeProto\n * @instance\n */\n AttributeProto.prototype.ints = $util.emptyArray;\n\n /**\n * AttributeProto strings.\n * @member {Array.} strings\n * @memberof onnx.AttributeProto\n * @instance\n */\n AttributeProto.prototype.strings = $util.emptyArray;\n\n /**\n * AttributeProto tensors.\n * @member {Array.} tensors\n * @memberof onnx.AttributeProto\n * @instance\n */\n AttributeProto.prototype.tensors = $util.emptyArray;\n\n /**\n * AttributeProto graphs.\n * @member {Array.} graphs\n * @memberof onnx.AttributeProto\n * @instance\n */\n AttributeProto.prototype.graphs = $util.emptyArray;\n\n /**\n * AttributeProto sparseTensors.\n * @member {Array.} sparseTensors\n * @memberof onnx.AttributeProto\n * @instance\n */\n AttributeProto.prototype.sparseTensors = $util.emptyArray;\n\n /**\n * AttributeProto typeProtos.\n * @member {Array.} typeProtos\n * @memberof onnx.AttributeProto\n * @instance\n */\n AttributeProto.prototype.typeProtos = $util.emptyArray;\n\n /**\n * Creates a new AttributeProto instance using the specified properties.\n * @function create\n * @memberof onnx.AttributeProto\n * @static\n * @param {onnx.IAttributeProto=} [properties] Properties to set\n * @returns {onnx.AttributeProto} AttributeProto instance\n */\n AttributeProto.create = function create(properties) {\n return new AttributeProto(properties);\n };\n\n /**\n * Encodes the specified AttributeProto message. Does not implicitly {@link onnx.AttributeProto.verify|verify} messages.\n * @function encode\n * @memberof onnx.AttributeProto\n * @static\n * @param {onnx.IAttributeProto} message AttributeProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n AttributeProto.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.name != null && Object.hasOwnProperty.call(message, \"name\"))\n writer.uint32(/* id 1, wireType 2 =*/10).string(message.name);\n if (message.f != null && Object.hasOwnProperty.call(message, \"f\"))\n writer.uint32(/* id 2, wireType 5 =*/21).float(message.f);\n if (message.i != null && Object.hasOwnProperty.call(message, \"i\"))\n writer.uint32(/* id 3, wireType 0 =*/24).int64(message.i);\n if (message.s != null && Object.hasOwnProperty.call(message, \"s\"))\n writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.s);\n if (message.t != null && Object.hasOwnProperty.call(message, \"t\"))\n $root.onnx.TensorProto.encode(message.t, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();\n if (message.g != null && Object.hasOwnProperty.call(message, \"g\"))\n $root.onnx.GraphProto.encode(message.g, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();\n if (message.floats != null && message.floats.length) {\n writer.uint32(/* id 7, wireType 2 =*/58).fork();\n for (var i = 0; i < message.floats.length; ++i)\n writer.float(message.floats[i]);\n writer.ldelim();\n }\n if (message.ints != null && message.ints.length) {\n writer.uint32(/* id 8, wireType 2 =*/66).fork();\n for (var i = 0; i < message.ints.length; ++i)\n writer.int64(message.ints[i]);\n writer.ldelim();\n }\n if (message.strings != null && message.strings.length)\n for (var i = 0; i < message.strings.length; ++i)\n writer.uint32(/* id 9, wireType 2 =*/74).bytes(message.strings[i]);\n if (message.tensors != null && message.tensors.length)\n for (var i = 0; i < message.tensors.length; ++i)\n $root.onnx.TensorProto.encode(message.tensors[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim();\n if (message.graphs != null && message.graphs.length)\n for (var i = 0; i < message.graphs.length; ++i)\n $root.onnx.GraphProto.encode(message.graphs[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim();\n if (message.docString != null && Object.hasOwnProperty.call(message, \"docString\"))\n writer.uint32(/* id 13, wireType 2 =*/106).string(message.docString);\n if (message.tp != null && Object.hasOwnProperty.call(message, \"tp\"))\n $root.onnx.TypeProto.encode(message.tp, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim();\n if (message.typeProtos != null && message.typeProtos.length)\n for (var i = 0; i < message.typeProtos.length; ++i)\n $root.onnx.TypeProto.encode(message.typeProtos[i], writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim();\n if (message.type != null && Object.hasOwnProperty.call(message, \"type\"))\n writer.uint32(/* id 20, wireType 0 =*/160).int32(message.type);\n if (message.refAttrName != null && Object.hasOwnProperty.call(message, \"refAttrName\"))\n writer.uint32(/* id 21, wireType 2 =*/170).string(message.refAttrName);\n if (message.sparseTensor != null && Object.hasOwnProperty.call(message, \"sparseTensor\"))\n $root.onnx.SparseTensorProto.encode(message.sparseTensor, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim();\n if (message.sparseTensors != null && message.sparseTensors.length)\n for (var i = 0; i < message.sparseTensors.length; ++i)\n $root.onnx.SparseTensorProto.encode(message.sparseTensors[i], writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim();\n return writer;\n };\n\n /**\n * Encodes the specified AttributeProto message, length delimited. Does not implicitly {@link onnx.AttributeProto.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.AttributeProto\n * @static\n * @param {onnx.IAttributeProto} message AttributeProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n AttributeProto.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes an AttributeProto message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.AttributeProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.AttributeProto} AttributeProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n AttributeProto.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.AttributeProto();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n message.name = reader.string();\n break;\n }\n case 21: {\n message.refAttrName = reader.string();\n break;\n }\n case 13: {\n message.docString = reader.string();\n break;\n }\n case 20: {\n message.type = reader.int32();\n break;\n }\n case 2: {\n message.f = reader.float();\n break;\n }\n case 3: {\n message.i = reader.int64();\n break;\n }\n case 4: {\n message.s = reader.bytes();\n break;\n }\n case 5: {\n message.t = $root.onnx.TensorProto.decode(reader, reader.uint32());\n break;\n }\n case 6: {\n message.g = $root.onnx.GraphProto.decode(reader, reader.uint32());\n break;\n }\n case 22: {\n message.sparseTensor = $root.onnx.SparseTensorProto.decode(reader, reader.uint32());\n break;\n }\n case 14: {\n message.tp = $root.onnx.TypeProto.decode(reader, reader.uint32());\n break;\n }\n case 7: {\n if (!(message.floats && message.floats.length))\n message.floats = [];\n if ((tag & 7) === 2) {\n var end2 = reader.uint32() + reader.pos;\n while (reader.pos < end2)\n message.floats.push(reader.float());\n } else\n message.floats.push(reader.float());\n break;\n }\n case 8: {\n if (!(message.ints && message.ints.length))\n message.ints = [];\n if ((tag & 7) === 2) {\n var end2 = reader.uint32() + reader.pos;\n while (reader.pos < end2)\n message.ints.push(reader.int64());\n } else\n message.ints.push(reader.int64());\n break;\n }\n case 9: {\n if (!(message.strings && message.strings.length))\n message.strings = [];\n message.strings.push(reader.bytes());\n break;\n }\n case 10: {\n if (!(message.tensors && message.tensors.length))\n message.tensors = [];\n message.tensors.push($root.onnx.TensorProto.decode(reader, reader.uint32()));\n break;\n }\n case 11: {\n if (!(message.graphs && message.graphs.length))\n message.graphs = [];\n message.graphs.push($root.onnx.GraphProto.decode(reader, reader.uint32()));\n break;\n }\n case 23: {\n if (!(message.sparseTensors && message.sparseTensors.length))\n message.sparseTensors = [];\n message.sparseTensors.push($root.onnx.SparseTensorProto.decode(reader, reader.uint32()));\n break;\n }\n case 15: {\n if (!(message.typeProtos && message.typeProtos.length))\n message.typeProtos = [];\n message.typeProtos.push($root.onnx.TypeProto.decode(reader, reader.uint32()));\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes an AttributeProto message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.AttributeProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.AttributeProto} AttributeProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n AttributeProto.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies an AttributeProto message.\n * @function verify\n * @memberof onnx.AttributeProto\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n AttributeProto.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.name != null && message.hasOwnProperty(\"name\"))\n if (!$util.isString(message.name))\n return \"name: string expected\";\n if (message.refAttrName != null && message.hasOwnProperty(\"refAttrName\"))\n if (!$util.isString(message.refAttrName))\n return \"refAttrName: string expected\";\n if (message.docString != null && message.hasOwnProperty(\"docString\"))\n if (!$util.isString(message.docString))\n return \"docString: string expected\";\n if (message.type != null && message.hasOwnProperty(\"type\"))\n switch (message.type) {\n default:\n return \"type: enum value expected\";\n case 0:\n case 1:\n case 2:\n case 3:\n case 4:\n case 5:\n case 11:\n case 13:\n case 6:\n case 7:\n case 8:\n case 9:\n case 10:\n case 12:\n case 14:\n break;\n }\n if (message.f != null && message.hasOwnProperty(\"f\"))\n if (typeof message.f !== \"number\")\n return \"f: number expected\";\n if (message.i != null && message.hasOwnProperty(\"i\"))\n if (!$util.isInteger(message.i) && !(message.i && $util.isInteger(message.i.low) && $util.isInteger(message.i.high)))\n return \"i: integer|Long expected\";\n if (message.s != null && message.hasOwnProperty(\"s\"))\n if (!(message.s && typeof message.s.length === \"number\" || $util.isString(message.s)))\n return \"s: buffer expected\";\n if (message.t != null && message.hasOwnProperty(\"t\")) {\n var error = $root.onnx.TensorProto.verify(message.t);\n if (error)\n return \"t.\" + error;\n }\n if (message.g != null && message.hasOwnProperty(\"g\")) {\n var error = $root.onnx.GraphProto.verify(message.g);\n if (error)\n return \"g.\" + error;\n }\n if (message.sparseTensor != null && message.hasOwnProperty(\"sparseTensor\")) {\n var error = $root.onnx.SparseTensorProto.verify(message.sparseTensor);\n if (error)\n return \"sparseTensor.\" + error;\n }\n if (message.tp != null && message.hasOwnProperty(\"tp\")) {\n var error = $root.onnx.TypeProto.verify(message.tp);\n if (error)\n return \"tp.\" + error;\n }\n if (message.floats != null && message.hasOwnProperty(\"floats\")) {\n if (!Array.isArray(message.floats))\n return \"floats: array expected\";\n for (var i = 0; i < message.floats.length; ++i)\n if (typeof message.floats[i] !== \"number\")\n return \"floats: number[] expected\";\n }\n if (message.ints != null && message.hasOwnProperty(\"ints\")) {\n if (!Array.isArray(message.ints))\n return \"ints: array expected\";\n for (var i = 0; i < message.ints.length; ++i)\n if (!$util.isInteger(message.ints[i]) && !(message.ints[i] && $util.isInteger(message.ints[i].low) && $util.isInteger(message.ints[i].high)))\n return \"ints: integer|Long[] expected\";\n }\n if (message.strings != null && message.hasOwnProperty(\"strings\")) {\n if (!Array.isArray(message.strings))\n return \"strings: array expected\";\n for (var i = 0; i < message.strings.length; ++i)\n if (!(message.strings[i] && typeof message.strings[i].length === \"number\" || $util.isString(message.strings[i])))\n return \"strings: buffer[] expected\";\n }\n if (message.tensors != null && message.hasOwnProperty(\"tensors\")) {\n if (!Array.isArray(message.tensors))\n return \"tensors: array expected\";\n for (var i = 0; i < message.tensors.length; ++i) {\n var error = $root.onnx.TensorProto.verify(message.tensors[i]);\n if (error)\n return \"tensors.\" + error;\n }\n }\n if (message.graphs != null && message.hasOwnProperty(\"graphs\")) {\n if (!Array.isArray(message.graphs))\n return \"graphs: array expected\";\n for (var i = 0; i < message.graphs.length; ++i) {\n var error = $root.onnx.GraphProto.verify(message.graphs[i]);\n if (error)\n return \"graphs.\" + error;\n }\n }\n if (message.sparseTensors != null && message.hasOwnProperty(\"sparseTensors\")) {\n if (!Array.isArray(message.sparseTensors))\n return \"sparseTensors: array expected\";\n for (var i = 0; i < message.sparseTensors.length; ++i) {\n var error = $root.onnx.SparseTensorProto.verify(message.sparseTensors[i]);\n if (error)\n return \"sparseTensors.\" + error;\n }\n }\n if (message.typeProtos != null && message.hasOwnProperty(\"typeProtos\")) {\n if (!Array.isArray(message.typeProtos))\n return \"typeProtos: array expected\";\n for (var i = 0; i < message.typeProtos.length; ++i) {\n var error = $root.onnx.TypeProto.verify(message.typeProtos[i]);\n if (error)\n return \"typeProtos.\" + error;\n }\n }\n return null;\n };\n\n /**\n * Creates an AttributeProto message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.AttributeProto\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.AttributeProto} AttributeProto\n */\n AttributeProto.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.AttributeProto)\n return object;\n var message = new $root.onnx.AttributeProto();\n if (object.name != null)\n message.name = String(object.name);\n if (object.refAttrName != null)\n message.refAttrName = String(object.refAttrName);\n if (object.docString != null)\n message.docString = String(object.docString);\n switch (object.type) {\n default:\n if (typeof object.type === \"number\") {\n message.type = object.type;\n break;\n }\n break;\n case \"UNDEFINED\":\n case 0:\n message.type = 0;\n break;\n case \"FLOAT\":\n case 1:\n message.type = 1;\n break;\n case \"INT\":\n case 2:\n message.type = 2;\n break;\n case \"STRING\":\n case 3:\n message.type = 3;\n break;\n case \"TENSOR\":\n case 4:\n message.type = 4;\n break;\n case \"GRAPH\":\n case 5:\n message.type = 5;\n break;\n case \"SPARSE_TENSOR\":\n case 11:\n message.type = 11;\n break;\n case \"TYPE_PROTO\":\n case 13:\n message.type = 13;\n break;\n case \"FLOATS\":\n case 6:\n message.type = 6;\n break;\n case \"INTS\":\n case 7:\n message.type = 7;\n break;\n case \"STRINGS\":\n case 8:\n message.type = 8;\n break;\n case \"TENSORS\":\n case 9:\n message.type = 9;\n break;\n case \"GRAPHS\":\n case 10:\n message.type = 10;\n break;\n case \"SPARSE_TENSORS\":\n case 12:\n message.type = 12;\n break;\n case \"TYPE_PROTOS\":\n case 14:\n message.type = 14;\n break;\n }\n if (object.f != null)\n message.f = Number(object.f);\n if (object.i != null)\n if ($util.Long)\n (message.i = $util.Long.fromValue(object.i)).unsigned = false;\n else if (typeof object.i === \"string\")\n message.i = parseInt(object.i, 10);\n else if (typeof object.i === \"number\")\n message.i = object.i;\n else if (typeof object.i === \"object\")\n message.i = new $util.LongBits(object.i.low >>> 0, object.i.high >>> 0).toNumber();\n if (object.s != null)\n if (typeof object.s === \"string\")\n $util.base64.decode(object.s, message.s = $util.newBuffer($util.base64.length(object.s)), 0);\n else if (object.s.length >= 0)\n message.s = object.s;\n if (object.t != null) {\n if (typeof object.t !== \"object\")\n throw TypeError(\".onnx.AttributeProto.t: object expected\");\n message.t = $root.onnx.TensorProto.fromObject(object.t);\n }\n if (object.g != null) {\n if (typeof object.g !== \"object\")\n throw TypeError(\".onnx.AttributeProto.g: object expected\");\n message.g = $root.onnx.GraphProto.fromObject(object.g);\n }\n if (object.sparseTensor != null) {\n if (typeof object.sparseTensor !== \"object\")\n throw TypeError(\".onnx.AttributeProto.sparseTensor: object expected\");\n message.sparseTensor = $root.onnx.SparseTensorProto.fromObject(object.sparseTensor);\n }\n if (object.tp != null) {\n if (typeof object.tp !== \"object\")\n throw TypeError(\".onnx.AttributeProto.tp: object expected\");\n message.tp = $root.onnx.TypeProto.fromObject(object.tp);\n }\n if (object.floats) {\n if (!Array.isArray(object.floats))\n throw TypeError(\".onnx.AttributeProto.floats: array expected\");\n message.floats = [];\n for (var i = 0; i < object.floats.length; ++i)\n message.floats[i] = Number(object.floats[i]);\n }\n if (object.ints) {\n if (!Array.isArray(object.ints))\n throw TypeError(\".onnx.AttributeProto.ints: array expected\");\n message.ints = [];\n for (var i = 0; i < object.ints.length; ++i)\n if ($util.Long)\n (message.ints[i] = $util.Long.fromValue(object.ints[i])).unsigned = false;\n else if (typeof object.ints[i] === \"string\")\n message.ints[i] = parseInt(object.ints[i], 10);\n else if (typeof object.ints[i] === \"number\")\n message.ints[i] = object.ints[i];\n else if (typeof object.ints[i] === \"object\")\n message.ints[i] = new $util.LongBits(object.ints[i].low >>> 0, object.ints[i].high >>> 0).toNumber();\n }\n if (object.strings) {\n if (!Array.isArray(object.strings))\n throw TypeError(\".onnx.AttributeProto.strings: array expected\");\n message.strings = [];\n for (var i = 0; i < object.strings.length; ++i)\n if (typeof object.strings[i] === \"string\")\n $util.base64.decode(object.strings[i], message.strings[i] = $util.newBuffer($util.base64.length(object.strings[i])), 0);\n else if (object.strings[i].length >= 0)\n message.strings[i] = object.strings[i];\n }\n if (object.tensors) {\n if (!Array.isArray(object.tensors))\n throw TypeError(\".onnx.AttributeProto.tensors: array expected\");\n message.tensors = [];\n for (var i = 0; i < object.tensors.length; ++i) {\n if (typeof object.tensors[i] !== \"object\")\n throw TypeError(\".onnx.AttributeProto.tensors: object expected\");\n message.tensors[i] = $root.onnx.TensorProto.fromObject(object.tensors[i]);\n }\n }\n if (object.graphs) {\n if (!Array.isArray(object.graphs))\n throw TypeError(\".onnx.AttributeProto.graphs: array expected\");\n message.graphs = [];\n for (var i = 0; i < object.graphs.length; ++i) {\n if (typeof object.graphs[i] !== \"object\")\n throw TypeError(\".onnx.AttributeProto.graphs: object expected\");\n message.graphs[i] = $root.onnx.GraphProto.fromObject(object.graphs[i]);\n }\n }\n if (object.sparseTensors) {\n if (!Array.isArray(object.sparseTensors))\n throw TypeError(\".onnx.AttributeProto.sparseTensors: array expected\");\n message.sparseTensors = [];\n for (var i = 0; i < object.sparseTensors.length; ++i) {\n if (typeof object.sparseTensors[i] !== \"object\")\n throw TypeError(\".onnx.AttributeProto.sparseTensors: object expected\");\n message.sparseTensors[i] = $root.onnx.SparseTensorProto.fromObject(object.sparseTensors[i]);\n }\n }\n if (object.typeProtos) {\n if (!Array.isArray(object.typeProtos))\n throw TypeError(\".onnx.AttributeProto.typeProtos: array expected\");\n message.typeProtos = [];\n for (var i = 0; i < object.typeProtos.length; ++i) {\n if (typeof object.typeProtos[i] !== \"object\")\n throw TypeError(\".onnx.AttributeProto.typeProtos: object expected\");\n message.typeProtos[i] = $root.onnx.TypeProto.fromObject(object.typeProtos[i]);\n }\n }\n return message;\n };\n\n /**\n * Creates a plain object from an AttributeProto message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.AttributeProto\n * @static\n * @param {onnx.AttributeProto} message AttributeProto\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n AttributeProto.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.arrays || options.defaults) {\n object.floats = [];\n object.ints = [];\n object.strings = [];\n object.tensors = [];\n object.graphs = [];\n object.typeProtos = [];\n object.sparseTensors = [];\n }\n if (options.defaults) {\n object.name = \"\";\n object.f = 0;\n if ($util.Long) {\n var long = new $util.Long(0, 0, false);\n object.i = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;\n } else\n object.i = options.longs === String ? \"0\" : 0;\n if (options.bytes === String)\n object.s = \"\";\n else {\n object.s = [];\n if (options.bytes !== Array)\n object.s = $util.newBuffer(object.s);\n }\n object.t = null;\n object.g = null;\n object.docString = \"\";\n object.tp = null;\n object.type = options.enums === String ? \"UNDEFINED\" : 0;\n object.refAttrName = \"\";\n object.sparseTensor = null;\n }\n if (message.name != null && message.hasOwnProperty(\"name\"))\n object.name = message.name;\n if (message.f != null && message.hasOwnProperty(\"f\"))\n object.f = options.json && !isFinite(message.f) ? String(message.f) : message.f;\n if (message.i != null && message.hasOwnProperty(\"i\"))\n if (typeof message.i === \"number\")\n object.i = options.longs === String ? String(message.i) : message.i;\n else\n object.i = options.longs === String ? $util.Long.prototype.toString.call(message.i) : options.longs === Number ? new $util.LongBits(message.i.low >>> 0, message.i.high >>> 0).toNumber() : message.i;\n if (message.s != null && message.hasOwnProperty(\"s\"))\n object.s = options.bytes === String ? $util.base64.encode(message.s, 0, message.s.length) : options.bytes === Array ? Array.prototype.slice.call(message.s) : message.s;\n if (message.t != null && message.hasOwnProperty(\"t\"))\n object.t = $root.onnx.TensorProto.toObject(message.t, options);\n if (message.g != null && message.hasOwnProperty(\"g\"))\n object.g = $root.onnx.GraphProto.toObject(message.g, options);\n if (message.floats && message.floats.length) {\n object.floats = [];\n for (var j = 0; j < message.floats.length; ++j)\n object.floats[j] = options.json && !isFinite(message.floats[j]) ? String(message.floats[j]) : message.floats[j];\n }\n if (message.ints && message.ints.length) {\n object.ints = [];\n for (var j = 0; j < message.ints.length; ++j)\n if (typeof message.ints[j] === \"number\")\n object.ints[j] = options.longs === String ? String(message.ints[j]) : message.ints[j];\n else\n object.ints[j] = options.longs === String ? $util.Long.prototype.toString.call(message.ints[j]) : options.longs === Number ? new $util.LongBits(message.ints[j].low >>> 0, message.ints[j].high >>> 0).toNumber() : message.ints[j];\n }\n if (message.strings && message.strings.length) {\n object.strings = [];\n for (var j = 0; j < message.strings.length; ++j)\n object.strings[j] = options.bytes === String ? $util.base64.encode(message.strings[j], 0, message.strings[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.strings[j]) : message.strings[j];\n }\n if (message.tensors && message.tensors.length) {\n object.tensors = [];\n for (var j = 0; j < message.tensors.length; ++j)\n object.tensors[j] = $root.onnx.TensorProto.toObject(message.tensors[j], options);\n }\n if (message.graphs && message.graphs.length) {\n object.graphs = [];\n for (var j = 0; j < message.graphs.length; ++j)\n object.graphs[j] = $root.onnx.GraphProto.toObject(message.graphs[j], options);\n }\n if (message.docString != null && message.hasOwnProperty(\"docString\"))\n object.docString = message.docString;\n if (message.tp != null && message.hasOwnProperty(\"tp\"))\n object.tp = $root.onnx.TypeProto.toObject(message.tp, options);\n if (message.typeProtos && message.typeProtos.length) {\n object.typeProtos = [];\n for (var j = 0; j < message.typeProtos.length; ++j)\n object.typeProtos[j] = $root.onnx.TypeProto.toObject(message.typeProtos[j], options);\n }\n if (message.type != null && message.hasOwnProperty(\"type\"))\n object.type = options.enums === String ? $root.onnx.AttributeProto.AttributeType[message.type] === undefined ? message.type : $root.onnx.AttributeProto.AttributeType[message.type] : message.type;\n if (message.refAttrName != null && message.hasOwnProperty(\"refAttrName\"))\n object.refAttrName = message.refAttrName;\n if (message.sparseTensor != null && message.hasOwnProperty(\"sparseTensor\"))\n object.sparseTensor = $root.onnx.SparseTensorProto.toObject(message.sparseTensor, options);\n if (message.sparseTensors && message.sparseTensors.length) {\n object.sparseTensors = [];\n for (var j = 0; j < message.sparseTensors.length; ++j)\n object.sparseTensors[j] = $root.onnx.SparseTensorProto.toObject(message.sparseTensors[j], options);\n }\n return object;\n };\n\n /**\n * Converts this AttributeProto to JSON.\n * @function toJSON\n * @memberof onnx.AttributeProto\n * @instance\n * @returns {Object.} JSON object\n */\n AttributeProto.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for AttributeProto\n * @function getTypeUrl\n * @memberof onnx.AttributeProto\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n AttributeProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.AttributeProto\";\n };\n\n /**\n * AttributeType enum.\n * @name onnx.AttributeProto.AttributeType\n * @enum {number}\n * @property {number} UNDEFINED=0 UNDEFINED value\n * @property {number} FLOAT=1 FLOAT value\n * @property {number} INT=2 INT value\n * @property {number} STRING=3 STRING value\n * @property {number} TENSOR=4 TENSOR value\n * @property {number} GRAPH=5 GRAPH value\n * @property {number} SPARSE_TENSOR=11 SPARSE_TENSOR value\n * @property {number} TYPE_PROTO=13 TYPE_PROTO value\n * @property {number} FLOATS=6 FLOATS value\n * @property {number} INTS=7 INTS value\n * @property {number} STRINGS=8 STRINGS value\n * @property {number} TENSORS=9 TENSORS value\n * @property {number} GRAPHS=10 GRAPHS value\n * @property {number} SPARSE_TENSORS=12 SPARSE_TENSORS value\n * @property {number} TYPE_PROTOS=14 TYPE_PROTOS value\n */\n AttributeProto.AttributeType = (function() {\n var valuesById = {}, values = Object.create(valuesById);\n values[valuesById[0] = \"UNDEFINED\"] = 0;\n values[valuesById[1] = \"FLOAT\"] = 1;\n values[valuesById[2] = \"INT\"] = 2;\n values[valuesById[3] = \"STRING\"] = 3;\n values[valuesById[4] = \"TENSOR\"] = 4;\n values[valuesById[5] = \"GRAPH\"] = 5;\n values[valuesById[11] = \"SPARSE_TENSOR\"] = 11;\n values[valuesById[13] = \"TYPE_PROTO\"] = 13;\n values[valuesById[6] = \"FLOATS\"] = 6;\n values[valuesById[7] = \"INTS\"] = 7;\n values[valuesById[8] = \"STRINGS\"] = 8;\n values[valuesById[9] = \"TENSORS\"] = 9;\n values[valuesById[10] = \"GRAPHS\"] = 10;\n values[valuesById[12] = \"SPARSE_TENSORS\"] = 12;\n values[valuesById[14] = \"TYPE_PROTOS\"] = 14;\n return values;\n })();\n\n return AttributeProto;\n })();\n\n onnx.ValueInfoProto = (function() {\n\n /**\n * Properties of a ValueInfoProto.\n * @memberof onnx\n * @interface IValueInfoProto\n * @property {string|null} [name] ValueInfoProto name\n * @property {onnx.ITypeProto|null} [type] ValueInfoProto type\n * @property {string|null} [docString] ValueInfoProto docString\n */\n\n /**\n * Constructs a new ValueInfoProto.\n * @memberof onnx\n * @classdesc Represents a ValueInfoProto.\n * @implements IValueInfoProto\n * @constructor\n * @param {onnx.IValueInfoProto=} [properties] Properties to set\n */\n function ValueInfoProto(properties) {\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * ValueInfoProto name.\n * @member {string} name\n * @memberof onnx.ValueInfoProto\n * @instance\n */\n ValueInfoProto.prototype.name = \"\";\n\n /**\n * ValueInfoProto type.\n * @member {onnx.ITypeProto|null|undefined} type\n * @memberof onnx.ValueInfoProto\n * @instance\n */\n ValueInfoProto.prototype.type = null;\n\n /**\n * ValueInfoProto docString.\n * @member {string} docString\n * @memberof onnx.ValueInfoProto\n * @instance\n */\n ValueInfoProto.prototype.docString = \"\";\n\n /**\n * Creates a new ValueInfoProto instance using the specified properties.\n * @function create\n * @memberof onnx.ValueInfoProto\n * @static\n * @param {onnx.IValueInfoProto=} [properties] Properties to set\n * @returns {onnx.ValueInfoProto} ValueInfoProto instance\n */\n ValueInfoProto.create = function create(properties) {\n return new ValueInfoProto(properties);\n };\n\n /**\n * Encodes the specified ValueInfoProto message. Does not implicitly {@link onnx.ValueInfoProto.verify|verify} messages.\n * @function encode\n * @memberof onnx.ValueInfoProto\n * @static\n * @param {onnx.IValueInfoProto} message ValueInfoProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n ValueInfoProto.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.name != null && Object.hasOwnProperty.call(message, \"name\"))\n writer.uint32(/* id 1, wireType 2 =*/10).string(message.name);\n if (message.type != null && Object.hasOwnProperty.call(message, \"type\"))\n $root.onnx.TypeProto.encode(message.type, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();\n if (message.docString != null && Object.hasOwnProperty.call(message, \"docString\"))\n writer.uint32(/* id 3, wireType 2 =*/26).string(message.docString);\n return writer;\n };\n\n /**\n * Encodes the specified ValueInfoProto message, length delimited. Does not implicitly {@link onnx.ValueInfoProto.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.ValueInfoProto\n * @static\n * @param {onnx.IValueInfoProto} message ValueInfoProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n ValueInfoProto.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes a ValueInfoProto message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.ValueInfoProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.ValueInfoProto} ValueInfoProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n ValueInfoProto.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.ValueInfoProto();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n message.name = reader.string();\n break;\n }\n case 2: {\n message.type = $root.onnx.TypeProto.decode(reader, reader.uint32());\n break;\n }\n case 3: {\n message.docString = reader.string();\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes a ValueInfoProto message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.ValueInfoProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.ValueInfoProto} ValueInfoProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n ValueInfoProto.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies a ValueInfoProto message.\n * @function verify\n * @memberof onnx.ValueInfoProto\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n ValueInfoProto.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.name != null && message.hasOwnProperty(\"name\"))\n if (!$util.isString(message.name))\n return \"name: string expected\";\n if (message.type != null && message.hasOwnProperty(\"type\")) {\n var error = $root.onnx.TypeProto.verify(message.type);\n if (error)\n return \"type.\" + error;\n }\n if (message.docString != null && message.hasOwnProperty(\"docString\"))\n if (!$util.isString(message.docString))\n return \"docString: string expected\";\n return null;\n };\n\n /**\n * Creates a ValueInfoProto message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.ValueInfoProto\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.ValueInfoProto} ValueInfoProto\n */\n ValueInfoProto.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.ValueInfoProto)\n return object;\n var message = new $root.onnx.ValueInfoProto();\n if (object.name != null)\n message.name = String(object.name);\n if (object.type != null) {\n if (typeof object.type !== \"object\")\n throw TypeError(\".onnx.ValueInfoProto.type: object expected\");\n message.type = $root.onnx.TypeProto.fromObject(object.type);\n }\n if (object.docString != null)\n message.docString = String(object.docString);\n return message;\n };\n\n /**\n * Creates a plain object from a ValueInfoProto message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.ValueInfoProto\n * @static\n * @param {onnx.ValueInfoProto} message ValueInfoProto\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n ValueInfoProto.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.defaults) {\n object.name = \"\";\n object.type = null;\n object.docString = \"\";\n }\n if (message.name != null && message.hasOwnProperty(\"name\"))\n object.name = message.name;\n if (message.type != null && message.hasOwnProperty(\"type\"))\n object.type = $root.onnx.TypeProto.toObject(message.type, options);\n if (message.docString != null && message.hasOwnProperty(\"docString\"))\n object.docString = message.docString;\n return object;\n };\n\n /**\n * Converts this ValueInfoProto to JSON.\n * @function toJSON\n * @memberof onnx.ValueInfoProto\n * @instance\n * @returns {Object.} JSON object\n */\n ValueInfoProto.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for ValueInfoProto\n * @function getTypeUrl\n * @memberof onnx.ValueInfoProto\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n ValueInfoProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.ValueInfoProto\";\n };\n\n return ValueInfoProto;\n })();\n\n onnx.NodeProto = (function() {\n\n /**\n * Properties of a NodeProto.\n * @memberof onnx\n * @interface INodeProto\n * @property {Array.|null} [input] NodeProto input\n * @property {Array.|null} [output] NodeProto output\n * @property {string|null} [name] NodeProto name\n * @property {string|null} [opType] NodeProto opType\n * @property {string|null} [domain] NodeProto domain\n * @property {Array.|null} [attribute] NodeProto attribute\n * @property {string|null} [docString] NodeProto docString\n */\n\n /**\n * Constructs a new NodeProto.\n * @memberof onnx\n * @classdesc Represents a NodeProto.\n * @implements INodeProto\n * @constructor\n * @param {onnx.INodeProto=} [properties] Properties to set\n */\n function NodeProto(properties) {\n this.input = [];\n this.output = [];\n this.attribute = [];\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * NodeProto input.\n * @member {Array.} input\n * @memberof onnx.NodeProto\n * @instance\n */\n NodeProto.prototype.input = $util.emptyArray;\n\n /**\n * NodeProto output.\n * @member {Array.} output\n * @memberof onnx.NodeProto\n * @instance\n */\n NodeProto.prototype.output = $util.emptyArray;\n\n /**\n * NodeProto name.\n * @member {string} name\n * @memberof onnx.NodeProto\n * @instance\n */\n NodeProto.prototype.name = \"\";\n\n /**\n * NodeProto opType.\n * @member {string} opType\n * @memberof onnx.NodeProto\n * @instance\n */\n NodeProto.prototype.opType = \"\";\n\n /**\n * NodeProto domain.\n * @member {string} domain\n * @memberof onnx.NodeProto\n * @instance\n */\n NodeProto.prototype.domain = \"\";\n\n /**\n * NodeProto attribute.\n * @member {Array.} attribute\n * @memberof onnx.NodeProto\n * @instance\n */\n NodeProto.prototype.attribute = $util.emptyArray;\n\n /**\n * NodeProto docString.\n * @member {string} docString\n * @memberof onnx.NodeProto\n * @instance\n */\n NodeProto.prototype.docString = \"\";\n\n /**\n * Creates a new NodeProto instance using the specified properties.\n * @function create\n * @memberof onnx.NodeProto\n * @static\n * @param {onnx.INodeProto=} [properties] Properties to set\n * @returns {onnx.NodeProto} NodeProto instance\n */\n NodeProto.create = function create(properties) {\n return new NodeProto(properties);\n };\n\n /**\n * Encodes the specified NodeProto message. Does not implicitly {@link onnx.NodeProto.verify|verify} messages.\n * @function encode\n * @memberof onnx.NodeProto\n * @static\n * @param {onnx.INodeProto} message NodeProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n NodeProto.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.input != null && message.input.length)\n for (var i = 0; i < message.input.length; ++i)\n writer.uint32(/* id 1, wireType 2 =*/10).string(message.input[i]);\n if (message.output != null && message.output.length)\n for (var i = 0; i < message.output.length; ++i)\n writer.uint32(/* id 2, wireType 2 =*/18).string(message.output[i]);\n if (message.name != null && Object.hasOwnProperty.call(message, \"name\"))\n writer.uint32(/* id 3, wireType 2 =*/26).string(message.name);\n if (message.opType != null && Object.hasOwnProperty.call(message, \"opType\"))\n writer.uint32(/* id 4, wireType 2 =*/34).string(message.opType);\n if (message.attribute != null && message.attribute.length)\n for (var i = 0; i < message.attribute.length; ++i)\n $root.onnx.AttributeProto.encode(message.attribute[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();\n if (message.docString != null && Object.hasOwnProperty.call(message, \"docString\"))\n writer.uint32(/* id 6, wireType 2 =*/50).string(message.docString);\n if (message.domain != null && Object.hasOwnProperty.call(message, \"domain\"))\n writer.uint32(/* id 7, wireType 2 =*/58).string(message.domain);\n return writer;\n };\n\n /**\n * Encodes the specified NodeProto message, length delimited. Does not implicitly {@link onnx.NodeProto.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.NodeProto\n * @static\n * @param {onnx.INodeProto} message NodeProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n NodeProto.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes a NodeProto message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.NodeProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.NodeProto} NodeProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n NodeProto.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.NodeProto();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (!(message.input && message.input.length))\n message.input = [];\n message.input.push(reader.string());\n break;\n }\n case 2: {\n if (!(message.output && message.output.length))\n message.output = [];\n message.output.push(reader.string());\n break;\n }\n case 3: {\n message.name = reader.string();\n break;\n }\n case 4: {\n message.opType = reader.string();\n break;\n }\n case 7: {\n message.domain = reader.string();\n break;\n }\n case 5: {\n if (!(message.attribute && message.attribute.length))\n message.attribute = [];\n message.attribute.push($root.onnx.AttributeProto.decode(reader, reader.uint32()));\n break;\n }\n case 6: {\n message.docString = reader.string();\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes a NodeProto message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.NodeProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.NodeProto} NodeProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n NodeProto.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies a NodeProto message.\n * @function verify\n * @memberof onnx.NodeProto\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n NodeProto.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.input != null && message.hasOwnProperty(\"input\")) {\n if (!Array.isArray(message.input))\n return \"input: array expected\";\n for (var i = 0; i < message.input.length; ++i)\n if (!$util.isString(message.input[i]))\n return \"input: string[] expected\";\n }\n if (message.output != null && message.hasOwnProperty(\"output\")) {\n if (!Array.isArray(message.output))\n return \"output: array expected\";\n for (var i = 0; i < message.output.length; ++i)\n if (!$util.isString(message.output[i]))\n return \"output: string[] expected\";\n }\n if (message.name != null && message.hasOwnProperty(\"name\"))\n if (!$util.isString(message.name))\n return \"name: string expected\";\n if (message.opType != null && message.hasOwnProperty(\"opType\"))\n if (!$util.isString(message.opType))\n return \"opType: string expected\";\n if (message.domain != null && message.hasOwnProperty(\"domain\"))\n if (!$util.isString(message.domain))\n return \"domain: string expected\";\n if (message.attribute != null && message.hasOwnProperty(\"attribute\")) {\n if (!Array.isArray(message.attribute))\n return \"attribute: array expected\";\n for (var i = 0; i < message.attribute.length; ++i) {\n var error = $root.onnx.AttributeProto.verify(message.attribute[i]);\n if (error)\n return \"attribute.\" + error;\n }\n }\n if (message.docString != null && message.hasOwnProperty(\"docString\"))\n if (!$util.isString(message.docString))\n return \"docString: string expected\";\n return null;\n };\n\n /**\n * Creates a NodeProto message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.NodeProto\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.NodeProto} NodeProto\n */\n NodeProto.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.NodeProto)\n return object;\n var message = new $root.onnx.NodeProto();\n if (object.input) {\n if (!Array.isArray(object.input))\n throw TypeError(\".onnx.NodeProto.input: array expected\");\n message.input = [];\n for (var i = 0; i < object.input.length; ++i)\n message.input[i] = String(object.input[i]);\n }\n if (object.output) {\n if (!Array.isArray(object.output))\n throw TypeError(\".onnx.NodeProto.output: array expected\");\n message.output = [];\n for (var i = 0; i < object.output.length; ++i)\n message.output[i] = String(object.output[i]);\n }\n if (object.name != null)\n message.name = String(object.name);\n if (object.opType != null)\n message.opType = String(object.opType);\n if (object.domain != null)\n message.domain = String(object.domain);\n if (object.attribute) {\n if (!Array.isArray(object.attribute))\n throw TypeError(\".onnx.NodeProto.attribute: array expected\");\n message.attribute = [];\n for (var i = 0; i < object.attribute.length; ++i) {\n if (typeof object.attribute[i] !== \"object\")\n throw TypeError(\".onnx.NodeProto.attribute: object expected\");\n message.attribute[i] = $root.onnx.AttributeProto.fromObject(object.attribute[i]);\n }\n }\n if (object.docString != null)\n message.docString = String(object.docString);\n return message;\n };\n\n /**\n * Creates a plain object from a NodeProto message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.NodeProto\n * @static\n * @param {onnx.NodeProto} message NodeProto\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n NodeProto.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.arrays || options.defaults) {\n object.input = [];\n object.output = [];\n object.attribute = [];\n }\n if (options.defaults) {\n object.name = \"\";\n object.opType = \"\";\n object.docString = \"\";\n object.domain = \"\";\n }\n if (message.input && message.input.length) {\n object.input = [];\n for (var j = 0; j < message.input.length; ++j)\n object.input[j] = message.input[j];\n }\n if (message.output && message.output.length) {\n object.output = [];\n for (var j = 0; j < message.output.length; ++j)\n object.output[j] = message.output[j];\n }\n if (message.name != null && message.hasOwnProperty(\"name\"))\n object.name = message.name;\n if (message.opType != null && message.hasOwnProperty(\"opType\"))\n object.opType = message.opType;\n if (message.attribute && message.attribute.length) {\n object.attribute = [];\n for (var j = 0; j < message.attribute.length; ++j)\n object.attribute[j] = $root.onnx.AttributeProto.toObject(message.attribute[j], options);\n }\n if (message.docString != null && message.hasOwnProperty(\"docString\"))\n object.docString = message.docString;\n if (message.domain != null && message.hasOwnProperty(\"domain\"))\n object.domain = message.domain;\n return object;\n };\n\n /**\n * Converts this NodeProto to JSON.\n * @function toJSON\n * @memberof onnx.NodeProto\n * @instance\n * @returns {Object.} JSON object\n */\n NodeProto.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for NodeProto\n * @function getTypeUrl\n * @memberof onnx.NodeProto\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n NodeProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.NodeProto\";\n };\n\n return NodeProto;\n })();\n\n onnx.TrainingInfoProto = (function() {\n\n /**\n * Properties of a TrainingInfoProto.\n * @memberof onnx\n * @interface ITrainingInfoProto\n * @property {onnx.IGraphProto|null} [initialization] TrainingInfoProto initialization\n * @property {onnx.IGraphProto|null} [algorithm] TrainingInfoProto algorithm\n * @property {Array.|null} [initializationBinding] TrainingInfoProto initializationBinding\n * @property {Array.|null} [updateBinding] TrainingInfoProto updateBinding\n */\n\n /**\n * Constructs a new TrainingInfoProto.\n * @memberof onnx\n * @classdesc Represents a TrainingInfoProto.\n * @implements ITrainingInfoProto\n * @constructor\n * @param {onnx.ITrainingInfoProto=} [properties] Properties to set\n */\n function TrainingInfoProto(properties) {\n this.initializationBinding = [];\n this.updateBinding = [];\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * TrainingInfoProto initialization.\n * @member {onnx.IGraphProto|null|undefined} initialization\n * @memberof onnx.TrainingInfoProto\n * @instance\n */\n TrainingInfoProto.prototype.initialization = null;\n\n /**\n * TrainingInfoProto algorithm.\n * @member {onnx.IGraphProto|null|undefined} algorithm\n * @memberof onnx.TrainingInfoProto\n * @instance\n */\n TrainingInfoProto.prototype.algorithm = null;\n\n /**\n * TrainingInfoProto initializationBinding.\n * @member {Array.} initializationBinding\n * @memberof onnx.TrainingInfoProto\n * @instance\n */\n TrainingInfoProto.prototype.initializationBinding = $util.emptyArray;\n\n /**\n * TrainingInfoProto updateBinding.\n * @member {Array.} updateBinding\n * @memberof onnx.TrainingInfoProto\n * @instance\n */\n TrainingInfoProto.prototype.updateBinding = $util.emptyArray;\n\n /**\n * Creates a new TrainingInfoProto instance using the specified properties.\n * @function create\n * @memberof onnx.TrainingInfoProto\n * @static\n * @param {onnx.ITrainingInfoProto=} [properties] Properties to set\n * @returns {onnx.TrainingInfoProto} TrainingInfoProto instance\n */\n TrainingInfoProto.create = function create(properties) {\n return new TrainingInfoProto(properties);\n };\n\n /**\n * Encodes the specified TrainingInfoProto message. Does not implicitly {@link onnx.TrainingInfoProto.verify|verify} messages.\n * @function encode\n * @memberof onnx.TrainingInfoProto\n * @static\n * @param {onnx.ITrainingInfoProto} message TrainingInfoProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n TrainingInfoProto.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.initialization != null && Object.hasOwnProperty.call(message, \"initialization\"))\n $root.onnx.GraphProto.encode(message.initialization, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();\n if (message.algorithm != null && Object.hasOwnProperty.call(message, \"algorithm\"))\n $root.onnx.GraphProto.encode(message.algorithm, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();\n if (message.initializationBinding != null && message.initializationBinding.length)\n for (var i = 0; i < message.initializationBinding.length; ++i)\n $root.onnx.StringStringEntryProto.encode(message.initializationBinding[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();\n if (message.updateBinding != null && message.updateBinding.length)\n for (var i = 0; i < message.updateBinding.length; ++i)\n $root.onnx.StringStringEntryProto.encode(message.updateBinding[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();\n return writer;\n };\n\n /**\n * Encodes the specified TrainingInfoProto message, length delimited. Does not implicitly {@link onnx.TrainingInfoProto.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.TrainingInfoProto\n * @static\n * @param {onnx.ITrainingInfoProto} message TrainingInfoProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n TrainingInfoProto.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes a TrainingInfoProto message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.TrainingInfoProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.TrainingInfoProto} TrainingInfoProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n TrainingInfoProto.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TrainingInfoProto();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n message.initialization = $root.onnx.GraphProto.decode(reader, reader.uint32());\n break;\n }\n case 2: {\n message.algorithm = $root.onnx.GraphProto.decode(reader, reader.uint32());\n break;\n }\n case 3: {\n if (!(message.initializationBinding && message.initializationBinding.length))\n message.initializationBinding = [];\n message.initializationBinding.push($root.onnx.StringStringEntryProto.decode(reader, reader.uint32()));\n break;\n }\n case 4: {\n if (!(message.updateBinding && message.updateBinding.length))\n message.updateBinding = [];\n message.updateBinding.push($root.onnx.StringStringEntryProto.decode(reader, reader.uint32()));\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes a TrainingInfoProto message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.TrainingInfoProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.TrainingInfoProto} TrainingInfoProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n TrainingInfoProto.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies a TrainingInfoProto message.\n * @function verify\n * @memberof onnx.TrainingInfoProto\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n TrainingInfoProto.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.initialization != null && message.hasOwnProperty(\"initialization\")) {\n var error = $root.onnx.GraphProto.verify(message.initialization);\n if (error)\n return \"initialization.\" + error;\n }\n if (message.algorithm != null && message.hasOwnProperty(\"algorithm\")) {\n var error = $root.onnx.GraphProto.verify(message.algorithm);\n if (error)\n return \"algorithm.\" + error;\n }\n if (message.initializationBinding != null && message.hasOwnProperty(\"initializationBinding\")) {\n if (!Array.isArray(message.initializationBinding))\n return \"initializationBinding: array expected\";\n for (var i = 0; i < message.initializationBinding.length; ++i) {\n var error = $root.onnx.StringStringEntryProto.verify(message.initializationBinding[i]);\n if (error)\n return \"initializationBinding.\" + error;\n }\n }\n if (message.updateBinding != null && message.hasOwnProperty(\"updateBinding\")) {\n if (!Array.isArray(message.updateBinding))\n return \"updateBinding: array expected\";\n for (var i = 0; i < message.updateBinding.length; ++i) {\n var error = $root.onnx.StringStringEntryProto.verify(message.updateBinding[i]);\n if (error)\n return \"updateBinding.\" + error;\n }\n }\n return null;\n };\n\n /**\n * Creates a TrainingInfoProto message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.TrainingInfoProto\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.TrainingInfoProto} TrainingInfoProto\n */\n TrainingInfoProto.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.TrainingInfoProto)\n return object;\n var message = new $root.onnx.TrainingInfoProto();\n if (object.initialization != null) {\n if (typeof object.initialization !== \"object\")\n throw TypeError(\".onnx.TrainingInfoProto.initialization: object expected\");\n message.initialization = $root.onnx.GraphProto.fromObject(object.initialization);\n }\n if (object.algorithm != null) {\n if (typeof object.algorithm !== \"object\")\n throw TypeError(\".onnx.TrainingInfoProto.algorithm: object expected\");\n message.algorithm = $root.onnx.GraphProto.fromObject(object.algorithm);\n }\n if (object.initializationBinding) {\n if (!Array.isArray(object.initializationBinding))\n throw TypeError(\".onnx.TrainingInfoProto.initializationBinding: array expected\");\n message.initializationBinding = [];\n for (var i = 0; i < object.initializationBinding.length; ++i) {\n if (typeof object.initializationBinding[i] !== \"object\")\n throw TypeError(\".onnx.TrainingInfoProto.initializationBinding: object expected\");\n message.initializationBinding[i] = $root.onnx.StringStringEntryProto.fromObject(object.initializationBinding[i]);\n }\n }\n if (object.updateBinding) {\n if (!Array.isArray(object.updateBinding))\n throw TypeError(\".onnx.TrainingInfoProto.updateBinding: array expected\");\n message.updateBinding = [];\n for (var i = 0; i < object.updateBinding.length; ++i) {\n if (typeof object.updateBinding[i] !== \"object\")\n throw TypeError(\".onnx.TrainingInfoProto.updateBinding: object expected\");\n message.updateBinding[i] = $root.onnx.StringStringEntryProto.fromObject(object.updateBinding[i]);\n }\n }\n return message;\n };\n\n /**\n * Creates a plain object from a TrainingInfoProto message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.TrainingInfoProto\n * @static\n * @param {onnx.TrainingInfoProto} message TrainingInfoProto\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n TrainingInfoProto.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.arrays || options.defaults) {\n object.initializationBinding = [];\n object.updateBinding = [];\n }\n if (options.defaults) {\n object.initialization = null;\n object.algorithm = null;\n }\n if (message.initialization != null && message.hasOwnProperty(\"initialization\"))\n object.initialization = $root.onnx.GraphProto.toObject(message.initialization, options);\n if (message.algorithm != null && message.hasOwnProperty(\"algorithm\"))\n object.algorithm = $root.onnx.GraphProto.toObject(message.algorithm, options);\n if (message.initializationBinding && message.initializationBinding.length) {\n object.initializationBinding = [];\n for (var j = 0; j < message.initializationBinding.length; ++j)\n object.initializationBinding[j] = $root.onnx.StringStringEntryProto.toObject(message.initializationBinding[j], options);\n }\n if (message.updateBinding && message.updateBinding.length) {\n object.updateBinding = [];\n for (var j = 0; j < message.updateBinding.length; ++j)\n object.updateBinding[j] = $root.onnx.StringStringEntryProto.toObject(message.updateBinding[j], options);\n }\n return object;\n };\n\n /**\n * Converts this TrainingInfoProto to JSON.\n * @function toJSON\n * @memberof onnx.TrainingInfoProto\n * @instance\n * @returns {Object.} JSON object\n */\n TrainingInfoProto.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for TrainingInfoProto\n * @function getTypeUrl\n * @memberof onnx.TrainingInfoProto\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n TrainingInfoProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.TrainingInfoProto\";\n };\n\n return TrainingInfoProto;\n })();\n\n onnx.ModelProto = (function() {\n\n /**\n * Properties of a ModelProto.\n * @memberof onnx\n * @interface IModelProto\n * @property {number|Long|null} [irVersion] ModelProto irVersion\n * @property {Array.|null} [opsetImport] ModelProto opsetImport\n * @property {string|null} [producerName] ModelProto producerName\n * @property {string|null} [producerVersion] ModelProto producerVersion\n * @property {string|null} [domain] ModelProto domain\n * @property {number|Long|null} [modelVersion] ModelProto modelVersion\n * @property {string|null} [docString] ModelProto docString\n * @property {onnx.IGraphProto|null} [graph] ModelProto graph\n * @property {Array.|null} [metadataProps] ModelProto metadataProps\n * @property {Array.|null} [trainingInfo] ModelProto trainingInfo\n * @property {Array.|null} [functions] ModelProto functions\n */\n\n /**\n * Constructs a new ModelProto.\n * @memberof onnx\n * @classdesc Represents a ModelProto.\n * @implements IModelProto\n * @constructor\n * @param {onnx.IModelProto=} [properties] Properties to set\n */\n function ModelProto(properties) {\n this.opsetImport = [];\n this.metadataProps = [];\n this.trainingInfo = [];\n this.functions = [];\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * ModelProto irVersion.\n * @member {number|Long} irVersion\n * @memberof onnx.ModelProto\n * @instance\n */\n ModelProto.prototype.irVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0;\n\n /**\n * ModelProto opsetImport.\n * @member {Array.} opsetImport\n * @memberof onnx.ModelProto\n * @instance\n */\n ModelProto.prototype.opsetImport = $util.emptyArray;\n\n /**\n * ModelProto producerName.\n * @member {string} producerName\n * @memberof onnx.ModelProto\n * @instance\n */\n ModelProto.prototype.producerName = \"\";\n\n /**\n * ModelProto producerVersion.\n * @member {string} producerVersion\n * @memberof onnx.ModelProto\n * @instance\n */\n ModelProto.prototype.producerVersion = \"\";\n\n /**\n * ModelProto domain.\n * @member {string} domain\n * @memberof onnx.ModelProto\n * @instance\n */\n ModelProto.prototype.domain = \"\";\n\n /**\n * ModelProto modelVersion.\n * @member {number|Long} modelVersion\n * @memberof onnx.ModelProto\n * @instance\n */\n ModelProto.prototype.modelVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0;\n\n /**\n * ModelProto docString.\n * @member {string} docString\n * @memberof onnx.ModelProto\n * @instance\n */\n ModelProto.prototype.docString = \"\";\n\n /**\n * ModelProto graph.\n * @member {onnx.IGraphProto|null|undefined} graph\n * @memberof onnx.ModelProto\n * @instance\n */\n ModelProto.prototype.graph = null;\n\n /**\n * ModelProto metadataProps.\n * @member {Array.} metadataProps\n * @memberof onnx.ModelProto\n * @instance\n */\n ModelProto.prototype.metadataProps = $util.emptyArray;\n\n /**\n * ModelProto trainingInfo.\n * @member {Array.} trainingInfo\n * @memberof onnx.ModelProto\n * @instance\n */\n ModelProto.prototype.trainingInfo = $util.emptyArray;\n\n /**\n * ModelProto functions.\n * @member {Array.} functions\n * @memberof onnx.ModelProto\n * @instance\n */\n ModelProto.prototype.functions = $util.emptyArray;\n\n /**\n * Creates a new ModelProto instance using the specified properties.\n * @function create\n * @memberof onnx.ModelProto\n * @static\n * @param {onnx.IModelProto=} [properties] Properties to set\n * @returns {onnx.ModelProto} ModelProto instance\n */\n ModelProto.create = function create(properties) {\n return new ModelProto(properties);\n };\n\n /**\n * Encodes the specified ModelProto message. Does not implicitly {@link onnx.ModelProto.verify|verify} messages.\n * @function encode\n * @memberof onnx.ModelProto\n * @static\n * @param {onnx.IModelProto} message ModelProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n ModelProto.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.irVersion != null && Object.hasOwnProperty.call(message, \"irVersion\"))\n writer.uint32(/* id 1, wireType 0 =*/8).int64(message.irVersion);\n if (message.producerName != null && Object.hasOwnProperty.call(message, \"producerName\"))\n writer.uint32(/* id 2, wireType 2 =*/18).string(message.producerName);\n if (message.producerVersion != null && Object.hasOwnProperty.call(message, \"producerVersion\"))\n writer.uint32(/* id 3, wireType 2 =*/26).string(message.producerVersion);\n if (message.domain != null && Object.hasOwnProperty.call(message, \"domain\"))\n writer.uint32(/* id 4, wireType 2 =*/34).string(message.domain);\n if (message.modelVersion != null && Object.hasOwnProperty.call(message, \"modelVersion\"))\n writer.uint32(/* id 5, wireType 0 =*/40).int64(message.modelVersion);\n if (message.docString != null && Object.hasOwnProperty.call(message, \"docString\"))\n writer.uint32(/* id 6, wireType 2 =*/50).string(message.docString);\n if (message.graph != null && Object.hasOwnProperty.call(message, \"graph\"))\n $root.onnx.GraphProto.encode(message.graph, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim();\n if (message.opsetImport != null && message.opsetImport.length)\n for (var i = 0; i < message.opsetImport.length; ++i)\n $root.onnx.OperatorSetIdProto.encode(message.opsetImport[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim();\n if (message.metadataProps != null && message.metadataProps.length)\n for (var i = 0; i < message.metadataProps.length; ++i)\n $root.onnx.StringStringEntryProto.encode(message.metadataProps[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim();\n if (message.trainingInfo != null && message.trainingInfo.length)\n for (var i = 0; i < message.trainingInfo.length; ++i)\n $root.onnx.TrainingInfoProto.encode(message.trainingInfo[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim();\n if (message.functions != null && message.functions.length)\n for (var i = 0; i < message.functions.length; ++i)\n $root.onnx.FunctionProto.encode(message.functions[i], writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim();\n return writer;\n };\n\n /**\n * Encodes the specified ModelProto message, length delimited. Does not implicitly {@link onnx.ModelProto.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.ModelProto\n * @static\n * @param {onnx.IModelProto} message ModelProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n ModelProto.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes a ModelProto message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.ModelProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.ModelProto} ModelProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n ModelProto.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.ModelProto();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n message.irVersion = reader.int64();\n break;\n }\n case 8: {\n if (!(message.opsetImport && message.opsetImport.length))\n message.opsetImport = [];\n message.opsetImport.push($root.onnx.OperatorSetIdProto.decode(reader, reader.uint32()));\n break;\n }\n case 2: {\n message.producerName = reader.string();\n break;\n }\n case 3: {\n message.producerVersion = reader.string();\n break;\n }\n case 4: {\n message.domain = reader.string();\n break;\n }\n case 5: {\n message.modelVersion = reader.int64();\n break;\n }\n case 6: {\n message.docString = reader.string();\n break;\n }\n case 7: {\n message.graph = $root.onnx.GraphProto.decode(reader, reader.uint32());\n break;\n }\n case 14: {\n if (!(message.metadataProps && message.metadataProps.length))\n message.metadataProps = [];\n message.metadataProps.push($root.onnx.StringStringEntryProto.decode(reader, reader.uint32()));\n break;\n }\n case 20: {\n if (!(message.trainingInfo && message.trainingInfo.length))\n message.trainingInfo = [];\n message.trainingInfo.push($root.onnx.TrainingInfoProto.decode(reader, reader.uint32()));\n break;\n }\n case 25: {\n if (!(message.functions && message.functions.length))\n message.functions = [];\n message.functions.push($root.onnx.FunctionProto.decode(reader, reader.uint32()));\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes a ModelProto message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.ModelProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.ModelProto} ModelProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n ModelProto.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies a ModelProto message.\n * @function verify\n * @memberof onnx.ModelProto\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n ModelProto.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.irVersion != null && message.hasOwnProperty(\"irVersion\"))\n if (!$util.isInteger(message.irVersion) && !(message.irVersion && $util.isInteger(message.irVersion.low) && $util.isInteger(message.irVersion.high)))\n return \"irVersion: integer|Long expected\";\n if (message.opsetImport != null && message.hasOwnProperty(\"opsetImport\")) {\n if (!Array.isArray(message.opsetImport))\n return \"opsetImport: array expected\";\n for (var i = 0; i < message.opsetImport.length; ++i) {\n var error = $root.onnx.OperatorSetIdProto.verify(message.opsetImport[i]);\n if (error)\n return \"opsetImport.\" + error;\n }\n }\n if (message.producerName != null && message.hasOwnProperty(\"producerName\"))\n if (!$util.isString(message.producerName))\n return \"producerName: string expected\";\n if (message.producerVersion != null && message.hasOwnProperty(\"producerVersion\"))\n if (!$util.isString(message.producerVersion))\n return \"producerVersion: string expected\";\n if (message.domain != null && message.hasOwnProperty(\"domain\"))\n if (!$util.isString(message.domain))\n return \"domain: string expected\";\n if (message.modelVersion != null && message.hasOwnProperty(\"modelVersion\"))\n if (!$util.isInteger(message.modelVersion) && !(message.modelVersion && $util.isInteger(message.modelVersion.low) && $util.isInteger(message.modelVersion.high)))\n return \"modelVersion: integer|Long expected\";\n if (message.docString != null && message.hasOwnProperty(\"docString\"))\n if (!$util.isString(message.docString))\n return \"docString: string expected\";\n if (message.graph != null && message.hasOwnProperty(\"graph\")) {\n var error = $root.onnx.GraphProto.verify(message.graph);\n if (error)\n return \"graph.\" + error;\n }\n if (message.metadataProps != null && message.hasOwnProperty(\"metadataProps\")) {\n if (!Array.isArray(message.metadataProps))\n return \"metadataProps: array expected\";\n for (var i = 0; i < message.metadataProps.length; ++i) {\n var error = $root.onnx.StringStringEntryProto.verify(message.metadataProps[i]);\n if (error)\n return \"metadataProps.\" + error;\n }\n }\n if (message.trainingInfo != null && message.hasOwnProperty(\"trainingInfo\")) {\n if (!Array.isArray(message.trainingInfo))\n return \"trainingInfo: array expected\";\n for (var i = 0; i < message.trainingInfo.length; ++i) {\n var error = $root.onnx.TrainingInfoProto.verify(message.trainingInfo[i]);\n if (error)\n return \"trainingInfo.\" + error;\n }\n }\n if (message.functions != null && message.hasOwnProperty(\"functions\")) {\n if (!Array.isArray(message.functions))\n return \"functions: array expected\";\n for (var i = 0; i < message.functions.length; ++i) {\n var error = $root.onnx.FunctionProto.verify(message.functions[i]);\n if (error)\n return \"functions.\" + error;\n }\n }\n return null;\n };\n\n /**\n * Creates a ModelProto message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.ModelProto\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.ModelProto} ModelProto\n */\n ModelProto.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.ModelProto)\n return object;\n var message = new $root.onnx.ModelProto();\n if (object.irVersion != null)\n if ($util.Long)\n (message.irVersion = $util.Long.fromValue(object.irVersion)).unsigned = false;\n else if (typeof object.irVersion === \"string\")\n message.irVersion = parseInt(object.irVersion, 10);\n else if (typeof object.irVersion === \"number\")\n message.irVersion = object.irVersion;\n else if (typeof object.irVersion === \"object\")\n message.irVersion = new $util.LongBits(object.irVersion.low >>> 0, object.irVersion.high >>> 0).toNumber();\n if (object.opsetImport) {\n if (!Array.isArray(object.opsetImport))\n throw TypeError(\".onnx.ModelProto.opsetImport: array expected\");\n message.opsetImport = [];\n for (var i = 0; i < object.opsetImport.length; ++i) {\n if (typeof object.opsetImport[i] !== \"object\")\n throw TypeError(\".onnx.ModelProto.opsetImport: object expected\");\n message.opsetImport[i] = $root.onnx.OperatorSetIdProto.fromObject(object.opsetImport[i]);\n }\n }\n if (object.producerName != null)\n message.producerName = String(object.producerName);\n if (object.producerVersion != null)\n message.producerVersion = String(object.producerVersion);\n if (object.domain != null)\n message.domain = String(object.domain);\n if (object.modelVersion != null)\n if ($util.Long)\n (message.modelVersion = $util.Long.fromValue(object.modelVersion)).unsigned = false;\n else if (typeof object.modelVersion === \"string\")\n message.modelVersion = parseInt(object.modelVersion, 10);\n else if (typeof object.modelVersion === \"number\")\n message.modelVersion = object.modelVersion;\n else if (typeof object.modelVersion === \"object\")\n message.modelVersion = new $util.LongBits(object.modelVersion.low >>> 0, object.modelVersion.high >>> 0).toNumber();\n if (object.docString != null)\n message.docString = String(object.docString);\n if (object.graph != null) {\n if (typeof object.graph !== \"object\")\n throw TypeError(\".onnx.ModelProto.graph: object expected\");\n message.graph = $root.onnx.GraphProto.fromObject(object.graph);\n }\n if (object.metadataProps) {\n if (!Array.isArray(object.metadataProps))\n throw TypeError(\".onnx.ModelProto.metadataProps: array expected\");\n message.metadataProps = [];\n for (var i = 0; i < object.metadataProps.length; ++i) {\n if (typeof object.metadataProps[i] !== \"object\")\n throw TypeError(\".onnx.ModelProto.metadataProps: object expected\");\n message.metadataProps[i] = $root.onnx.StringStringEntryProto.fromObject(object.metadataProps[i]);\n }\n }\n if (object.trainingInfo) {\n if (!Array.isArray(object.trainingInfo))\n throw TypeError(\".onnx.ModelProto.trainingInfo: array expected\");\n message.trainingInfo = [];\n for (var i = 0; i < object.trainingInfo.length; ++i) {\n if (typeof object.trainingInfo[i] !== \"object\")\n throw TypeError(\".onnx.ModelProto.trainingInfo: object expected\");\n message.trainingInfo[i] = $root.onnx.TrainingInfoProto.fromObject(object.trainingInfo[i]);\n }\n }\n if (object.functions) {\n if (!Array.isArray(object.functions))\n throw TypeError(\".onnx.ModelProto.functions: array expected\");\n message.functions = [];\n for (var i = 0; i < object.functions.length; ++i) {\n if (typeof object.functions[i] !== \"object\")\n throw TypeError(\".onnx.ModelProto.functions: object expected\");\n message.functions[i] = $root.onnx.FunctionProto.fromObject(object.functions[i]);\n }\n }\n return message;\n };\n\n /**\n * Creates a plain object from a ModelProto message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.ModelProto\n * @static\n * @param {onnx.ModelProto} message ModelProto\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n ModelProto.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.arrays || options.defaults) {\n object.opsetImport = [];\n object.metadataProps = [];\n object.trainingInfo = [];\n object.functions = [];\n }\n if (options.defaults) {\n if ($util.Long) {\n var long = new $util.Long(0, 0, false);\n object.irVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;\n } else\n object.irVersion = options.longs === String ? \"0\" : 0;\n object.producerName = \"\";\n object.producerVersion = \"\";\n object.domain = \"\";\n if ($util.Long) {\n var long = new $util.Long(0, 0, false);\n object.modelVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;\n } else\n object.modelVersion = options.longs === String ? \"0\" : 0;\n object.docString = \"\";\n object.graph = null;\n }\n if (message.irVersion != null && message.hasOwnProperty(\"irVersion\"))\n if (typeof message.irVersion === \"number\")\n object.irVersion = options.longs === String ? String(message.irVersion) : message.irVersion;\n else\n object.irVersion = options.longs === String ? $util.Long.prototype.toString.call(message.irVersion) : options.longs === Number ? new $util.LongBits(message.irVersion.low >>> 0, message.irVersion.high >>> 0).toNumber() : message.irVersion;\n if (message.producerName != null && message.hasOwnProperty(\"producerName\"))\n object.producerName = message.producerName;\n if (message.producerVersion != null && message.hasOwnProperty(\"producerVersion\"))\n object.producerVersion = message.producerVersion;\n if (message.domain != null && message.hasOwnProperty(\"domain\"))\n object.domain = message.domain;\n if (message.modelVersion != null && message.hasOwnProperty(\"modelVersion\"))\n if (typeof message.modelVersion === \"number\")\n object.modelVersion = options.longs === String ? String(message.modelVersion) : message.modelVersion;\n else\n object.modelVersion = options.longs === String ? $util.Long.prototype.toString.call(message.modelVersion) : options.longs === Number ? new $util.LongBits(message.modelVersion.low >>> 0, message.modelVersion.high >>> 0).toNumber() : message.modelVersion;\n if (message.docString != null && message.hasOwnProperty(\"docString\"))\n object.docString = message.docString;\n if (message.graph != null && message.hasOwnProperty(\"graph\"))\n object.graph = $root.onnx.GraphProto.toObject(message.graph, options);\n if (message.opsetImport && message.opsetImport.length) {\n object.opsetImport = [];\n for (var j = 0; j < message.opsetImport.length; ++j)\n object.opsetImport[j] = $root.onnx.OperatorSetIdProto.toObject(message.opsetImport[j], options);\n }\n if (message.metadataProps && message.metadataProps.length) {\n object.metadataProps = [];\n for (var j = 0; j < message.metadataProps.length; ++j)\n object.metadataProps[j] = $root.onnx.StringStringEntryProto.toObject(message.metadataProps[j], options);\n }\n if (message.trainingInfo && message.trainingInfo.length) {\n object.trainingInfo = [];\n for (var j = 0; j < message.trainingInfo.length; ++j)\n object.trainingInfo[j] = $root.onnx.TrainingInfoProto.toObject(message.trainingInfo[j], options);\n }\n if (message.functions && message.functions.length) {\n object.functions = [];\n for (var j = 0; j < message.functions.length; ++j)\n object.functions[j] = $root.onnx.FunctionProto.toObject(message.functions[j], options);\n }\n return object;\n };\n\n /**\n * Converts this ModelProto to JSON.\n * @function toJSON\n * @memberof onnx.ModelProto\n * @instance\n * @returns {Object.} JSON object\n */\n ModelProto.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for ModelProto\n * @function getTypeUrl\n * @memberof onnx.ModelProto\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n ModelProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.ModelProto\";\n };\n\n return ModelProto;\n })();\n\n onnx.StringStringEntryProto = (function() {\n\n /**\n * Properties of a StringStringEntryProto.\n * @memberof onnx\n * @interface IStringStringEntryProto\n * @property {string|null} [key] StringStringEntryProto key\n * @property {string|null} [value] StringStringEntryProto value\n */\n\n /**\n * Constructs a new StringStringEntryProto.\n * @memberof onnx\n * @classdesc Represents a StringStringEntryProto.\n * @implements IStringStringEntryProto\n * @constructor\n * @param {onnx.IStringStringEntryProto=} [properties] Properties to set\n */\n function StringStringEntryProto(properties) {\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * StringStringEntryProto key.\n * @member {string} key\n * @memberof onnx.StringStringEntryProto\n * @instance\n */\n StringStringEntryProto.prototype.key = \"\";\n\n /**\n * StringStringEntryProto value.\n * @member {string} value\n * @memberof onnx.StringStringEntryProto\n * @instance\n */\n StringStringEntryProto.prototype.value = \"\";\n\n /**\n * Creates a new StringStringEntryProto instance using the specified properties.\n * @function create\n * @memberof onnx.StringStringEntryProto\n * @static\n * @param {onnx.IStringStringEntryProto=} [properties] Properties to set\n * @returns {onnx.StringStringEntryProto} StringStringEntryProto instance\n */\n StringStringEntryProto.create = function create(properties) {\n return new StringStringEntryProto(properties);\n };\n\n /**\n * Encodes the specified StringStringEntryProto message. Does not implicitly {@link onnx.StringStringEntryProto.verify|verify} messages.\n * @function encode\n * @memberof onnx.StringStringEntryProto\n * @static\n * @param {onnx.IStringStringEntryProto} message StringStringEntryProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n StringStringEntryProto.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.key != null && Object.hasOwnProperty.call(message, \"key\"))\n writer.uint32(/* id 1, wireType 2 =*/10).string(message.key);\n if (message.value != null && Object.hasOwnProperty.call(message, \"value\"))\n writer.uint32(/* id 2, wireType 2 =*/18).string(message.value);\n return writer;\n };\n\n /**\n * Encodes the specified StringStringEntryProto message, length delimited. Does not implicitly {@link onnx.StringStringEntryProto.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.StringStringEntryProto\n * @static\n * @param {onnx.IStringStringEntryProto} message StringStringEntryProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n StringStringEntryProto.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes a StringStringEntryProto message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.StringStringEntryProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.StringStringEntryProto} StringStringEntryProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n StringStringEntryProto.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.StringStringEntryProto();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n message.key = reader.string();\n break;\n }\n case 2: {\n message.value = reader.string();\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes a StringStringEntryProto message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.StringStringEntryProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.StringStringEntryProto} StringStringEntryProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n StringStringEntryProto.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies a StringStringEntryProto message.\n * @function verify\n * @memberof onnx.StringStringEntryProto\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n StringStringEntryProto.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.key != null && message.hasOwnProperty(\"key\"))\n if (!$util.isString(message.key))\n return \"key: string expected\";\n if (message.value != null && message.hasOwnProperty(\"value\"))\n if (!$util.isString(message.value))\n return \"value: string expected\";\n return null;\n };\n\n /**\n * Creates a StringStringEntryProto message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.StringStringEntryProto\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.StringStringEntryProto} StringStringEntryProto\n */\n StringStringEntryProto.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.StringStringEntryProto)\n return object;\n var message = new $root.onnx.StringStringEntryProto();\n if (object.key != null)\n message.key = String(object.key);\n if (object.value != null)\n message.value = String(object.value);\n return message;\n };\n\n /**\n * Creates a plain object from a StringStringEntryProto message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.StringStringEntryProto\n * @static\n * @param {onnx.StringStringEntryProto} message StringStringEntryProto\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n StringStringEntryProto.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.defaults) {\n object.key = \"\";\n object.value = \"\";\n }\n if (message.key != null && message.hasOwnProperty(\"key\"))\n object.key = message.key;\n if (message.value != null && message.hasOwnProperty(\"value\"))\n object.value = message.value;\n return object;\n };\n\n /**\n * Converts this StringStringEntryProto to JSON.\n * @function toJSON\n * @memberof onnx.StringStringEntryProto\n * @instance\n * @returns {Object.} JSON object\n */\n StringStringEntryProto.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for StringStringEntryProto\n * @function getTypeUrl\n * @memberof onnx.StringStringEntryProto\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n StringStringEntryProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.StringStringEntryProto\";\n };\n\n return StringStringEntryProto;\n })();\n\n onnx.TensorAnnotation = (function() {\n\n /**\n * Properties of a TensorAnnotation.\n * @memberof onnx\n * @interface ITensorAnnotation\n * @property {string|null} [tensorName] TensorAnnotation tensorName\n * @property {Array.|null} [quantParameterTensorNames] TensorAnnotation quantParameterTensorNames\n */\n\n /**\n * Constructs a new TensorAnnotation.\n * @memberof onnx\n * @classdesc Represents a TensorAnnotation.\n * @implements ITensorAnnotation\n * @constructor\n * @param {onnx.ITensorAnnotation=} [properties] Properties to set\n */\n function TensorAnnotation(properties) {\n this.quantParameterTensorNames = [];\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * TensorAnnotation tensorName.\n * @member {string} tensorName\n * @memberof onnx.TensorAnnotation\n * @instance\n */\n TensorAnnotation.prototype.tensorName = \"\";\n\n /**\n * TensorAnnotation quantParameterTensorNames.\n * @member {Array.} quantParameterTensorNames\n * @memberof onnx.TensorAnnotation\n * @instance\n */\n TensorAnnotation.prototype.quantParameterTensorNames = $util.emptyArray;\n\n /**\n * Creates a new TensorAnnotation instance using the specified properties.\n * @function create\n * @memberof onnx.TensorAnnotation\n * @static\n * @param {onnx.ITensorAnnotation=} [properties] Properties to set\n * @returns {onnx.TensorAnnotation} TensorAnnotation instance\n */\n TensorAnnotation.create = function create(properties) {\n return new TensorAnnotation(properties);\n };\n\n /**\n * Encodes the specified TensorAnnotation message. Does not implicitly {@link onnx.TensorAnnotation.verify|verify} messages.\n * @function encode\n * @memberof onnx.TensorAnnotation\n * @static\n * @param {onnx.ITensorAnnotation} message TensorAnnotation message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n TensorAnnotation.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.tensorName != null && Object.hasOwnProperty.call(message, \"tensorName\"))\n writer.uint32(/* id 1, wireType 2 =*/10).string(message.tensorName);\n if (message.quantParameterTensorNames != null && message.quantParameterTensorNames.length)\n for (var i = 0; i < message.quantParameterTensorNames.length; ++i)\n $root.onnx.StringStringEntryProto.encode(message.quantParameterTensorNames[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();\n return writer;\n };\n\n /**\n * Encodes the specified TensorAnnotation message, length delimited. Does not implicitly {@link onnx.TensorAnnotation.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.TensorAnnotation\n * @static\n * @param {onnx.ITensorAnnotation} message TensorAnnotation message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n TensorAnnotation.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes a TensorAnnotation message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.TensorAnnotation\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.TensorAnnotation} TensorAnnotation\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n TensorAnnotation.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TensorAnnotation();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n message.tensorName = reader.string();\n break;\n }\n case 2: {\n if (!(message.quantParameterTensorNames && message.quantParameterTensorNames.length))\n message.quantParameterTensorNames = [];\n message.quantParameterTensorNames.push($root.onnx.StringStringEntryProto.decode(reader, reader.uint32()));\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes a TensorAnnotation message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.TensorAnnotation\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.TensorAnnotation} TensorAnnotation\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n TensorAnnotation.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies a TensorAnnotation message.\n * @function verify\n * @memberof onnx.TensorAnnotation\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n TensorAnnotation.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.tensorName != null && message.hasOwnProperty(\"tensorName\"))\n if (!$util.isString(message.tensorName))\n return \"tensorName: string expected\";\n if (message.quantParameterTensorNames != null && message.hasOwnProperty(\"quantParameterTensorNames\")) {\n if (!Array.isArray(message.quantParameterTensorNames))\n return \"quantParameterTensorNames: array expected\";\n for (var i = 0; i < message.quantParameterTensorNames.length; ++i) {\n var error = $root.onnx.StringStringEntryProto.verify(message.quantParameterTensorNames[i]);\n if (error)\n return \"quantParameterTensorNames.\" + error;\n }\n }\n return null;\n };\n\n /**\n * Creates a TensorAnnotation message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.TensorAnnotation\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.TensorAnnotation} TensorAnnotation\n */\n TensorAnnotation.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.TensorAnnotation)\n return object;\n var message = new $root.onnx.TensorAnnotation();\n if (object.tensorName != null)\n message.tensorName = String(object.tensorName);\n if (object.quantParameterTensorNames) {\n if (!Array.isArray(object.quantParameterTensorNames))\n throw TypeError(\".onnx.TensorAnnotation.quantParameterTensorNames: array expected\");\n message.quantParameterTensorNames = [];\n for (var i = 0; i < object.quantParameterTensorNames.length; ++i) {\n if (typeof object.quantParameterTensorNames[i] !== \"object\")\n throw TypeError(\".onnx.TensorAnnotation.quantParameterTensorNames: object expected\");\n message.quantParameterTensorNames[i] = $root.onnx.StringStringEntryProto.fromObject(object.quantParameterTensorNames[i]);\n }\n }\n return message;\n };\n\n /**\n * Creates a plain object from a TensorAnnotation message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.TensorAnnotation\n * @static\n * @param {onnx.TensorAnnotation} message TensorAnnotation\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n TensorAnnotation.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.arrays || options.defaults)\n object.quantParameterTensorNames = [];\n if (options.defaults)\n object.tensorName = \"\";\n if (message.tensorName != null && message.hasOwnProperty(\"tensorName\"))\n object.tensorName = message.tensorName;\n if (message.quantParameterTensorNames && message.quantParameterTensorNames.length) {\n object.quantParameterTensorNames = [];\n for (var j = 0; j < message.quantParameterTensorNames.length; ++j)\n object.quantParameterTensorNames[j] = $root.onnx.StringStringEntryProto.toObject(message.quantParameterTensorNames[j], options);\n }\n return object;\n };\n\n /**\n * Converts this TensorAnnotation to JSON.\n * @function toJSON\n * @memberof onnx.TensorAnnotation\n * @instance\n * @returns {Object.} JSON object\n */\n TensorAnnotation.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for TensorAnnotation\n * @function getTypeUrl\n * @memberof onnx.TensorAnnotation\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n TensorAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.TensorAnnotation\";\n };\n\n return TensorAnnotation;\n })();\n\n onnx.GraphProto = (function() {\n\n /**\n * Properties of a GraphProto.\n * @memberof onnx\n * @interface IGraphProto\n * @property {Array.|null} [node] GraphProto node\n * @property {string|null} [name] GraphProto name\n * @property {Array.|null} [initializer] GraphProto initializer\n * @property {Array.|null} [sparseInitializer] GraphProto sparseInitializer\n * @property {string|null} [docString] GraphProto docString\n * @property {Array.|null} [input] GraphProto input\n * @property {Array.|null} [output] GraphProto output\n * @property {Array.|null} [valueInfo] GraphProto valueInfo\n * @property {Array.|null} [quantizationAnnotation] GraphProto quantizationAnnotation\n */\n\n /**\n * Constructs a new GraphProto.\n * @memberof onnx\n * @classdesc Represents a GraphProto.\n * @implements IGraphProto\n * @constructor\n * @param {onnx.IGraphProto=} [properties] Properties to set\n */\n function GraphProto(properties) {\n this.node = [];\n this.initializer = [];\n this.sparseInitializer = [];\n this.input = [];\n this.output = [];\n this.valueInfo = [];\n this.quantizationAnnotation = [];\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * GraphProto node.\n * @member {Array.} node\n * @memberof onnx.GraphProto\n * @instance\n */\n GraphProto.prototype.node = $util.emptyArray;\n\n /**\n * GraphProto name.\n * @member {string} name\n * @memberof onnx.GraphProto\n * @instance\n */\n GraphProto.prototype.name = \"\";\n\n /**\n * GraphProto initializer.\n * @member {Array.} initializer\n * @memberof onnx.GraphProto\n * @instance\n */\n GraphProto.prototype.initializer = $util.emptyArray;\n\n /**\n * GraphProto sparseInitializer.\n * @member {Array.} sparseInitializer\n * @memberof onnx.GraphProto\n * @instance\n */\n GraphProto.prototype.sparseInitializer = $util.emptyArray;\n\n /**\n * GraphProto docString.\n * @member {string} docString\n * @memberof onnx.GraphProto\n * @instance\n */\n GraphProto.prototype.docString = \"\";\n\n /**\n * GraphProto input.\n * @member {Array.} input\n * @memberof onnx.GraphProto\n * @instance\n */\n GraphProto.prototype.input = $util.emptyArray;\n\n /**\n * GraphProto output.\n * @member {Array.} output\n * @memberof onnx.GraphProto\n * @instance\n */\n GraphProto.prototype.output = $util.emptyArray;\n\n /**\n * GraphProto valueInfo.\n * @member {Array.} valueInfo\n * @memberof onnx.GraphProto\n * @instance\n */\n GraphProto.prototype.valueInfo = $util.emptyArray;\n\n /**\n * GraphProto quantizationAnnotation.\n * @member {Array.} quantizationAnnotation\n * @memberof onnx.GraphProto\n * @instance\n */\n GraphProto.prototype.quantizationAnnotation = $util.emptyArray;\n\n /**\n * Creates a new GraphProto instance using the specified properties.\n * @function create\n * @memberof onnx.GraphProto\n * @static\n * @param {onnx.IGraphProto=} [properties] Properties to set\n * @returns {onnx.GraphProto} GraphProto instance\n */\n GraphProto.create = function create(properties) {\n return new GraphProto(properties);\n };\n\n /**\n * Encodes the specified GraphProto message. Does not implicitly {@link onnx.GraphProto.verify|verify} messages.\n * @function encode\n * @memberof onnx.GraphProto\n * @static\n * @param {onnx.IGraphProto} message GraphProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n GraphProto.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.node != null && message.node.length)\n for (var i = 0; i < message.node.length; ++i)\n $root.onnx.NodeProto.encode(message.node[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();\n if (message.name != null && Object.hasOwnProperty.call(message, \"name\"))\n writer.uint32(/* id 2, wireType 2 =*/18).string(message.name);\n if (message.initializer != null && message.initializer.length)\n for (var i = 0; i < message.initializer.length; ++i)\n $root.onnx.TensorProto.encode(message.initializer[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();\n if (message.docString != null && Object.hasOwnProperty.call(message, \"docString\"))\n writer.uint32(/* id 10, wireType 2 =*/82).string(message.docString);\n if (message.input != null && message.input.length)\n for (var i = 0; i < message.input.length; ++i)\n $root.onnx.ValueInfoProto.encode(message.input[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim();\n if (message.output != null && message.output.length)\n for (var i = 0; i < message.output.length; ++i)\n $root.onnx.ValueInfoProto.encode(message.output[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim();\n if (message.valueInfo != null && message.valueInfo.length)\n for (var i = 0; i < message.valueInfo.length; ++i)\n $root.onnx.ValueInfoProto.encode(message.valueInfo[i], writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim();\n if (message.quantizationAnnotation != null && message.quantizationAnnotation.length)\n for (var i = 0; i < message.quantizationAnnotation.length; ++i)\n $root.onnx.TensorAnnotation.encode(message.quantizationAnnotation[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim();\n if (message.sparseInitializer != null && message.sparseInitializer.length)\n for (var i = 0; i < message.sparseInitializer.length; ++i)\n $root.onnx.SparseTensorProto.encode(message.sparseInitializer[i], writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim();\n return writer;\n };\n\n /**\n * Encodes the specified GraphProto message, length delimited. Does not implicitly {@link onnx.GraphProto.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.GraphProto\n * @static\n * @param {onnx.IGraphProto} message GraphProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n GraphProto.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes a GraphProto message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.GraphProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.GraphProto} GraphProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n GraphProto.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.GraphProto();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (!(message.node && message.node.length))\n message.node = [];\n message.node.push($root.onnx.NodeProto.decode(reader, reader.uint32()));\n break;\n }\n case 2: {\n message.name = reader.string();\n break;\n }\n case 5: {\n if (!(message.initializer && message.initializer.length))\n message.initializer = [];\n message.initializer.push($root.onnx.TensorProto.decode(reader, reader.uint32()));\n break;\n }\n case 15: {\n if (!(message.sparseInitializer && message.sparseInitializer.length))\n message.sparseInitializer = [];\n message.sparseInitializer.push($root.onnx.SparseTensorProto.decode(reader, reader.uint32()));\n break;\n }\n case 10: {\n message.docString = reader.string();\n break;\n }\n case 11: {\n if (!(message.input && message.input.length))\n message.input = [];\n message.input.push($root.onnx.ValueInfoProto.decode(reader, reader.uint32()));\n break;\n }\n case 12: {\n if (!(message.output && message.output.length))\n message.output = [];\n message.output.push($root.onnx.ValueInfoProto.decode(reader, reader.uint32()));\n break;\n }\n case 13: {\n if (!(message.valueInfo && message.valueInfo.length))\n message.valueInfo = [];\n message.valueInfo.push($root.onnx.ValueInfoProto.decode(reader, reader.uint32()));\n break;\n }\n case 14: {\n if (!(message.quantizationAnnotation && message.quantizationAnnotation.length))\n message.quantizationAnnotation = [];\n message.quantizationAnnotation.push($root.onnx.TensorAnnotation.decode(reader, reader.uint32()));\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes a GraphProto message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.GraphProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.GraphProto} GraphProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n GraphProto.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies a GraphProto message.\n * @function verify\n * @memberof onnx.GraphProto\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n GraphProto.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.node != null && message.hasOwnProperty(\"node\")) {\n if (!Array.isArray(message.node))\n return \"node: array expected\";\n for (var i = 0; i < message.node.length; ++i) {\n var error = $root.onnx.NodeProto.verify(message.node[i]);\n if (error)\n return \"node.\" + error;\n }\n }\n if (message.name != null && message.hasOwnProperty(\"name\"))\n if (!$util.isString(message.name))\n return \"name: string expected\";\n if (message.initializer != null && message.hasOwnProperty(\"initializer\")) {\n if (!Array.isArray(message.initializer))\n return \"initializer: array expected\";\n for (var i = 0; i < message.initializer.length; ++i) {\n var error = $root.onnx.TensorProto.verify(message.initializer[i]);\n if (error)\n return \"initializer.\" + error;\n }\n }\n if (message.sparseInitializer != null && message.hasOwnProperty(\"sparseInitializer\")) {\n if (!Array.isArray(message.sparseInitializer))\n return \"sparseInitializer: array expected\";\n for (var i = 0; i < message.sparseInitializer.length; ++i) {\n var error = $root.onnx.SparseTensorProto.verify(message.sparseInitializer[i]);\n if (error)\n return \"sparseInitializer.\" + error;\n }\n }\n if (message.docString != null && message.hasOwnProperty(\"docString\"))\n if (!$util.isString(message.docString))\n return \"docString: string expected\";\n if (message.input != null && message.hasOwnProperty(\"input\")) {\n if (!Array.isArray(message.input))\n return \"input: array expected\";\n for (var i = 0; i < message.input.length; ++i) {\n var error = $root.onnx.ValueInfoProto.verify(message.input[i]);\n if (error)\n return \"input.\" + error;\n }\n }\n if (message.output != null && message.hasOwnProperty(\"output\")) {\n if (!Array.isArray(message.output))\n return \"output: array expected\";\n for (var i = 0; i < message.output.length; ++i) {\n var error = $root.onnx.ValueInfoProto.verify(message.output[i]);\n if (error)\n return \"output.\" + error;\n }\n }\n if (message.valueInfo != null && message.hasOwnProperty(\"valueInfo\")) {\n if (!Array.isArray(message.valueInfo))\n return \"valueInfo: array expected\";\n for (var i = 0; i < message.valueInfo.length; ++i) {\n var error = $root.onnx.ValueInfoProto.verify(message.valueInfo[i]);\n if (error)\n return \"valueInfo.\" + error;\n }\n }\n if (message.quantizationAnnotation != null && message.hasOwnProperty(\"quantizationAnnotation\")) {\n if (!Array.isArray(message.quantizationAnnotation))\n return \"quantizationAnnotation: array expected\";\n for (var i = 0; i < message.quantizationAnnotation.length; ++i) {\n var error = $root.onnx.TensorAnnotation.verify(message.quantizationAnnotation[i]);\n if (error)\n return \"quantizationAnnotation.\" + error;\n }\n }\n return null;\n };\n\n /**\n * Creates a GraphProto message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.GraphProto\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.GraphProto} GraphProto\n */\n GraphProto.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.GraphProto)\n return object;\n var message = new $root.onnx.GraphProto();\n if (object.node) {\n if (!Array.isArray(object.node))\n throw TypeError(\".onnx.GraphProto.node: array expected\");\n message.node = [];\n for (var i = 0; i < object.node.length; ++i) {\n if (typeof object.node[i] !== \"object\")\n throw TypeError(\".onnx.GraphProto.node: object expected\");\n message.node[i] = $root.onnx.NodeProto.fromObject(object.node[i]);\n }\n }\n if (object.name != null)\n message.name = String(object.name);\n if (object.initializer) {\n if (!Array.isArray(object.initializer))\n throw TypeError(\".onnx.GraphProto.initializer: array expected\");\n message.initializer = [];\n for (var i = 0; i < object.initializer.length; ++i) {\n if (typeof object.initializer[i] !== \"object\")\n throw TypeError(\".onnx.GraphProto.initializer: object expected\");\n message.initializer[i] = $root.onnx.TensorProto.fromObject(object.initializer[i]);\n }\n }\n if (object.sparseInitializer) {\n if (!Array.isArray(object.sparseInitializer))\n throw TypeError(\".onnx.GraphProto.sparseInitializer: array expected\");\n message.sparseInitializer = [];\n for (var i = 0; i < object.sparseInitializer.length; ++i) {\n if (typeof object.sparseInitializer[i] !== \"object\")\n throw TypeError(\".onnx.GraphProto.sparseInitializer: object expected\");\n message.sparseInitializer[i] = $root.onnx.SparseTensorProto.fromObject(object.sparseInitializer[i]);\n }\n }\n if (object.docString != null)\n message.docString = String(object.docString);\n if (object.input) {\n if (!Array.isArray(object.input))\n throw TypeError(\".onnx.GraphProto.input: array expected\");\n message.input = [];\n for (var i = 0; i < object.input.length; ++i) {\n if (typeof object.input[i] !== \"object\")\n throw TypeError(\".onnx.GraphProto.input: object expected\");\n message.input[i] = $root.onnx.ValueInfoProto.fromObject(object.input[i]);\n }\n }\n if (object.output) {\n if (!Array.isArray(object.output))\n throw TypeError(\".onnx.GraphProto.output: array expected\");\n message.output = [];\n for (var i = 0; i < object.output.length; ++i) {\n if (typeof object.output[i] !== \"object\")\n throw TypeError(\".onnx.GraphProto.output: object expected\");\n message.output[i] = $root.onnx.ValueInfoProto.fromObject(object.output[i]);\n }\n }\n if (object.valueInfo) {\n if (!Array.isArray(object.valueInfo))\n throw TypeError(\".onnx.GraphProto.valueInfo: array expected\");\n message.valueInfo = [];\n for (var i = 0; i < object.valueInfo.length; ++i) {\n if (typeof object.valueInfo[i] !== \"object\")\n throw TypeError(\".onnx.GraphProto.valueInfo: object expected\");\n message.valueInfo[i] = $root.onnx.ValueInfoProto.fromObject(object.valueInfo[i]);\n }\n }\n if (object.quantizationAnnotation) {\n if (!Array.isArray(object.quantizationAnnotation))\n throw TypeError(\".onnx.GraphProto.quantizationAnnotation: array expected\");\n message.quantizationAnnotation = [];\n for (var i = 0; i < object.quantizationAnnotation.length; ++i) {\n if (typeof object.quantizationAnnotation[i] !== \"object\")\n throw TypeError(\".onnx.GraphProto.quantizationAnnotation: object expected\");\n message.quantizationAnnotation[i] = $root.onnx.TensorAnnotation.fromObject(object.quantizationAnnotation[i]);\n }\n }\n return message;\n };\n\n /**\n * Creates a plain object from a GraphProto message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.GraphProto\n * @static\n * @param {onnx.GraphProto} message GraphProto\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n GraphProto.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.arrays || options.defaults) {\n object.node = [];\n object.initializer = [];\n object.input = [];\n object.output = [];\n object.valueInfo = [];\n object.quantizationAnnotation = [];\n object.sparseInitializer = [];\n }\n if (options.defaults) {\n object.name = \"\";\n object.docString = \"\";\n }\n if (message.node && message.node.length) {\n object.node = [];\n for (var j = 0; j < message.node.length; ++j)\n object.node[j] = $root.onnx.NodeProto.toObject(message.node[j], options);\n }\n if (message.name != null && message.hasOwnProperty(\"name\"))\n object.name = message.name;\n if (message.initializer && message.initializer.length) {\n object.initializer = [];\n for (var j = 0; j < message.initializer.length; ++j)\n object.initializer[j] = $root.onnx.TensorProto.toObject(message.initializer[j], options);\n }\n if (message.docString != null && message.hasOwnProperty(\"docString\"))\n object.docString = message.docString;\n if (message.input && message.input.length) {\n object.input = [];\n for (var j = 0; j < message.input.length; ++j)\n object.input[j] = $root.onnx.ValueInfoProto.toObject(message.input[j], options);\n }\n if (message.output && message.output.length) {\n object.output = [];\n for (var j = 0; j < message.output.length; ++j)\n object.output[j] = $root.onnx.ValueInfoProto.toObject(message.output[j], options);\n }\n if (message.valueInfo && message.valueInfo.length) {\n object.valueInfo = [];\n for (var j = 0; j < message.valueInfo.length; ++j)\n object.valueInfo[j] = $root.onnx.ValueInfoProto.toObject(message.valueInfo[j], options);\n }\n if (message.quantizationAnnotation && message.quantizationAnnotation.length) {\n object.quantizationAnnotation = [];\n for (var j = 0; j < message.quantizationAnnotation.length; ++j)\n object.quantizationAnnotation[j] = $root.onnx.TensorAnnotation.toObject(message.quantizationAnnotation[j], options);\n }\n if (message.sparseInitializer && message.sparseInitializer.length) {\n object.sparseInitializer = [];\n for (var j = 0; j < message.sparseInitializer.length; ++j)\n object.sparseInitializer[j] = $root.onnx.SparseTensorProto.toObject(message.sparseInitializer[j], options);\n }\n return object;\n };\n\n /**\n * Converts this GraphProto to JSON.\n * @function toJSON\n * @memberof onnx.GraphProto\n * @instance\n * @returns {Object.} JSON object\n */\n GraphProto.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for GraphProto\n * @function getTypeUrl\n * @memberof onnx.GraphProto\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n GraphProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.GraphProto\";\n };\n\n return GraphProto;\n })();\n\n onnx.TensorProto = (function() {\n\n /**\n * Properties of a TensorProto.\n * @memberof onnx\n * @interface ITensorProto\n * @property {Array.|null} [dims] TensorProto dims\n * @property {number|null} [dataType] TensorProto dataType\n * @property {onnx.TensorProto.ISegment|null} [segment] TensorProto segment\n * @property {Array.|null} [floatData] TensorProto floatData\n * @property {Array.|null} [int32Data] TensorProto int32Data\n * @property {Array.|null} [stringData] TensorProto stringData\n * @property {Array.|null} [int64Data] TensorProto int64Data\n * @property {string|null} [name] TensorProto name\n * @property {string|null} [docString] TensorProto docString\n * @property {Uint8Array|null} [rawData] TensorProto rawData\n * @property {Array.|null} [externalData] TensorProto externalData\n * @property {onnx.TensorProto.DataLocation|null} [dataLocation] TensorProto dataLocation\n * @property {Array.|null} [doubleData] TensorProto doubleData\n * @property {Array.|null} [uint64Data] TensorProto uint64Data\n */\n\n /**\n * Constructs a new TensorProto.\n * @memberof onnx\n * @classdesc Represents a TensorProto.\n * @implements ITensorProto\n * @constructor\n * @param {onnx.ITensorProto=} [properties] Properties to set\n */\n function TensorProto(properties) {\n this.dims = [];\n this.floatData = [];\n this.int32Data = [];\n this.stringData = [];\n this.int64Data = [];\n this.externalData = [];\n this.doubleData = [];\n this.uint64Data = [];\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * TensorProto dims.\n * @member {Array.} dims\n * @memberof onnx.TensorProto\n * @instance\n */\n TensorProto.prototype.dims = $util.emptyArray;\n\n /**\n * TensorProto dataType.\n * @member {number} dataType\n * @memberof onnx.TensorProto\n * @instance\n */\n TensorProto.prototype.dataType = 0;\n\n /**\n * TensorProto segment.\n * @member {onnx.TensorProto.ISegment|null|undefined} segment\n * @memberof onnx.TensorProto\n * @instance\n */\n TensorProto.prototype.segment = null;\n\n /**\n * TensorProto floatData.\n * @member {Array.} floatData\n * @memberof onnx.TensorProto\n * @instance\n */\n TensorProto.prototype.floatData = $util.emptyArray;\n\n /**\n * TensorProto int32Data.\n * @member {Array.} int32Data\n * @memberof onnx.TensorProto\n * @instance\n */\n TensorProto.prototype.int32Data = $util.emptyArray;\n\n /**\n * TensorProto stringData.\n * @member {Array.} stringData\n * @memberof onnx.TensorProto\n * @instance\n */\n TensorProto.prototype.stringData = $util.emptyArray;\n\n /**\n * TensorProto int64Data.\n * @member {Array.} int64Data\n * @memberof onnx.TensorProto\n * @instance\n */\n TensorProto.prototype.int64Data = $util.emptyArray;\n\n /**\n * TensorProto name.\n * @member {string} name\n * @memberof onnx.TensorProto\n * @instance\n */\n TensorProto.prototype.name = \"\";\n\n /**\n * TensorProto docString.\n * @member {string} docString\n * @memberof onnx.TensorProto\n * @instance\n */\n TensorProto.prototype.docString = \"\";\n\n /**\n * TensorProto rawData.\n * @member {Uint8Array} rawData\n * @memberof onnx.TensorProto\n * @instance\n */\n TensorProto.prototype.rawData = $util.newBuffer([]);\n\n /**\n * TensorProto externalData.\n * @member {Array.} externalData\n * @memberof onnx.TensorProto\n * @instance\n */\n TensorProto.prototype.externalData = $util.emptyArray;\n\n /**\n * TensorProto dataLocation.\n * @member {onnx.TensorProto.DataLocation} dataLocation\n * @memberof onnx.TensorProto\n * @instance\n */\n TensorProto.prototype.dataLocation = 0;\n\n /**\n * TensorProto doubleData.\n * @member {Array.} doubleData\n * @memberof onnx.TensorProto\n * @instance\n */\n TensorProto.prototype.doubleData = $util.emptyArray;\n\n /**\n * TensorProto uint64Data.\n * @member {Array.} uint64Data\n * @memberof onnx.TensorProto\n * @instance\n */\n TensorProto.prototype.uint64Data = $util.emptyArray;\n\n /**\n * Creates a new TensorProto instance using the specified properties.\n * @function create\n * @memberof onnx.TensorProto\n * @static\n * @param {onnx.ITensorProto=} [properties] Properties to set\n * @returns {onnx.TensorProto} TensorProto instance\n */\n TensorProto.create = function create(properties) {\n return new TensorProto(properties);\n };\n\n /**\n * Encodes the specified TensorProto message. Does not implicitly {@link onnx.TensorProto.verify|verify} messages.\n * @function encode\n * @memberof onnx.TensorProto\n * @static\n * @param {onnx.ITensorProto} message TensorProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n TensorProto.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.dims != null && message.dims.length) {\n writer.uint32(/* id 1, wireType 2 =*/10).fork();\n for (var i = 0; i < message.dims.length; ++i)\n writer.int64(message.dims[i]);\n writer.ldelim();\n }\n if (message.dataType != null && Object.hasOwnProperty.call(message, \"dataType\"))\n writer.uint32(/* id 2, wireType 0 =*/16).int32(message.dataType);\n if (message.segment != null && Object.hasOwnProperty.call(message, \"segment\"))\n $root.onnx.TensorProto.Segment.encode(message.segment, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();\n if (message.floatData != null && message.floatData.length) {\n writer.uint32(/* id 4, wireType 2 =*/34).fork();\n for (var i = 0; i < message.floatData.length; ++i)\n writer.float(message.floatData[i]);\n writer.ldelim();\n }\n if (message.int32Data != null && message.int32Data.length) {\n writer.uint32(/* id 5, wireType 2 =*/42).fork();\n for (var i = 0; i < message.int32Data.length; ++i)\n writer.int32(message.int32Data[i]);\n writer.ldelim();\n }\n if (message.stringData != null && message.stringData.length)\n for (var i = 0; i < message.stringData.length; ++i)\n writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.stringData[i]);\n if (message.int64Data != null && message.int64Data.length) {\n writer.uint32(/* id 7, wireType 2 =*/58).fork();\n for (var i = 0; i < message.int64Data.length; ++i)\n writer.int64(message.int64Data[i]);\n writer.ldelim();\n }\n if (message.name != null && Object.hasOwnProperty.call(message, \"name\"))\n writer.uint32(/* id 8, wireType 2 =*/66).string(message.name);\n if (message.rawData != null && Object.hasOwnProperty.call(message, \"rawData\"))\n writer.uint32(/* id 9, wireType 2 =*/74).bytes(message.rawData);\n if (message.doubleData != null && message.doubleData.length) {\n writer.uint32(/* id 10, wireType 2 =*/82).fork();\n for (var i = 0; i < message.doubleData.length; ++i)\n writer.double(message.doubleData[i]);\n writer.ldelim();\n }\n if (message.uint64Data != null && message.uint64Data.length) {\n writer.uint32(/* id 11, wireType 2 =*/90).fork();\n for (var i = 0; i < message.uint64Data.length; ++i)\n writer.uint64(message.uint64Data[i]);\n writer.ldelim();\n }\n if (message.docString != null && Object.hasOwnProperty.call(message, \"docString\"))\n writer.uint32(/* id 12, wireType 2 =*/98).string(message.docString);\n if (message.externalData != null && message.externalData.length)\n for (var i = 0; i < message.externalData.length; ++i)\n $root.onnx.StringStringEntryProto.encode(message.externalData[i], writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim();\n if (message.dataLocation != null && Object.hasOwnProperty.call(message, \"dataLocation\"))\n writer.uint32(/* id 14, wireType 0 =*/112).int32(message.dataLocation);\n return writer;\n };\n\n /**\n * Encodes the specified TensorProto message, length delimited. Does not implicitly {@link onnx.TensorProto.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.TensorProto\n * @static\n * @param {onnx.ITensorProto} message TensorProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n TensorProto.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes a TensorProto message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.TensorProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.TensorProto} TensorProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n TensorProto.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TensorProto();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (!(message.dims && message.dims.length))\n message.dims = [];\n if ((tag & 7) === 2) {\n var end2 = reader.uint32() + reader.pos;\n while (reader.pos < end2)\n message.dims.push(reader.int64());\n } else\n message.dims.push(reader.int64());\n break;\n }\n case 2: {\n message.dataType = reader.int32();\n break;\n }\n case 3: {\n message.segment = $root.onnx.TensorProto.Segment.decode(reader, reader.uint32());\n break;\n }\n case 4: {\n if (!(message.floatData && message.floatData.length))\n message.floatData = [];\n if ((tag & 7) === 2) {\n var end2 = reader.uint32() + reader.pos;\n while (reader.pos < end2)\n message.floatData.push(reader.float());\n } else\n message.floatData.push(reader.float());\n break;\n }\n case 5: {\n if (!(message.int32Data && message.int32Data.length))\n message.int32Data = [];\n if ((tag & 7) === 2) {\n var end2 = reader.uint32() + reader.pos;\n while (reader.pos < end2)\n message.int32Data.push(reader.int32());\n } else\n message.int32Data.push(reader.int32());\n break;\n }\n case 6: {\n if (!(message.stringData && message.stringData.length))\n message.stringData = [];\n message.stringData.push(reader.bytes());\n break;\n }\n case 7: {\n if (!(message.int64Data && message.int64Data.length))\n message.int64Data = [];\n if ((tag & 7) === 2) {\n var end2 = reader.uint32() + reader.pos;\n while (reader.pos < end2)\n message.int64Data.push(reader.int64());\n } else\n message.int64Data.push(reader.int64());\n break;\n }\n case 8: {\n message.name = reader.string();\n break;\n }\n case 12: {\n message.docString = reader.string();\n break;\n }\n case 9: {\n message.rawData = reader.bytes();\n break;\n }\n case 13: {\n if (!(message.externalData && message.externalData.length))\n message.externalData = [];\n message.externalData.push($root.onnx.StringStringEntryProto.decode(reader, reader.uint32()));\n break;\n }\n case 14: {\n message.dataLocation = reader.int32();\n break;\n }\n case 10: {\n if (!(message.doubleData && message.doubleData.length))\n message.doubleData = [];\n if ((tag & 7) === 2) {\n var end2 = reader.uint32() + reader.pos;\n while (reader.pos < end2)\n message.doubleData.push(reader.double());\n } else\n message.doubleData.push(reader.double());\n break;\n }\n case 11: {\n if (!(message.uint64Data && message.uint64Data.length))\n message.uint64Data = [];\n if ((tag & 7) === 2) {\n var end2 = reader.uint32() + reader.pos;\n while (reader.pos < end2)\n message.uint64Data.push(reader.uint64());\n } else\n message.uint64Data.push(reader.uint64());\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes a TensorProto message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.TensorProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.TensorProto} TensorProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n TensorProto.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies a TensorProto message.\n * @function verify\n * @memberof onnx.TensorProto\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n TensorProto.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.dims != null && message.hasOwnProperty(\"dims\")) {\n if (!Array.isArray(message.dims))\n return \"dims: array expected\";\n for (var i = 0; i < message.dims.length; ++i)\n if (!$util.isInteger(message.dims[i]) && !(message.dims[i] && $util.isInteger(message.dims[i].low) && $util.isInteger(message.dims[i].high)))\n return \"dims: integer|Long[] expected\";\n }\n if (message.dataType != null && message.hasOwnProperty(\"dataType\"))\n if (!$util.isInteger(message.dataType))\n return \"dataType: integer expected\";\n if (message.segment != null && message.hasOwnProperty(\"segment\")) {\n var error = $root.onnx.TensorProto.Segment.verify(message.segment);\n if (error)\n return \"segment.\" + error;\n }\n if (message.floatData != null && message.hasOwnProperty(\"floatData\")) {\n if (!Array.isArray(message.floatData))\n return \"floatData: array expected\";\n for (var i = 0; i < message.floatData.length; ++i)\n if (typeof message.floatData[i] !== \"number\")\n return \"floatData: number[] expected\";\n }\n if (message.int32Data != null && message.hasOwnProperty(\"int32Data\")) {\n if (!Array.isArray(message.int32Data))\n return \"int32Data: array expected\";\n for (var i = 0; i < message.int32Data.length; ++i)\n if (!$util.isInteger(message.int32Data[i]))\n return \"int32Data: integer[] expected\";\n }\n if (message.stringData != null && message.hasOwnProperty(\"stringData\")) {\n if (!Array.isArray(message.stringData))\n return \"stringData: array expected\";\n for (var i = 0; i < message.stringData.length; ++i)\n if (!(message.stringData[i] && typeof message.stringData[i].length === \"number\" || $util.isString(message.stringData[i])))\n return \"stringData: buffer[] expected\";\n }\n if (message.int64Data != null && message.hasOwnProperty(\"int64Data\")) {\n if (!Array.isArray(message.int64Data))\n return \"int64Data: array expected\";\n for (var i = 0; i < message.int64Data.length; ++i)\n if (!$util.isInteger(message.int64Data[i]) && !(message.int64Data[i] && $util.isInteger(message.int64Data[i].low) && $util.isInteger(message.int64Data[i].high)))\n return \"int64Data: integer|Long[] expected\";\n }\n if (message.name != null && message.hasOwnProperty(\"name\"))\n if (!$util.isString(message.name))\n return \"name: string expected\";\n if (message.docString != null && message.hasOwnProperty(\"docString\"))\n if (!$util.isString(message.docString))\n return \"docString: string expected\";\n if (message.rawData != null && message.hasOwnProperty(\"rawData\"))\n if (!(message.rawData && typeof message.rawData.length === \"number\" || $util.isString(message.rawData)))\n return \"rawData: buffer expected\";\n if (message.externalData != null && message.hasOwnProperty(\"externalData\")) {\n if (!Array.isArray(message.externalData))\n return \"externalData: array expected\";\n for (var i = 0; i < message.externalData.length; ++i) {\n var error = $root.onnx.StringStringEntryProto.verify(message.externalData[i]);\n if (error)\n return \"externalData.\" + error;\n }\n }\n if (message.dataLocation != null && message.hasOwnProperty(\"dataLocation\"))\n switch (message.dataLocation) {\n default:\n return \"dataLocation: enum value expected\";\n case 0:\n case 1:\n break;\n }\n if (message.doubleData != null && message.hasOwnProperty(\"doubleData\")) {\n if (!Array.isArray(message.doubleData))\n return \"doubleData: array expected\";\n for (var i = 0; i < message.doubleData.length; ++i)\n if (typeof message.doubleData[i] !== \"number\")\n return \"doubleData: number[] expected\";\n }\n if (message.uint64Data != null && message.hasOwnProperty(\"uint64Data\")) {\n if (!Array.isArray(message.uint64Data))\n return \"uint64Data: array expected\";\n for (var i = 0; i < message.uint64Data.length; ++i)\n if (!$util.isInteger(message.uint64Data[i]) && !(message.uint64Data[i] && $util.isInteger(message.uint64Data[i].low) && $util.isInteger(message.uint64Data[i].high)))\n return \"uint64Data: integer|Long[] expected\";\n }\n return null;\n };\n\n /**\n * Creates a TensorProto message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.TensorProto\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.TensorProto} TensorProto\n */\n TensorProto.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.TensorProto)\n return object;\n var message = new $root.onnx.TensorProto();\n if (object.dims) {\n if (!Array.isArray(object.dims))\n throw TypeError(\".onnx.TensorProto.dims: array expected\");\n message.dims = [];\n for (var i = 0; i < object.dims.length; ++i)\n if ($util.Long)\n (message.dims[i] = $util.Long.fromValue(object.dims[i])).unsigned = false;\n else if (typeof object.dims[i] === \"string\")\n message.dims[i] = parseInt(object.dims[i], 10);\n else if (typeof object.dims[i] === \"number\")\n message.dims[i] = object.dims[i];\n else if (typeof object.dims[i] === \"object\")\n message.dims[i] = new $util.LongBits(object.dims[i].low >>> 0, object.dims[i].high >>> 0).toNumber();\n }\n if (object.dataType != null)\n message.dataType = object.dataType | 0;\n if (object.segment != null) {\n if (typeof object.segment !== \"object\")\n throw TypeError(\".onnx.TensorProto.segment: object expected\");\n message.segment = $root.onnx.TensorProto.Segment.fromObject(object.segment);\n }\n if (object.floatData) {\n if (!Array.isArray(object.floatData))\n throw TypeError(\".onnx.TensorProto.floatData: array expected\");\n message.floatData = [];\n for (var i = 0; i < object.floatData.length; ++i)\n message.floatData[i] = Number(object.floatData[i]);\n }\n if (object.int32Data) {\n if (!Array.isArray(object.int32Data))\n throw TypeError(\".onnx.TensorProto.int32Data: array expected\");\n message.int32Data = [];\n for (var i = 0; i < object.int32Data.length; ++i)\n message.int32Data[i] = object.int32Data[i] | 0;\n }\n if (object.stringData) {\n if (!Array.isArray(object.stringData))\n throw TypeError(\".onnx.TensorProto.stringData: array expected\");\n message.stringData = [];\n for (var i = 0; i < object.stringData.length; ++i)\n if (typeof object.stringData[i] === \"string\")\n $util.base64.decode(object.stringData[i], message.stringData[i] = $util.newBuffer($util.base64.length(object.stringData[i])), 0);\n else if (object.stringData[i].length >= 0)\n message.stringData[i] = object.stringData[i];\n }\n if (object.int64Data) {\n if (!Array.isArray(object.int64Data))\n throw TypeError(\".onnx.TensorProto.int64Data: array expected\");\n message.int64Data = [];\n for (var i = 0; i < object.int64Data.length; ++i)\n if ($util.Long)\n (message.int64Data[i] = $util.Long.fromValue(object.int64Data[i])).unsigned = false;\n else if (typeof object.int64Data[i] === \"string\")\n message.int64Data[i] = parseInt(object.int64Data[i], 10);\n else if (typeof object.int64Data[i] === \"number\")\n message.int64Data[i] = object.int64Data[i];\n else if (typeof object.int64Data[i] === \"object\")\n message.int64Data[i] = new $util.LongBits(object.int64Data[i].low >>> 0, object.int64Data[i].high >>> 0).toNumber();\n }\n if (object.name != null)\n message.name = String(object.name);\n if (object.docString != null)\n message.docString = String(object.docString);\n if (object.rawData != null)\n if (typeof object.rawData === \"string\")\n $util.base64.decode(object.rawData, message.rawData = $util.newBuffer($util.base64.length(object.rawData)), 0);\n else if (object.rawData.length >= 0)\n message.rawData = object.rawData;\n if (object.externalData) {\n if (!Array.isArray(object.externalData))\n throw TypeError(\".onnx.TensorProto.externalData: array expected\");\n message.externalData = [];\n for (var i = 0; i < object.externalData.length; ++i) {\n if (typeof object.externalData[i] !== \"object\")\n throw TypeError(\".onnx.TensorProto.externalData: object expected\");\n message.externalData[i] = $root.onnx.StringStringEntryProto.fromObject(object.externalData[i]);\n }\n }\n switch (object.dataLocation) {\n default:\n if (typeof object.dataLocation === \"number\") {\n message.dataLocation = object.dataLocation;\n break;\n }\n break;\n case \"DEFAULT\":\n case 0:\n message.dataLocation = 0;\n break;\n case \"EXTERNAL\":\n case 1:\n message.dataLocation = 1;\n break;\n }\n if (object.doubleData) {\n if (!Array.isArray(object.doubleData))\n throw TypeError(\".onnx.TensorProto.doubleData: array expected\");\n message.doubleData = [];\n for (var i = 0; i < object.doubleData.length; ++i)\n message.doubleData[i] = Number(object.doubleData[i]);\n }\n if (object.uint64Data) {\n if (!Array.isArray(object.uint64Data))\n throw TypeError(\".onnx.TensorProto.uint64Data: array expected\");\n message.uint64Data = [];\n for (var i = 0; i < object.uint64Data.length; ++i)\n if ($util.Long)\n (message.uint64Data[i] = $util.Long.fromValue(object.uint64Data[i])).unsigned = true;\n else if (typeof object.uint64Data[i] === \"string\")\n message.uint64Data[i] = parseInt(object.uint64Data[i], 10);\n else if (typeof object.uint64Data[i] === \"number\")\n message.uint64Data[i] = object.uint64Data[i];\n else if (typeof object.uint64Data[i] === \"object\")\n message.uint64Data[i] = new $util.LongBits(object.uint64Data[i].low >>> 0, object.uint64Data[i].high >>> 0).toNumber(true);\n }\n return message;\n };\n\n /**\n * Creates a plain object from a TensorProto message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.TensorProto\n * @static\n * @param {onnx.TensorProto} message TensorProto\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n TensorProto.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.arrays || options.defaults) {\n object.dims = [];\n object.floatData = [];\n object.int32Data = [];\n object.stringData = [];\n object.int64Data = [];\n object.doubleData = [];\n object.uint64Data = [];\n object.externalData = [];\n }\n if (options.defaults) {\n object.dataType = 0;\n object.segment = null;\n object.name = \"\";\n if (options.bytes === String)\n object.rawData = \"\";\n else {\n object.rawData = [];\n if (options.bytes !== Array)\n object.rawData = $util.newBuffer(object.rawData);\n }\n object.docString = \"\";\n object.dataLocation = options.enums === String ? \"DEFAULT\" : 0;\n }\n if (message.dims && message.dims.length) {\n object.dims = [];\n for (var j = 0; j < message.dims.length; ++j)\n if (typeof message.dims[j] === \"number\")\n object.dims[j] = options.longs === String ? String(message.dims[j]) : message.dims[j];\n else\n object.dims[j] = options.longs === String ? $util.Long.prototype.toString.call(message.dims[j]) : options.longs === Number ? new $util.LongBits(message.dims[j].low >>> 0, message.dims[j].high >>> 0).toNumber() : message.dims[j];\n }\n if (message.dataType != null && message.hasOwnProperty(\"dataType\"))\n object.dataType = message.dataType;\n if (message.segment != null && message.hasOwnProperty(\"segment\"))\n object.segment = $root.onnx.TensorProto.Segment.toObject(message.segment, options);\n if (message.floatData && message.floatData.length) {\n object.floatData = [];\n for (var j = 0; j < message.floatData.length; ++j)\n object.floatData[j] = options.json && !isFinite(message.floatData[j]) ? String(message.floatData[j]) : message.floatData[j];\n }\n if (message.int32Data && message.int32Data.length) {\n object.int32Data = [];\n for (var j = 0; j < message.int32Data.length; ++j)\n object.int32Data[j] = message.int32Data[j];\n }\n if (message.stringData && message.stringData.length) {\n object.stringData = [];\n for (var j = 0; j < message.stringData.length; ++j)\n object.stringData[j] = options.bytes === String ? $util.base64.encode(message.stringData[j], 0, message.stringData[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.stringData[j]) : message.stringData[j];\n }\n if (message.int64Data && message.int64Data.length) {\n object.int64Data = [];\n for (var j = 0; j < message.int64Data.length; ++j)\n if (typeof message.int64Data[j] === \"number\")\n object.int64Data[j] = options.longs === String ? String(message.int64Data[j]) : message.int64Data[j];\n else\n object.int64Data[j] = options.longs === String ? $util.Long.prototype.toString.call(message.int64Data[j]) : options.longs === Number ? new $util.LongBits(message.int64Data[j].low >>> 0, message.int64Data[j].high >>> 0).toNumber() : message.int64Data[j];\n }\n if (message.name != null && message.hasOwnProperty(\"name\"))\n object.name = message.name;\n if (message.rawData != null && message.hasOwnProperty(\"rawData\"))\n object.rawData = options.bytes === String ? $util.base64.encode(message.rawData, 0, message.rawData.length) : options.bytes === Array ? Array.prototype.slice.call(message.rawData) : message.rawData;\n if (message.doubleData && message.doubleData.length) {\n object.doubleData = [];\n for (var j = 0; j < message.doubleData.length; ++j)\n object.doubleData[j] = options.json && !isFinite(message.doubleData[j]) ? String(message.doubleData[j]) : message.doubleData[j];\n }\n if (message.uint64Data && message.uint64Data.length) {\n object.uint64Data = [];\n for (var j = 0; j < message.uint64Data.length; ++j)\n if (typeof message.uint64Data[j] === \"number\")\n object.uint64Data[j] = options.longs === String ? String(message.uint64Data[j]) : message.uint64Data[j];\n else\n object.uint64Data[j] = options.longs === String ? $util.Long.prototype.toString.call(message.uint64Data[j]) : options.longs === Number ? new $util.LongBits(message.uint64Data[j].low >>> 0, message.uint64Data[j].high >>> 0).toNumber(true) : message.uint64Data[j];\n }\n if (message.docString != null && message.hasOwnProperty(\"docString\"))\n object.docString = message.docString;\n if (message.externalData && message.externalData.length) {\n object.externalData = [];\n for (var j = 0; j < message.externalData.length; ++j)\n object.externalData[j] = $root.onnx.StringStringEntryProto.toObject(message.externalData[j], options);\n }\n if (message.dataLocation != null && message.hasOwnProperty(\"dataLocation\"))\n object.dataLocation = options.enums === String ? $root.onnx.TensorProto.DataLocation[message.dataLocation] === undefined ? message.dataLocation : $root.onnx.TensorProto.DataLocation[message.dataLocation] : message.dataLocation;\n return object;\n };\n\n /**\n * Converts this TensorProto to JSON.\n * @function toJSON\n * @memberof onnx.TensorProto\n * @instance\n * @returns {Object.} JSON object\n */\n TensorProto.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for TensorProto\n * @function getTypeUrl\n * @memberof onnx.TensorProto\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n TensorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.TensorProto\";\n };\n\n /**\n * DataType enum.\n * @name onnx.TensorProto.DataType\n * @enum {number}\n * @property {number} UNDEFINED=0 UNDEFINED value\n * @property {number} FLOAT=1 FLOAT value\n * @property {number} UINT8=2 UINT8 value\n * @property {number} INT8=3 INT8 value\n * @property {number} UINT16=4 UINT16 value\n * @property {number} INT16=5 INT16 value\n * @property {number} INT32=6 INT32 value\n * @property {number} INT64=7 INT64 value\n * @property {number} STRING=8 STRING value\n * @property {number} BOOL=9 BOOL value\n * @property {number} FLOAT16=10 FLOAT16 value\n * @property {number} DOUBLE=11 DOUBLE value\n * @property {number} UINT32=12 UINT32 value\n * @property {number} UINT64=13 UINT64 value\n * @property {number} COMPLEX64=14 COMPLEX64 value\n * @property {number} COMPLEX128=15 COMPLEX128 value\n * @property {number} BFLOAT16=16 BFLOAT16 value\n * @property {number} FLOAT8E4M3FN=17 FLOAT8E4M3FN value\n * @property {number} FLOAT8E4M3FNUZ=18 FLOAT8E4M3FNUZ value\n * @property {number} FLOAT8E5M2=19 FLOAT8E5M2 value\n * @property {number} FLOAT8E5M2FNUZ=20 FLOAT8E5M2FNUZ value\n */\n TensorProto.DataType = (function() {\n var valuesById = {}, values = Object.create(valuesById);\n values[valuesById[0] = \"UNDEFINED\"] = 0;\n values[valuesById[1] = \"FLOAT\"] = 1;\n values[valuesById[2] = \"UINT8\"] = 2;\n values[valuesById[3] = \"INT8\"] = 3;\n values[valuesById[4] = \"UINT16\"] = 4;\n values[valuesById[5] = \"INT16\"] = 5;\n values[valuesById[6] = \"INT32\"] = 6;\n values[valuesById[7] = \"INT64\"] = 7;\n values[valuesById[8] = \"STRING\"] = 8;\n values[valuesById[9] = \"BOOL\"] = 9;\n values[valuesById[10] = \"FLOAT16\"] = 10;\n values[valuesById[11] = \"DOUBLE\"] = 11;\n values[valuesById[12] = \"UINT32\"] = 12;\n values[valuesById[13] = \"UINT64\"] = 13;\n values[valuesById[14] = \"COMPLEX64\"] = 14;\n values[valuesById[15] = \"COMPLEX128\"] = 15;\n values[valuesById[16] = \"BFLOAT16\"] = 16;\n values[valuesById[17] = \"FLOAT8E4M3FN\"] = 17;\n values[valuesById[18] = \"FLOAT8E4M3FNUZ\"] = 18;\n values[valuesById[19] = \"FLOAT8E5M2\"] = 19;\n values[valuesById[20] = \"FLOAT8E5M2FNUZ\"] = 20;\n return values;\n })();\n\n TensorProto.Segment = (function() {\n\n /**\n * Properties of a Segment.\n * @memberof onnx.TensorProto\n * @interface ISegment\n * @property {number|Long|null} [begin] Segment begin\n * @property {number|Long|null} [end] Segment end\n */\n\n /**\n * Constructs a new Segment.\n * @memberof onnx.TensorProto\n * @classdesc Represents a Segment.\n * @implements ISegment\n * @constructor\n * @param {onnx.TensorProto.ISegment=} [properties] Properties to set\n */\n function Segment(properties) {\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * Segment begin.\n * @member {number|Long} begin\n * @memberof onnx.TensorProto.Segment\n * @instance\n */\n Segment.prototype.begin = $util.Long ? $util.Long.fromBits(0,0,false) : 0;\n\n /**\n * Segment end.\n * @member {number|Long} end\n * @memberof onnx.TensorProto.Segment\n * @instance\n */\n Segment.prototype.end = $util.Long ? $util.Long.fromBits(0,0,false) : 0;\n\n /**\n * Creates a new Segment instance using the specified properties.\n * @function create\n * @memberof onnx.TensorProto.Segment\n * @static\n * @param {onnx.TensorProto.ISegment=} [properties] Properties to set\n * @returns {onnx.TensorProto.Segment} Segment instance\n */\n Segment.create = function create(properties) {\n return new Segment(properties);\n };\n\n /**\n * Encodes the specified Segment message. Does not implicitly {@link onnx.TensorProto.Segment.verify|verify} messages.\n * @function encode\n * @memberof onnx.TensorProto.Segment\n * @static\n * @param {onnx.TensorProto.ISegment} message Segment message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n Segment.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.begin != null && Object.hasOwnProperty.call(message, \"begin\"))\n writer.uint32(/* id 1, wireType 0 =*/8).int64(message.begin);\n if (message.end != null && Object.hasOwnProperty.call(message, \"end\"))\n writer.uint32(/* id 2, wireType 0 =*/16).int64(message.end);\n return writer;\n };\n\n /**\n * Encodes the specified Segment message, length delimited. Does not implicitly {@link onnx.TensorProto.Segment.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.TensorProto.Segment\n * @static\n * @param {onnx.TensorProto.ISegment} message Segment message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n Segment.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes a Segment message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.TensorProto.Segment\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.TensorProto.Segment} Segment\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n Segment.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TensorProto.Segment();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n message.begin = reader.int64();\n break;\n }\n case 2: {\n message.end = reader.int64();\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes a Segment message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.TensorProto.Segment\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.TensorProto.Segment} Segment\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n Segment.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies a Segment message.\n * @function verify\n * @memberof onnx.TensorProto.Segment\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n Segment.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.begin != null && message.hasOwnProperty(\"begin\"))\n if (!$util.isInteger(message.begin) && !(message.begin && $util.isInteger(message.begin.low) && $util.isInteger(message.begin.high)))\n return \"begin: integer|Long expected\";\n if (message.end != null && message.hasOwnProperty(\"end\"))\n if (!$util.isInteger(message.end) && !(message.end && $util.isInteger(message.end.low) && $util.isInteger(message.end.high)))\n return \"end: integer|Long expected\";\n return null;\n };\n\n /**\n * Creates a Segment message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.TensorProto.Segment\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.TensorProto.Segment} Segment\n */\n Segment.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.TensorProto.Segment)\n return object;\n var message = new $root.onnx.TensorProto.Segment();\n if (object.begin != null)\n if ($util.Long)\n (message.begin = $util.Long.fromValue(object.begin)).unsigned = false;\n else if (typeof object.begin === \"string\")\n message.begin = parseInt(object.begin, 10);\n else if (typeof object.begin === \"number\")\n message.begin = object.begin;\n else if (typeof object.begin === \"object\")\n message.begin = new $util.LongBits(object.begin.low >>> 0, object.begin.high >>> 0).toNumber();\n if (object.end != null)\n if ($util.Long)\n (message.end = $util.Long.fromValue(object.end)).unsigned = false;\n else if (typeof object.end === \"string\")\n message.end = parseInt(object.end, 10);\n else if (typeof object.end === \"number\")\n message.end = object.end;\n else if (typeof object.end === \"object\")\n message.end = new $util.LongBits(object.end.low >>> 0, object.end.high >>> 0).toNumber();\n return message;\n };\n\n /**\n * Creates a plain object from a Segment message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.TensorProto.Segment\n * @static\n * @param {onnx.TensorProto.Segment} message Segment\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n Segment.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.defaults) {\n if ($util.Long) {\n var long = new $util.Long(0, 0, false);\n object.begin = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;\n } else\n object.begin = options.longs === String ? \"0\" : 0;\n if ($util.Long) {\n var long = new $util.Long(0, 0, false);\n object.end = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;\n } else\n object.end = options.longs === String ? \"0\" : 0;\n }\n if (message.begin != null && message.hasOwnProperty(\"begin\"))\n if (typeof message.begin === \"number\")\n object.begin = options.longs === String ? String(message.begin) : message.begin;\n else\n object.begin = options.longs === String ? $util.Long.prototype.toString.call(message.begin) : options.longs === Number ? new $util.LongBits(message.begin.low >>> 0, message.begin.high >>> 0).toNumber() : message.begin;\n if (message.end != null && message.hasOwnProperty(\"end\"))\n if (typeof message.end === \"number\")\n object.end = options.longs === String ? String(message.end) : message.end;\n else\n object.end = options.longs === String ? $util.Long.prototype.toString.call(message.end) : options.longs === Number ? new $util.LongBits(message.end.low >>> 0, message.end.high >>> 0).toNumber() : message.end;\n return object;\n };\n\n /**\n * Converts this Segment to JSON.\n * @function toJSON\n * @memberof onnx.TensorProto.Segment\n * @instance\n * @returns {Object.} JSON object\n */\n Segment.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for Segment\n * @function getTypeUrl\n * @memberof onnx.TensorProto.Segment\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n Segment.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.TensorProto.Segment\";\n };\n\n return Segment;\n })();\n\n /**\n * DataLocation enum.\n * @name onnx.TensorProto.DataLocation\n * @enum {number}\n * @property {number} DEFAULT=0 DEFAULT value\n * @property {number} EXTERNAL=1 EXTERNAL value\n */\n TensorProto.DataLocation = (function() {\n var valuesById = {}, values = Object.create(valuesById);\n values[valuesById[0] = \"DEFAULT\"] = 0;\n values[valuesById[1] = \"EXTERNAL\"] = 1;\n return values;\n })();\n\n return TensorProto;\n })();\n\n onnx.SparseTensorProto = (function() {\n\n /**\n * Properties of a SparseTensorProto.\n * @memberof onnx\n * @interface ISparseTensorProto\n * @property {onnx.ITensorProto|null} [values] SparseTensorProto values\n * @property {onnx.ITensorProto|null} [indices] SparseTensorProto indices\n * @property {Array.|null} [dims] SparseTensorProto dims\n */\n\n /**\n * Constructs a new SparseTensorProto.\n * @memberof onnx\n * @classdesc Represents a SparseTensorProto.\n * @implements ISparseTensorProto\n * @constructor\n * @param {onnx.ISparseTensorProto=} [properties] Properties to set\n */\n function SparseTensorProto(properties) {\n this.dims = [];\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * SparseTensorProto values.\n * @member {onnx.ITensorProto|null|undefined} values\n * @memberof onnx.SparseTensorProto\n * @instance\n */\n SparseTensorProto.prototype.values = null;\n\n /**\n * SparseTensorProto indices.\n * @member {onnx.ITensorProto|null|undefined} indices\n * @memberof onnx.SparseTensorProto\n * @instance\n */\n SparseTensorProto.prototype.indices = null;\n\n /**\n * SparseTensorProto dims.\n * @member {Array.} dims\n * @memberof onnx.SparseTensorProto\n * @instance\n */\n SparseTensorProto.prototype.dims = $util.emptyArray;\n\n /**\n * Creates a new SparseTensorProto instance using the specified properties.\n * @function create\n * @memberof onnx.SparseTensorProto\n * @static\n * @param {onnx.ISparseTensorProto=} [properties] Properties to set\n * @returns {onnx.SparseTensorProto} SparseTensorProto instance\n */\n SparseTensorProto.create = function create(properties) {\n return new SparseTensorProto(properties);\n };\n\n /**\n * Encodes the specified SparseTensorProto message. Does not implicitly {@link onnx.SparseTensorProto.verify|verify} messages.\n * @function encode\n * @memberof onnx.SparseTensorProto\n * @static\n * @param {onnx.ISparseTensorProto} message SparseTensorProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n SparseTensorProto.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.values != null && Object.hasOwnProperty.call(message, \"values\"))\n $root.onnx.TensorProto.encode(message.values, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();\n if (message.indices != null && Object.hasOwnProperty.call(message, \"indices\"))\n $root.onnx.TensorProto.encode(message.indices, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();\n if (message.dims != null && message.dims.length) {\n writer.uint32(/* id 3, wireType 2 =*/26).fork();\n for (var i = 0; i < message.dims.length; ++i)\n writer.int64(message.dims[i]);\n writer.ldelim();\n }\n return writer;\n };\n\n /**\n * Encodes the specified SparseTensorProto message, length delimited. Does not implicitly {@link onnx.SparseTensorProto.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.SparseTensorProto\n * @static\n * @param {onnx.ISparseTensorProto} message SparseTensorProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n SparseTensorProto.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes a SparseTensorProto message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.SparseTensorProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.SparseTensorProto} SparseTensorProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n SparseTensorProto.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.SparseTensorProto();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n message.values = $root.onnx.TensorProto.decode(reader, reader.uint32());\n break;\n }\n case 2: {\n message.indices = $root.onnx.TensorProto.decode(reader, reader.uint32());\n break;\n }\n case 3: {\n if (!(message.dims && message.dims.length))\n message.dims = [];\n if ((tag & 7) === 2) {\n var end2 = reader.uint32() + reader.pos;\n while (reader.pos < end2)\n message.dims.push(reader.int64());\n } else\n message.dims.push(reader.int64());\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes a SparseTensorProto message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.SparseTensorProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.SparseTensorProto} SparseTensorProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n SparseTensorProto.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies a SparseTensorProto message.\n * @function verify\n * @memberof onnx.SparseTensorProto\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n SparseTensorProto.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.values != null && message.hasOwnProperty(\"values\")) {\n var error = $root.onnx.TensorProto.verify(message.values);\n if (error)\n return \"values.\" + error;\n }\n if (message.indices != null && message.hasOwnProperty(\"indices\")) {\n var error = $root.onnx.TensorProto.verify(message.indices);\n if (error)\n return \"indices.\" + error;\n }\n if (message.dims != null && message.hasOwnProperty(\"dims\")) {\n if (!Array.isArray(message.dims))\n return \"dims: array expected\";\n for (var i = 0; i < message.dims.length; ++i)\n if (!$util.isInteger(message.dims[i]) && !(message.dims[i] && $util.isInteger(message.dims[i].low) && $util.isInteger(message.dims[i].high)))\n return \"dims: integer|Long[] expected\";\n }\n return null;\n };\n\n /**\n * Creates a SparseTensorProto message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.SparseTensorProto\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.SparseTensorProto} SparseTensorProto\n */\n SparseTensorProto.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.SparseTensorProto)\n return object;\n var message = new $root.onnx.SparseTensorProto();\n if (object.values != null) {\n if (typeof object.values !== \"object\")\n throw TypeError(\".onnx.SparseTensorProto.values: object expected\");\n message.values = $root.onnx.TensorProto.fromObject(object.values);\n }\n if (object.indices != null) {\n if (typeof object.indices !== \"object\")\n throw TypeError(\".onnx.SparseTensorProto.indices: object expected\");\n message.indices = $root.onnx.TensorProto.fromObject(object.indices);\n }\n if (object.dims) {\n if (!Array.isArray(object.dims))\n throw TypeError(\".onnx.SparseTensorProto.dims: array expected\");\n message.dims = [];\n for (var i = 0; i < object.dims.length; ++i)\n if ($util.Long)\n (message.dims[i] = $util.Long.fromValue(object.dims[i])).unsigned = false;\n else if (typeof object.dims[i] === \"string\")\n message.dims[i] = parseInt(object.dims[i], 10);\n else if (typeof object.dims[i] === \"number\")\n message.dims[i] = object.dims[i];\n else if (typeof object.dims[i] === \"object\")\n message.dims[i] = new $util.LongBits(object.dims[i].low >>> 0, object.dims[i].high >>> 0).toNumber();\n }\n return message;\n };\n\n /**\n * Creates a plain object from a SparseTensorProto message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.SparseTensorProto\n * @static\n * @param {onnx.SparseTensorProto} message SparseTensorProto\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n SparseTensorProto.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.arrays || options.defaults)\n object.dims = [];\n if (options.defaults) {\n object.values = null;\n object.indices = null;\n }\n if (message.values != null && message.hasOwnProperty(\"values\"))\n object.values = $root.onnx.TensorProto.toObject(message.values, options);\n if (message.indices != null && message.hasOwnProperty(\"indices\"))\n object.indices = $root.onnx.TensorProto.toObject(message.indices, options);\n if (message.dims && message.dims.length) {\n object.dims = [];\n for (var j = 0; j < message.dims.length; ++j)\n if (typeof message.dims[j] === \"number\")\n object.dims[j] = options.longs === String ? String(message.dims[j]) : message.dims[j];\n else\n object.dims[j] = options.longs === String ? $util.Long.prototype.toString.call(message.dims[j]) : options.longs === Number ? new $util.LongBits(message.dims[j].low >>> 0, message.dims[j].high >>> 0).toNumber() : message.dims[j];\n }\n return object;\n };\n\n /**\n * Converts this SparseTensorProto to JSON.\n * @function toJSON\n * @memberof onnx.SparseTensorProto\n * @instance\n * @returns {Object.} JSON object\n */\n SparseTensorProto.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for SparseTensorProto\n * @function getTypeUrl\n * @memberof onnx.SparseTensorProto\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n SparseTensorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.SparseTensorProto\";\n };\n\n return SparseTensorProto;\n })();\n\n onnx.TensorShapeProto = (function() {\n\n /**\n * Properties of a TensorShapeProto.\n * @memberof onnx\n * @interface ITensorShapeProto\n * @property {Array.|null} [dim] TensorShapeProto dim\n */\n\n /**\n * Constructs a new TensorShapeProto.\n * @memberof onnx\n * @classdesc Represents a TensorShapeProto.\n * @implements ITensorShapeProto\n * @constructor\n * @param {onnx.ITensorShapeProto=} [properties] Properties to set\n */\n function TensorShapeProto(properties) {\n this.dim = [];\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * TensorShapeProto dim.\n * @member {Array.} dim\n * @memberof onnx.TensorShapeProto\n * @instance\n */\n TensorShapeProto.prototype.dim = $util.emptyArray;\n\n /**\n * Creates a new TensorShapeProto instance using the specified properties.\n * @function create\n * @memberof onnx.TensorShapeProto\n * @static\n * @param {onnx.ITensorShapeProto=} [properties] Properties to set\n * @returns {onnx.TensorShapeProto} TensorShapeProto instance\n */\n TensorShapeProto.create = function create(properties) {\n return new TensorShapeProto(properties);\n };\n\n /**\n * Encodes the specified TensorShapeProto message. Does not implicitly {@link onnx.TensorShapeProto.verify|verify} messages.\n * @function encode\n * @memberof onnx.TensorShapeProto\n * @static\n * @param {onnx.ITensorShapeProto} message TensorShapeProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n TensorShapeProto.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.dim != null && message.dim.length)\n for (var i = 0; i < message.dim.length; ++i)\n $root.onnx.TensorShapeProto.Dimension.encode(message.dim[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();\n return writer;\n };\n\n /**\n * Encodes the specified TensorShapeProto message, length delimited. Does not implicitly {@link onnx.TensorShapeProto.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.TensorShapeProto\n * @static\n * @param {onnx.ITensorShapeProto} message TensorShapeProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n TensorShapeProto.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes a TensorShapeProto message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.TensorShapeProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.TensorShapeProto} TensorShapeProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n TensorShapeProto.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TensorShapeProto();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n if (!(message.dim && message.dim.length))\n message.dim = [];\n message.dim.push($root.onnx.TensorShapeProto.Dimension.decode(reader, reader.uint32()));\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes a TensorShapeProto message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.TensorShapeProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.TensorShapeProto} TensorShapeProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n TensorShapeProto.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies a TensorShapeProto message.\n * @function verify\n * @memberof onnx.TensorShapeProto\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n TensorShapeProto.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.dim != null && message.hasOwnProperty(\"dim\")) {\n if (!Array.isArray(message.dim))\n return \"dim: array expected\";\n for (var i = 0; i < message.dim.length; ++i) {\n var error = $root.onnx.TensorShapeProto.Dimension.verify(message.dim[i]);\n if (error)\n return \"dim.\" + error;\n }\n }\n return null;\n };\n\n /**\n * Creates a TensorShapeProto message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.TensorShapeProto\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.TensorShapeProto} TensorShapeProto\n */\n TensorShapeProto.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.TensorShapeProto)\n return object;\n var message = new $root.onnx.TensorShapeProto();\n if (object.dim) {\n if (!Array.isArray(object.dim))\n throw TypeError(\".onnx.TensorShapeProto.dim: array expected\");\n message.dim = [];\n for (var i = 0; i < object.dim.length; ++i) {\n if (typeof object.dim[i] !== \"object\")\n throw TypeError(\".onnx.TensorShapeProto.dim: object expected\");\n message.dim[i] = $root.onnx.TensorShapeProto.Dimension.fromObject(object.dim[i]);\n }\n }\n return message;\n };\n\n /**\n * Creates a plain object from a TensorShapeProto message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.TensorShapeProto\n * @static\n * @param {onnx.TensorShapeProto} message TensorShapeProto\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n TensorShapeProto.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.arrays || options.defaults)\n object.dim = [];\n if (message.dim && message.dim.length) {\n object.dim = [];\n for (var j = 0; j < message.dim.length; ++j)\n object.dim[j] = $root.onnx.TensorShapeProto.Dimension.toObject(message.dim[j], options);\n }\n return object;\n };\n\n /**\n * Converts this TensorShapeProto to JSON.\n * @function toJSON\n * @memberof onnx.TensorShapeProto\n * @instance\n * @returns {Object.} JSON object\n */\n TensorShapeProto.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for TensorShapeProto\n * @function getTypeUrl\n * @memberof onnx.TensorShapeProto\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n TensorShapeProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.TensorShapeProto\";\n };\n\n TensorShapeProto.Dimension = (function() {\n\n /**\n * Properties of a Dimension.\n * @memberof onnx.TensorShapeProto\n * @interface IDimension\n * @property {number|Long|null} [dimValue] Dimension dimValue\n * @property {string|null} [dimParam] Dimension dimParam\n * @property {string|null} [denotation] Dimension denotation\n */\n\n /**\n * Constructs a new Dimension.\n * @memberof onnx.TensorShapeProto\n * @classdesc Represents a Dimension.\n * @implements IDimension\n * @constructor\n * @param {onnx.TensorShapeProto.IDimension=} [properties] Properties to set\n */\n function Dimension(properties) {\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * Dimension dimValue.\n * @member {number|Long|null|undefined} dimValue\n * @memberof onnx.TensorShapeProto.Dimension\n * @instance\n */\n Dimension.prototype.dimValue = null;\n\n /**\n * Dimension dimParam.\n * @member {string|null|undefined} dimParam\n * @memberof onnx.TensorShapeProto.Dimension\n * @instance\n */\n Dimension.prototype.dimParam = null;\n\n /**\n * Dimension denotation.\n * @member {string} denotation\n * @memberof onnx.TensorShapeProto.Dimension\n * @instance\n */\n Dimension.prototype.denotation = \"\";\n\n // OneOf field names bound to virtual getters and setters\n var $oneOfFields;\n\n /**\n * Dimension value.\n * @member {\"dimValue\"|\"dimParam\"|undefined} value\n * @memberof onnx.TensorShapeProto.Dimension\n * @instance\n */\n Object.defineProperty(Dimension.prototype, \"value\", {\n get: $util.oneOfGetter($oneOfFields = [\"dimValue\", \"dimParam\"]),\n set: $util.oneOfSetter($oneOfFields)\n });\n\n /**\n * Creates a new Dimension instance using the specified properties.\n * @function create\n * @memberof onnx.TensorShapeProto.Dimension\n * @static\n * @param {onnx.TensorShapeProto.IDimension=} [properties] Properties to set\n * @returns {onnx.TensorShapeProto.Dimension} Dimension instance\n */\n Dimension.create = function create(properties) {\n return new Dimension(properties);\n };\n\n /**\n * Encodes the specified Dimension message. Does not implicitly {@link onnx.TensorShapeProto.Dimension.verify|verify} messages.\n * @function encode\n * @memberof onnx.TensorShapeProto.Dimension\n * @static\n * @param {onnx.TensorShapeProto.IDimension} message Dimension message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n Dimension.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.dimValue != null && Object.hasOwnProperty.call(message, \"dimValue\"))\n writer.uint32(/* id 1, wireType 0 =*/8).int64(message.dimValue);\n if (message.dimParam != null && Object.hasOwnProperty.call(message, \"dimParam\"))\n writer.uint32(/* id 2, wireType 2 =*/18).string(message.dimParam);\n if (message.denotation != null && Object.hasOwnProperty.call(message, \"denotation\"))\n writer.uint32(/* id 3, wireType 2 =*/26).string(message.denotation);\n return writer;\n };\n\n /**\n * Encodes the specified Dimension message, length delimited. Does not implicitly {@link onnx.TensorShapeProto.Dimension.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.TensorShapeProto.Dimension\n * @static\n * @param {onnx.TensorShapeProto.IDimension} message Dimension message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n Dimension.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes a Dimension message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.TensorShapeProto.Dimension\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.TensorShapeProto.Dimension} Dimension\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n Dimension.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TensorShapeProto.Dimension();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n message.dimValue = reader.int64();\n break;\n }\n case 2: {\n message.dimParam = reader.string();\n break;\n }\n case 3: {\n message.denotation = reader.string();\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes a Dimension message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.TensorShapeProto.Dimension\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.TensorShapeProto.Dimension} Dimension\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n Dimension.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies a Dimension message.\n * @function verify\n * @memberof onnx.TensorShapeProto.Dimension\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n Dimension.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n var properties = {};\n if (message.dimValue != null && message.hasOwnProperty(\"dimValue\")) {\n properties.value = 1;\n if (!$util.isInteger(message.dimValue) && !(message.dimValue && $util.isInteger(message.dimValue.low) && $util.isInteger(message.dimValue.high)))\n return \"dimValue: integer|Long expected\";\n }\n if (message.dimParam != null && message.hasOwnProperty(\"dimParam\")) {\n if (properties.value === 1)\n return \"value: multiple values\";\n properties.value = 1;\n if (!$util.isString(message.dimParam))\n return \"dimParam: string expected\";\n }\n if (message.denotation != null && message.hasOwnProperty(\"denotation\"))\n if (!$util.isString(message.denotation))\n return \"denotation: string expected\";\n return null;\n };\n\n /**\n * Creates a Dimension message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.TensorShapeProto.Dimension\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.TensorShapeProto.Dimension} Dimension\n */\n Dimension.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.TensorShapeProto.Dimension)\n return object;\n var message = new $root.onnx.TensorShapeProto.Dimension();\n if (object.dimValue != null)\n if ($util.Long)\n (message.dimValue = $util.Long.fromValue(object.dimValue)).unsigned = false;\n else if (typeof object.dimValue === \"string\")\n message.dimValue = parseInt(object.dimValue, 10);\n else if (typeof object.dimValue === \"number\")\n message.dimValue = object.dimValue;\n else if (typeof object.dimValue === \"object\")\n message.dimValue = new $util.LongBits(object.dimValue.low >>> 0, object.dimValue.high >>> 0).toNumber();\n if (object.dimParam != null)\n message.dimParam = String(object.dimParam);\n if (object.denotation != null)\n message.denotation = String(object.denotation);\n return message;\n };\n\n /**\n * Creates a plain object from a Dimension message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.TensorShapeProto.Dimension\n * @static\n * @param {onnx.TensorShapeProto.Dimension} message Dimension\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n Dimension.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.defaults)\n object.denotation = \"\";\n if (message.dimValue != null && message.hasOwnProperty(\"dimValue\")) {\n if (typeof message.dimValue === \"number\")\n object.dimValue = options.longs === String ? String(message.dimValue) : message.dimValue;\n else\n object.dimValue = options.longs === String ? $util.Long.prototype.toString.call(message.dimValue) : options.longs === Number ? new $util.LongBits(message.dimValue.low >>> 0, message.dimValue.high >>> 0).toNumber() : message.dimValue;\n if (options.oneofs)\n object.value = \"dimValue\";\n }\n if (message.dimParam != null && message.hasOwnProperty(\"dimParam\")) {\n object.dimParam = message.dimParam;\n if (options.oneofs)\n object.value = \"dimParam\";\n }\n if (message.denotation != null && message.hasOwnProperty(\"denotation\"))\n object.denotation = message.denotation;\n return object;\n };\n\n /**\n * Converts this Dimension to JSON.\n * @function toJSON\n * @memberof onnx.TensorShapeProto.Dimension\n * @instance\n * @returns {Object.} JSON object\n */\n Dimension.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for Dimension\n * @function getTypeUrl\n * @memberof onnx.TensorShapeProto.Dimension\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n Dimension.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.TensorShapeProto.Dimension\";\n };\n\n return Dimension;\n })();\n\n return TensorShapeProto;\n })();\n\n onnx.TypeProto = (function() {\n\n /**\n * Properties of a TypeProto.\n * @memberof onnx\n * @interface ITypeProto\n * @property {onnx.TypeProto.ITensor|null} [tensorType] TypeProto tensorType\n * @property {onnx.TypeProto.ISequence|null} [sequenceType] TypeProto sequenceType\n * @property {onnx.TypeProto.IMap|null} [mapType] TypeProto mapType\n * @property {onnx.TypeProto.IOptional|null} [optionalType] TypeProto optionalType\n * @property {onnx.TypeProto.ISparseTensor|null} [sparseTensorType] TypeProto sparseTensorType\n * @property {string|null} [denotation] TypeProto denotation\n */\n\n /**\n * Constructs a new TypeProto.\n * @memberof onnx\n * @classdesc Represents a TypeProto.\n * @implements ITypeProto\n * @constructor\n * @param {onnx.ITypeProto=} [properties] Properties to set\n */\n function TypeProto(properties) {\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * TypeProto tensorType.\n * @member {onnx.TypeProto.ITensor|null|undefined} tensorType\n * @memberof onnx.TypeProto\n * @instance\n */\n TypeProto.prototype.tensorType = null;\n\n /**\n * TypeProto sequenceType.\n * @member {onnx.TypeProto.ISequence|null|undefined} sequenceType\n * @memberof onnx.TypeProto\n * @instance\n */\n TypeProto.prototype.sequenceType = null;\n\n /**\n * TypeProto mapType.\n * @member {onnx.TypeProto.IMap|null|undefined} mapType\n * @memberof onnx.TypeProto\n * @instance\n */\n TypeProto.prototype.mapType = null;\n\n /**\n * TypeProto optionalType.\n * @member {onnx.TypeProto.IOptional|null|undefined} optionalType\n * @memberof onnx.TypeProto\n * @instance\n */\n TypeProto.prototype.optionalType = null;\n\n /**\n * TypeProto sparseTensorType.\n * @member {onnx.TypeProto.ISparseTensor|null|undefined} sparseTensorType\n * @memberof onnx.TypeProto\n * @instance\n */\n TypeProto.prototype.sparseTensorType = null;\n\n /**\n * TypeProto denotation.\n * @member {string} denotation\n * @memberof onnx.TypeProto\n * @instance\n */\n TypeProto.prototype.denotation = \"\";\n\n // OneOf field names bound to virtual getters and setters\n var $oneOfFields;\n\n /**\n * TypeProto value.\n * @member {\"tensorType\"|\"sequenceType\"|\"mapType\"|\"optionalType\"|\"sparseTensorType\"|undefined} value\n * @memberof onnx.TypeProto\n * @instance\n */\n Object.defineProperty(TypeProto.prototype, \"value\", {\n get: $util.oneOfGetter($oneOfFields = [\"tensorType\", \"sequenceType\", \"mapType\", \"optionalType\", \"sparseTensorType\"]),\n set: $util.oneOfSetter($oneOfFields)\n });\n\n /**\n * Creates a new TypeProto instance using the specified properties.\n * @function create\n * @memberof onnx.TypeProto\n * @static\n * @param {onnx.ITypeProto=} [properties] Properties to set\n * @returns {onnx.TypeProto} TypeProto instance\n */\n TypeProto.create = function create(properties) {\n return new TypeProto(properties);\n };\n\n /**\n * Encodes the specified TypeProto message. Does not implicitly {@link onnx.TypeProto.verify|verify} messages.\n * @function encode\n * @memberof onnx.TypeProto\n * @static\n * @param {onnx.ITypeProto} message TypeProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n TypeProto.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.tensorType != null && Object.hasOwnProperty.call(message, \"tensorType\"))\n $root.onnx.TypeProto.Tensor.encode(message.tensorType, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();\n if (message.sequenceType != null && Object.hasOwnProperty.call(message, \"sequenceType\"))\n $root.onnx.TypeProto.Sequence.encode(message.sequenceType, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();\n if (message.mapType != null && Object.hasOwnProperty.call(message, \"mapType\"))\n $root.onnx.TypeProto.Map.encode(message.mapType, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();\n if (message.denotation != null && Object.hasOwnProperty.call(message, \"denotation\"))\n writer.uint32(/* id 6, wireType 2 =*/50).string(message.denotation);\n if (message.sparseTensorType != null && Object.hasOwnProperty.call(message, \"sparseTensorType\"))\n $root.onnx.TypeProto.SparseTensor.encode(message.sparseTensorType, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim();\n if (message.optionalType != null && Object.hasOwnProperty.call(message, \"optionalType\"))\n $root.onnx.TypeProto.Optional.encode(message.optionalType, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim();\n return writer;\n };\n\n /**\n * Encodes the specified TypeProto message, length delimited. Does not implicitly {@link onnx.TypeProto.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.TypeProto\n * @static\n * @param {onnx.ITypeProto} message TypeProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n TypeProto.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes a TypeProto message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.TypeProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.TypeProto} TypeProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n TypeProto.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TypeProto();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n message.tensorType = $root.onnx.TypeProto.Tensor.decode(reader, reader.uint32());\n break;\n }\n case 4: {\n message.sequenceType = $root.onnx.TypeProto.Sequence.decode(reader, reader.uint32());\n break;\n }\n case 5: {\n message.mapType = $root.onnx.TypeProto.Map.decode(reader, reader.uint32());\n break;\n }\n case 9: {\n message.optionalType = $root.onnx.TypeProto.Optional.decode(reader, reader.uint32());\n break;\n }\n case 8: {\n message.sparseTensorType = $root.onnx.TypeProto.SparseTensor.decode(reader, reader.uint32());\n break;\n }\n case 6: {\n message.denotation = reader.string();\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes a TypeProto message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.TypeProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.TypeProto} TypeProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n TypeProto.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies a TypeProto message.\n * @function verify\n * @memberof onnx.TypeProto\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n TypeProto.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n var properties = {};\n if (message.tensorType != null && message.hasOwnProperty(\"tensorType\")) {\n properties.value = 1;\n {\n var error = $root.onnx.TypeProto.Tensor.verify(message.tensorType);\n if (error)\n return \"tensorType.\" + error;\n }\n }\n if (message.sequenceType != null && message.hasOwnProperty(\"sequenceType\")) {\n if (properties.value === 1)\n return \"value: multiple values\";\n properties.value = 1;\n {\n var error = $root.onnx.TypeProto.Sequence.verify(message.sequenceType);\n if (error)\n return \"sequenceType.\" + error;\n }\n }\n if (message.mapType != null && message.hasOwnProperty(\"mapType\")) {\n if (properties.value === 1)\n return \"value: multiple values\";\n properties.value = 1;\n {\n var error = $root.onnx.TypeProto.Map.verify(message.mapType);\n if (error)\n return \"mapType.\" + error;\n }\n }\n if (message.optionalType != null && message.hasOwnProperty(\"optionalType\")) {\n if (properties.value === 1)\n return \"value: multiple values\";\n properties.value = 1;\n {\n var error = $root.onnx.TypeProto.Optional.verify(message.optionalType);\n if (error)\n return \"optionalType.\" + error;\n }\n }\n if (message.sparseTensorType != null && message.hasOwnProperty(\"sparseTensorType\")) {\n if (properties.value === 1)\n return \"value: multiple values\";\n properties.value = 1;\n {\n var error = $root.onnx.TypeProto.SparseTensor.verify(message.sparseTensorType);\n if (error)\n return \"sparseTensorType.\" + error;\n }\n }\n if (message.denotation != null && message.hasOwnProperty(\"denotation\"))\n if (!$util.isString(message.denotation))\n return \"denotation: string expected\";\n return null;\n };\n\n /**\n * Creates a TypeProto message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.TypeProto\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.TypeProto} TypeProto\n */\n TypeProto.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.TypeProto)\n return object;\n var message = new $root.onnx.TypeProto();\n if (object.tensorType != null) {\n if (typeof object.tensorType !== \"object\")\n throw TypeError(\".onnx.TypeProto.tensorType: object expected\");\n message.tensorType = $root.onnx.TypeProto.Tensor.fromObject(object.tensorType);\n }\n if (object.sequenceType != null) {\n if (typeof object.sequenceType !== \"object\")\n throw TypeError(\".onnx.TypeProto.sequenceType: object expected\");\n message.sequenceType = $root.onnx.TypeProto.Sequence.fromObject(object.sequenceType);\n }\n if (object.mapType != null) {\n if (typeof object.mapType !== \"object\")\n throw TypeError(\".onnx.TypeProto.mapType: object expected\");\n message.mapType = $root.onnx.TypeProto.Map.fromObject(object.mapType);\n }\n if (object.optionalType != null) {\n if (typeof object.optionalType !== \"object\")\n throw TypeError(\".onnx.TypeProto.optionalType: object expected\");\n message.optionalType = $root.onnx.TypeProto.Optional.fromObject(object.optionalType);\n }\n if (object.sparseTensorType != null) {\n if (typeof object.sparseTensorType !== \"object\")\n throw TypeError(\".onnx.TypeProto.sparseTensorType: object expected\");\n message.sparseTensorType = $root.onnx.TypeProto.SparseTensor.fromObject(object.sparseTensorType);\n }\n if (object.denotation != null)\n message.denotation = String(object.denotation);\n return message;\n };\n\n /**\n * Creates a plain object from a TypeProto message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.TypeProto\n * @static\n * @param {onnx.TypeProto} message TypeProto\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n TypeProto.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.defaults)\n object.denotation = \"\";\n if (message.tensorType != null && message.hasOwnProperty(\"tensorType\")) {\n object.tensorType = $root.onnx.TypeProto.Tensor.toObject(message.tensorType, options);\n if (options.oneofs)\n object.value = \"tensorType\";\n }\n if (message.sequenceType != null && message.hasOwnProperty(\"sequenceType\")) {\n object.sequenceType = $root.onnx.TypeProto.Sequence.toObject(message.sequenceType, options);\n if (options.oneofs)\n object.value = \"sequenceType\";\n }\n if (message.mapType != null && message.hasOwnProperty(\"mapType\")) {\n object.mapType = $root.onnx.TypeProto.Map.toObject(message.mapType, options);\n if (options.oneofs)\n object.value = \"mapType\";\n }\n if (message.denotation != null && message.hasOwnProperty(\"denotation\"))\n object.denotation = message.denotation;\n if (message.sparseTensorType != null && message.hasOwnProperty(\"sparseTensorType\")) {\n object.sparseTensorType = $root.onnx.TypeProto.SparseTensor.toObject(message.sparseTensorType, options);\n if (options.oneofs)\n object.value = \"sparseTensorType\";\n }\n if (message.optionalType != null && message.hasOwnProperty(\"optionalType\")) {\n object.optionalType = $root.onnx.TypeProto.Optional.toObject(message.optionalType, options);\n if (options.oneofs)\n object.value = \"optionalType\";\n }\n return object;\n };\n\n /**\n * Converts this TypeProto to JSON.\n * @function toJSON\n * @memberof onnx.TypeProto\n * @instance\n * @returns {Object.} JSON object\n */\n TypeProto.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for TypeProto\n * @function getTypeUrl\n * @memberof onnx.TypeProto\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n TypeProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.TypeProto\";\n };\n\n TypeProto.Tensor = (function() {\n\n /**\n * Properties of a Tensor.\n * @memberof onnx.TypeProto\n * @interface ITensor\n * @property {number|null} [elemType] Tensor elemType\n * @property {onnx.ITensorShapeProto|null} [shape] Tensor shape\n */\n\n /**\n * Constructs a new Tensor.\n * @memberof onnx.TypeProto\n * @classdesc Represents a Tensor.\n * @implements ITensor\n * @constructor\n * @param {onnx.TypeProto.ITensor=} [properties] Properties to set\n */\n function Tensor(properties) {\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * Tensor elemType.\n * @member {number} elemType\n * @memberof onnx.TypeProto.Tensor\n * @instance\n */\n Tensor.prototype.elemType = 0;\n\n /**\n * Tensor shape.\n * @member {onnx.ITensorShapeProto|null|undefined} shape\n * @memberof onnx.TypeProto.Tensor\n * @instance\n */\n Tensor.prototype.shape = null;\n\n /**\n * Creates a new Tensor instance using the specified properties.\n * @function create\n * @memberof onnx.TypeProto.Tensor\n * @static\n * @param {onnx.TypeProto.ITensor=} [properties] Properties to set\n * @returns {onnx.TypeProto.Tensor} Tensor instance\n */\n Tensor.create = function create(properties) {\n return new Tensor(properties);\n };\n\n /**\n * Encodes the specified Tensor message. Does not implicitly {@link onnx.TypeProto.Tensor.verify|verify} messages.\n * @function encode\n * @memberof onnx.TypeProto.Tensor\n * @static\n * @param {onnx.TypeProto.ITensor} message Tensor message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n Tensor.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.elemType != null && Object.hasOwnProperty.call(message, \"elemType\"))\n writer.uint32(/* id 1, wireType 0 =*/8).int32(message.elemType);\n if (message.shape != null && Object.hasOwnProperty.call(message, \"shape\"))\n $root.onnx.TensorShapeProto.encode(message.shape, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();\n return writer;\n };\n\n /**\n * Encodes the specified Tensor message, length delimited. Does not implicitly {@link onnx.TypeProto.Tensor.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.TypeProto.Tensor\n * @static\n * @param {onnx.TypeProto.ITensor} message Tensor message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n Tensor.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes a Tensor message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.TypeProto.Tensor\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.TypeProto.Tensor} Tensor\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n Tensor.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TypeProto.Tensor();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n message.elemType = reader.int32();\n break;\n }\n case 2: {\n message.shape = $root.onnx.TensorShapeProto.decode(reader, reader.uint32());\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes a Tensor message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.TypeProto.Tensor\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.TypeProto.Tensor} Tensor\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n Tensor.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies a Tensor message.\n * @function verify\n * @memberof onnx.TypeProto.Tensor\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n Tensor.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.elemType != null && message.hasOwnProperty(\"elemType\"))\n if (!$util.isInteger(message.elemType))\n return \"elemType: integer expected\";\n if (message.shape != null && message.hasOwnProperty(\"shape\")) {\n var error = $root.onnx.TensorShapeProto.verify(message.shape);\n if (error)\n return \"shape.\" + error;\n }\n return null;\n };\n\n /**\n * Creates a Tensor message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.TypeProto.Tensor\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.TypeProto.Tensor} Tensor\n */\n Tensor.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.TypeProto.Tensor)\n return object;\n var message = new $root.onnx.TypeProto.Tensor();\n if (object.elemType != null)\n message.elemType = object.elemType | 0;\n if (object.shape != null) {\n if (typeof object.shape !== \"object\")\n throw TypeError(\".onnx.TypeProto.Tensor.shape: object expected\");\n message.shape = $root.onnx.TensorShapeProto.fromObject(object.shape);\n }\n return message;\n };\n\n /**\n * Creates a plain object from a Tensor message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.TypeProto.Tensor\n * @static\n * @param {onnx.TypeProto.Tensor} message Tensor\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n Tensor.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.defaults) {\n object.elemType = 0;\n object.shape = null;\n }\n if (message.elemType != null && message.hasOwnProperty(\"elemType\"))\n object.elemType = message.elemType;\n if (message.shape != null && message.hasOwnProperty(\"shape\"))\n object.shape = $root.onnx.TensorShapeProto.toObject(message.shape, options);\n return object;\n };\n\n /**\n * Converts this Tensor to JSON.\n * @function toJSON\n * @memberof onnx.TypeProto.Tensor\n * @instance\n * @returns {Object.} JSON object\n */\n Tensor.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for Tensor\n * @function getTypeUrl\n * @memberof onnx.TypeProto.Tensor\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n Tensor.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.TypeProto.Tensor\";\n };\n\n return Tensor;\n })();\n\n TypeProto.Sequence = (function() {\n\n /**\n * Properties of a Sequence.\n * @memberof onnx.TypeProto\n * @interface ISequence\n * @property {onnx.ITypeProto|null} [elemType] Sequence elemType\n */\n\n /**\n * Constructs a new Sequence.\n * @memberof onnx.TypeProto\n * @classdesc Represents a Sequence.\n * @implements ISequence\n * @constructor\n * @param {onnx.TypeProto.ISequence=} [properties] Properties to set\n */\n function Sequence(properties) {\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * Sequence elemType.\n * @member {onnx.ITypeProto|null|undefined} elemType\n * @memberof onnx.TypeProto.Sequence\n * @instance\n */\n Sequence.prototype.elemType = null;\n\n /**\n * Creates a new Sequence instance using the specified properties.\n * @function create\n * @memberof onnx.TypeProto.Sequence\n * @static\n * @param {onnx.TypeProto.ISequence=} [properties] Properties to set\n * @returns {onnx.TypeProto.Sequence} Sequence instance\n */\n Sequence.create = function create(properties) {\n return new Sequence(properties);\n };\n\n /**\n * Encodes the specified Sequence message. Does not implicitly {@link onnx.TypeProto.Sequence.verify|verify} messages.\n * @function encode\n * @memberof onnx.TypeProto.Sequence\n * @static\n * @param {onnx.TypeProto.ISequence} message Sequence message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n Sequence.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.elemType != null && Object.hasOwnProperty.call(message, \"elemType\"))\n $root.onnx.TypeProto.encode(message.elemType, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();\n return writer;\n };\n\n /**\n * Encodes the specified Sequence message, length delimited. Does not implicitly {@link onnx.TypeProto.Sequence.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.TypeProto.Sequence\n * @static\n * @param {onnx.TypeProto.ISequence} message Sequence message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n Sequence.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes a Sequence message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.TypeProto.Sequence\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.TypeProto.Sequence} Sequence\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n Sequence.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TypeProto.Sequence();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n message.elemType = $root.onnx.TypeProto.decode(reader, reader.uint32());\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes a Sequence message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.TypeProto.Sequence\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.TypeProto.Sequence} Sequence\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n Sequence.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies a Sequence message.\n * @function verify\n * @memberof onnx.TypeProto.Sequence\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n Sequence.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.elemType != null && message.hasOwnProperty(\"elemType\")) {\n var error = $root.onnx.TypeProto.verify(message.elemType);\n if (error)\n return \"elemType.\" + error;\n }\n return null;\n };\n\n /**\n * Creates a Sequence message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.TypeProto.Sequence\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.TypeProto.Sequence} Sequence\n */\n Sequence.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.TypeProto.Sequence)\n return object;\n var message = new $root.onnx.TypeProto.Sequence();\n if (object.elemType != null) {\n if (typeof object.elemType !== \"object\")\n throw TypeError(\".onnx.TypeProto.Sequence.elemType: object expected\");\n message.elemType = $root.onnx.TypeProto.fromObject(object.elemType);\n }\n return message;\n };\n\n /**\n * Creates a plain object from a Sequence message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.TypeProto.Sequence\n * @static\n * @param {onnx.TypeProto.Sequence} message Sequence\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n Sequence.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.defaults)\n object.elemType = null;\n if (message.elemType != null && message.hasOwnProperty(\"elemType\"))\n object.elemType = $root.onnx.TypeProto.toObject(message.elemType, options);\n return object;\n };\n\n /**\n * Converts this Sequence to JSON.\n * @function toJSON\n * @memberof onnx.TypeProto.Sequence\n * @instance\n * @returns {Object.} JSON object\n */\n Sequence.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for Sequence\n * @function getTypeUrl\n * @memberof onnx.TypeProto.Sequence\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n Sequence.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.TypeProto.Sequence\";\n };\n\n return Sequence;\n })();\n\n TypeProto.Map = (function() {\n\n /**\n * Properties of a Map.\n * @memberof onnx.TypeProto\n * @interface IMap\n * @property {number|null} [keyType] Map keyType\n * @property {onnx.ITypeProto|null} [valueType] Map valueType\n */\n\n /**\n * Constructs a new Map.\n * @memberof onnx.TypeProto\n * @classdesc Represents a Map.\n * @implements IMap\n * @constructor\n * @param {onnx.TypeProto.IMap=} [properties] Properties to set\n */\n function Map(properties) {\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * Map keyType.\n * @member {number} keyType\n * @memberof onnx.TypeProto.Map\n * @instance\n */\n Map.prototype.keyType = 0;\n\n /**\n * Map valueType.\n * @member {onnx.ITypeProto|null|undefined} valueType\n * @memberof onnx.TypeProto.Map\n * @instance\n */\n Map.prototype.valueType = null;\n\n /**\n * Creates a new Map instance using the specified properties.\n * @function create\n * @memberof onnx.TypeProto.Map\n * @static\n * @param {onnx.TypeProto.IMap=} [properties] Properties to set\n * @returns {onnx.TypeProto.Map} Map instance\n */\n Map.create = function create(properties) {\n return new Map(properties);\n };\n\n /**\n * Encodes the specified Map message. Does not implicitly {@link onnx.TypeProto.Map.verify|verify} messages.\n * @function encode\n * @memberof onnx.TypeProto.Map\n * @static\n * @param {onnx.TypeProto.IMap} message Map message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n Map.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.keyType != null && Object.hasOwnProperty.call(message, \"keyType\"))\n writer.uint32(/* id 1, wireType 0 =*/8).int32(message.keyType);\n if (message.valueType != null && Object.hasOwnProperty.call(message, \"valueType\"))\n $root.onnx.TypeProto.encode(message.valueType, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();\n return writer;\n };\n\n /**\n * Encodes the specified Map message, length delimited. Does not implicitly {@link onnx.TypeProto.Map.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.TypeProto.Map\n * @static\n * @param {onnx.TypeProto.IMap} message Map message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n Map.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes a Map message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.TypeProto.Map\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.TypeProto.Map} Map\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n Map.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TypeProto.Map();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n message.keyType = reader.int32();\n break;\n }\n case 2: {\n message.valueType = $root.onnx.TypeProto.decode(reader, reader.uint32());\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes a Map message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.TypeProto.Map\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.TypeProto.Map} Map\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n Map.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies a Map message.\n * @function verify\n * @memberof onnx.TypeProto.Map\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n Map.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.keyType != null && message.hasOwnProperty(\"keyType\"))\n if (!$util.isInteger(message.keyType))\n return \"keyType: integer expected\";\n if (message.valueType != null && message.hasOwnProperty(\"valueType\")) {\n var error = $root.onnx.TypeProto.verify(message.valueType);\n if (error)\n return \"valueType.\" + error;\n }\n return null;\n };\n\n /**\n * Creates a Map message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.TypeProto.Map\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.TypeProto.Map} Map\n */\n Map.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.TypeProto.Map)\n return object;\n var message = new $root.onnx.TypeProto.Map();\n if (object.keyType != null)\n message.keyType = object.keyType | 0;\n if (object.valueType != null) {\n if (typeof object.valueType !== \"object\")\n throw TypeError(\".onnx.TypeProto.Map.valueType: object expected\");\n message.valueType = $root.onnx.TypeProto.fromObject(object.valueType);\n }\n return message;\n };\n\n /**\n * Creates a plain object from a Map message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.TypeProto.Map\n * @static\n * @param {onnx.TypeProto.Map} message Map\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n Map.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.defaults) {\n object.keyType = 0;\n object.valueType = null;\n }\n if (message.keyType != null && message.hasOwnProperty(\"keyType\"))\n object.keyType = message.keyType;\n if (message.valueType != null && message.hasOwnProperty(\"valueType\"))\n object.valueType = $root.onnx.TypeProto.toObject(message.valueType, options);\n return object;\n };\n\n /**\n * Converts this Map to JSON.\n * @function toJSON\n * @memberof onnx.TypeProto.Map\n * @instance\n * @returns {Object.} JSON object\n */\n Map.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for Map\n * @function getTypeUrl\n * @memberof onnx.TypeProto.Map\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n Map.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.TypeProto.Map\";\n };\n\n return Map;\n })();\n\n TypeProto.Optional = (function() {\n\n /**\n * Properties of an Optional.\n * @memberof onnx.TypeProto\n * @interface IOptional\n * @property {onnx.ITypeProto|null} [elemType] Optional elemType\n */\n\n /**\n * Constructs a new Optional.\n * @memberof onnx.TypeProto\n * @classdesc Represents an Optional.\n * @implements IOptional\n * @constructor\n * @param {onnx.TypeProto.IOptional=} [properties] Properties to set\n */\n function Optional(properties) {\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * Optional elemType.\n * @member {onnx.ITypeProto|null|undefined} elemType\n * @memberof onnx.TypeProto.Optional\n * @instance\n */\n Optional.prototype.elemType = null;\n\n /**\n * Creates a new Optional instance using the specified properties.\n * @function create\n * @memberof onnx.TypeProto.Optional\n * @static\n * @param {onnx.TypeProto.IOptional=} [properties] Properties to set\n * @returns {onnx.TypeProto.Optional} Optional instance\n */\n Optional.create = function create(properties) {\n return new Optional(properties);\n };\n\n /**\n * Encodes the specified Optional message. Does not implicitly {@link onnx.TypeProto.Optional.verify|verify} messages.\n * @function encode\n * @memberof onnx.TypeProto.Optional\n * @static\n * @param {onnx.TypeProto.IOptional} message Optional message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n Optional.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.elemType != null && Object.hasOwnProperty.call(message, \"elemType\"))\n $root.onnx.TypeProto.encode(message.elemType, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();\n return writer;\n };\n\n /**\n * Encodes the specified Optional message, length delimited. Does not implicitly {@link onnx.TypeProto.Optional.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.TypeProto.Optional\n * @static\n * @param {onnx.TypeProto.IOptional} message Optional message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n Optional.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes an Optional message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.TypeProto.Optional\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.TypeProto.Optional} Optional\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n Optional.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TypeProto.Optional();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n message.elemType = $root.onnx.TypeProto.decode(reader, reader.uint32());\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes an Optional message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.TypeProto.Optional\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.TypeProto.Optional} Optional\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n Optional.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies an Optional message.\n * @function verify\n * @memberof onnx.TypeProto.Optional\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n Optional.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.elemType != null && message.hasOwnProperty(\"elemType\")) {\n var error = $root.onnx.TypeProto.verify(message.elemType);\n if (error)\n return \"elemType.\" + error;\n }\n return null;\n };\n\n /**\n * Creates an Optional message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.TypeProto.Optional\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.TypeProto.Optional} Optional\n */\n Optional.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.TypeProto.Optional)\n return object;\n var message = new $root.onnx.TypeProto.Optional();\n if (object.elemType != null) {\n if (typeof object.elemType !== \"object\")\n throw TypeError(\".onnx.TypeProto.Optional.elemType: object expected\");\n message.elemType = $root.onnx.TypeProto.fromObject(object.elemType);\n }\n return message;\n };\n\n /**\n * Creates a plain object from an Optional message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.TypeProto.Optional\n * @static\n * @param {onnx.TypeProto.Optional} message Optional\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n Optional.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.defaults)\n object.elemType = null;\n if (message.elemType != null && message.hasOwnProperty(\"elemType\"))\n object.elemType = $root.onnx.TypeProto.toObject(message.elemType, options);\n return object;\n };\n\n /**\n * Converts this Optional to JSON.\n * @function toJSON\n * @memberof onnx.TypeProto.Optional\n * @instance\n * @returns {Object.} JSON object\n */\n Optional.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for Optional\n * @function getTypeUrl\n * @memberof onnx.TypeProto.Optional\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n Optional.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.TypeProto.Optional\";\n };\n\n return Optional;\n })();\n\n TypeProto.SparseTensor = (function() {\n\n /**\n * Properties of a SparseTensor.\n * @memberof onnx.TypeProto\n * @interface ISparseTensor\n * @property {number|null} [elemType] SparseTensor elemType\n * @property {onnx.ITensorShapeProto|null} [shape] SparseTensor shape\n */\n\n /**\n * Constructs a new SparseTensor.\n * @memberof onnx.TypeProto\n * @classdesc Represents a SparseTensor.\n * @implements ISparseTensor\n * @constructor\n * @param {onnx.TypeProto.ISparseTensor=} [properties] Properties to set\n */\n function SparseTensor(properties) {\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * SparseTensor elemType.\n * @member {number} elemType\n * @memberof onnx.TypeProto.SparseTensor\n * @instance\n */\n SparseTensor.prototype.elemType = 0;\n\n /**\n * SparseTensor shape.\n * @member {onnx.ITensorShapeProto|null|undefined} shape\n * @memberof onnx.TypeProto.SparseTensor\n * @instance\n */\n SparseTensor.prototype.shape = null;\n\n /**\n * Creates a new SparseTensor instance using the specified properties.\n * @function create\n * @memberof onnx.TypeProto.SparseTensor\n * @static\n * @param {onnx.TypeProto.ISparseTensor=} [properties] Properties to set\n * @returns {onnx.TypeProto.SparseTensor} SparseTensor instance\n */\n SparseTensor.create = function create(properties) {\n return new SparseTensor(properties);\n };\n\n /**\n * Encodes the specified SparseTensor message. Does not implicitly {@link onnx.TypeProto.SparseTensor.verify|verify} messages.\n * @function encode\n * @memberof onnx.TypeProto.SparseTensor\n * @static\n * @param {onnx.TypeProto.ISparseTensor} message SparseTensor message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n SparseTensor.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.elemType != null && Object.hasOwnProperty.call(message, \"elemType\"))\n writer.uint32(/* id 1, wireType 0 =*/8).int32(message.elemType);\n if (message.shape != null && Object.hasOwnProperty.call(message, \"shape\"))\n $root.onnx.TensorShapeProto.encode(message.shape, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();\n return writer;\n };\n\n /**\n * Encodes the specified SparseTensor message, length delimited. Does not implicitly {@link onnx.TypeProto.SparseTensor.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.TypeProto.SparseTensor\n * @static\n * @param {onnx.TypeProto.ISparseTensor} message SparseTensor message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n SparseTensor.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes a SparseTensor message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.TypeProto.SparseTensor\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.TypeProto.SparseTensor} SparseTensor\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n SparseTensor.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TypeProto.SparseTensor();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n message.elemType = reader.int32();\n break;\n }\n case 2: {\n message.shape = $root.onnx.TensorShapeProto.decode(reader, reader.uint32());\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes a SparseTensor message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.TypeProto.SparseTensor\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.TypeProto.SparseTensor} SparseTensor\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n SparseTensor.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies a SparseTensor message.\n * @function verify\n * @memberof onnx.TypeProto.SparseTensor\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n SparseTensor.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.elemType != null && message.hasOwnProperty(\"elemType\"))\n if (!$util.isInteger(message.elemType))\n return \"elemType: integer expected\";\n if (message.shape != null && message.hasOwnProperty(\"shape\")) {\n var error = $root.onnx.TensorShapeProto.verify(message.shape);\n if (error)\n return \"shape.\" + error;\n }\n return null;\n };\n\n /**\n * Creates a SparseTensor message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.TypeProto.SparseTensor\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.TypeProto.SparseTensor} SparseTensor\n */\n SparseTensor.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.TypeProto.SparseTensor)\n return object;\n var message = new $root.onnx.TypeProto.SparseTensor();\n if (object.elemType != null)\n message.elemType = object.elemType | 0;\n if (object.shape != null) {\n if (typeof object.shape !== \"object\")\n throw TypeError(\".onnx.TypeProto.SparseTensor.shape: object expected\");\n message.shape = $root.onnx.TensorShapeProto.fromObject(object.shape);\n }\n return message;\n };\n\n /**\n * Creates a plain object from a SparseTensor message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.TypeProto.SparseTensor\n * @static\n * @param {onnx.TypeProto.SparseTensor} message SparseTensor\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n SparseTensor.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.defaults) {\n object.elemType = 0;\n object.shape = null;\n }\n if (message.elemType != null && message.hasOwnProperty(\"elemType\"))\n object.elemType = message.elemType;\n if (message.shape != null && message.hasOwnProperty(\"shape\"))\n object.shape = $root.onnx.TensorShapeProto.toObject(message.shape, options);\n return object;\n };\n\n /**\n * Converts this SparseTensor to JSON.\n * @function toJSON\n * @memberof onnx.TypeProto.SparseTensor\n * @instance\n * @returns {Object.} JSON object\n */\n SparseTensor.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for SparseTensor\n * @function getTypeUrl\n * @memberof onnx.TypeProto.SparseTensor\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n SparseTensor.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.TypeProto.SparseTensor\";\n };\n\n return SparseTensor;\n })();\n\n return TypeProto;\n })();\n\n onnx.OperatorSetIdProto = (function() {\n\n /**\n * Properties of an OperatorSetIdProto.\n * @memberof onnx\n * @interface IOperatorSetIdProto\n * @property {string|null} [domain] OperatorSetIdProto domain\n * @property {number|Long|null} [version] OperatorSetIdProto version\n */\n\n /**\n * Constructs a new OperatorSetIdProto.\n * @memberof onnx\n * @classdesc Represents an OperatorSetIdProto.\n * @implements IOperatorSetIdProto\n * @constructor\n * @param {onnx.IOperatorSetIdProto=} [properties] Properties to set\n */\n function OperatorSetIdProto(properties) {\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * OperatorSetIdProto domain.\n * @member {string} domain\n * @memberof onnx.OperatorSetIdProto\n * @instance\n */\n OperatorSetIdProto.prototype.domain = \"\";\n\n /**\n * OperatorSetIdProto version.\n * @member {number|Long} version\n * @memberof onnx.OperatorSetIdProto\n * @instance\n */\n OperatorSetIdProto.prototype.version = $util.Long ? $util.Long.fromBits(0,0,false) : 0;\n\n /**\n * Creates a new OperatorSetIdProto instance using the specified properties.\n * @function create\n * @memberof onnx.OperatorSetIdProto\n * @static\n * @param {onnx.IOperatorSetIdProto=} [properties] Properties to set\n * @returns {onnx.OperatorSetIdProto} OperatorSetIdProto instance\n */\n OperatorSetIdProto.create = function create(properties) {\n return new OperatorSetIdProto(properties);\n };\n\n /**\n * Encodes the specified OperatorSetIdProto message. Does not implicitly {@link onnx.OperatorSetIdProto.verify|verify} messages.\n * @function encode\n * @memberof onnx.OperatorSetIdProto\n * @static\n * @param {onnx.IOperatorSetIdProto} message OperatorSetIdProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n OperatorSetIdProto.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.domain != null && Object.hasOwnProperty.call(message, \"domain\"))\n writer.uint32(/* id 1, wireType 2 =*/10).string(message.domain);\n if (message.version != null && Object.hasOwnProperty.call(message, \"version\"))\n writer.uint32(/* id 2, wireType 0 =*/16).int64(message.version);\n return writer;\n };\n\n /**\n * Encodes the specified OperatorSetIdProto message, length delimited. Does not implicitly {@link onnx.OperatorSetIdProto.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.OperatorSetIdProto\n * @static\n * @param {onnx.IOperatorSetIdProto} message OperatorSetIdProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n OperatorSetIdProto.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes an OperatorSetIdProto message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.OperatorSetIdProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.OperatorSetIdProto} OperatorSetIdProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n OperatorSetIdProto.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.OperatorSetIdProto();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n message.domain = reader.string();\n break;\n }\n case 2: {\n message.version = reader.int64();\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes an OperatorSetIdProto message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.OperatorSetIdProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.OperatorSetIdProto} OperatorSetIdProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n OperatorSetIdProto.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies an OperatorSetIdProto message.\n * @function verify\n * @memberof onnx.OperatorSetIdProto\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n OperatorSetIdProto.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.domain != null && message.hasOwnProperty(\"domain\"))\n if (!$util.isString(message.domain))\n return \"domain: string expected\";\n if (message.version != null && message.hasOwnProperty(\"version\"))\n if (!$util.isInteger(message.version) && !(message.version && $util.isInteger(message.version.low) && $util.isInteger(message.version.high)))\n return \"version: integer|Long expected\";\n return null;\n };\n\n /**\n * Creates an OperatorSetIdProto message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.OperatorSetIdProto\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.OperatorSetIdProto} OperatorSetIdProto\n */\n OperatorSetIdProto.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.OperatorSetIdProto)\n return object;\n var message = new $root.onnx.OperatorSetIdProto();\n if (object.domain != null)\n message.domain = String(object.domain);\n if (object.version != null)\n if ($util.Long)\n (message.version = $util.Long.fromValue(object.version)).unsigned = false;\n else if (typeof object.version === \"string\")\n message.version = parseInt(object.version, 10);\n else if (typeof object.version === \"number\")\n message.version = object.version;\n else if (typeof object.version === \"object\")\n message.version = new $util.LongBits(object.version.low >>> 0, object.version.high >>> 0).toNumber();\n return message;\n };\n\n /**\n * Creates a plain object from an OperatorSetIdProto message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.OperatorSetIdProto\n * @static\n * @param {onnx.OperatorSetIdProto} message OperatorSetIdProto\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n OperatorSetIdProto.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.defaults) {\n object.domain = \"\";\n if ($util.Long) {\n var long = new $util.Long(0, 0, false);\n object.version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;\n } else\n object.version = options.longs === String ? \"0\" : 0;\n }\n if (message.domain != null && message.hasOwnProperty(\"domain\"))\n object.domain = message.domain;\n if (message.version != null && message.hasOwnProperty(\"version\"))\n if (typeof message.version === \"number\")\n object.version = options.longs === String ? String(message.version) : message.version;\n else\n object.version = options.longs === String ? $util.Long.prototype.toString.call(message.version) : options.longs === Number ? new $util.LongBits(message.version.low >>> 0, message.version.high >>> 0).toNumber() : message.version;\n return object;\n };\n\n /**\n * Converts this OperatorSetIdProto to JSON.\n * @function toJSON\n * @memberof onnx.OperatorSetIdProto\n * @instance\n * @returns {Object.} JSON object\n */\n OperatorSetIdProto.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for OperatorSetIdProto\n * @function getTypeUrl\n * @memberof onnx.OperatorSetIdProto\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n OperatorSetIdProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.OperatorSetIdProto\";\n };\n\n return OperatorSetIdProto;\n })();\n\n /**\n * OperatorStatus enum.\n * @name onnx.OperatorStatus\n * @enum {number}\n * @property {number} EXPERIMENTAL=0 EXPERIMENTAL value\n * @property {number} STABLE=1 STABLE value\n */\n onnx.OperatorStatus = (function() {\n var valuesById = {}, values = Object.create(valuesById);\n values[valuesById[0] = \"EXPERIMENTAL\"] = 0;\n values[valuesById[1] = \"STABLE\"] = 1;\n return values;\n })();\n\n onnx.FunctionProto = (function() {\n\n /**\n * Properties of a FunctionProto.\n * @memberof onnx\n * @interface IFunctionProto\n * @property {string|null} [name] FunctionProto name\n * @property {Array.|null} [input] FunctionProto input\n * @property {Array.|null} [output] FunctionProto output\n * @property {Array.|null} [attribute] FunctionProto attribute\n * @property {Array.|null} [attributeProto] FunctionProto attributeProto\n * @property {Array.|null} [node] FunctionProto node\n * @property {string|null} [docString] FunctionProto docString\n * @property {Array.|null} [opsetImport] FunctionProto opsetImport\n * @property {string|null} [domain] FunctionProto domain\n */\n\n /**\n * Constructs a new FunctionProto.\n * @memberof onnx\n * @classdesc Represents a FunctionProto.\n * @implements IFunctionProto\n * @constructor\n * @param {onnx.IFunctionProto=} [properties] Properties to set\n */\n function FunctionProto(properties) {\n this.input = [];\n this.output = [];\n this.attribute = [];\n this.attributeProto = [];\n this.node = [];\n this.opsetImport = [];\n if (properties)\n for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)\n if (properties[keys[i]] != null)\n this[keys[i]] = properties[keys[i]];\n }\n\n /**\n * FunctionProto name.\n * @member {string} name\n * @memberof onnx.FunctionProto\n * @instance\n */\n FunctionProto.prototype.name = \"\";\n\n /**\n * FunctionProto input.\n * @member {Array.} input\n * @memberof onnx.FunctionProto\n * @instance\n */\n FunctionProto.prototype.input = $util.emptyArray;\n\n /**\n * FunctionProto output.\n * @member {Array.} output\n * @memberof onnx.FunctionProto\n * @instance\n */\n FunctionProto.prototype.output = $util.emptyArray;\n\n /**\n * FunctionProto attribute.\n * @member {Array.} attribute\n * @memberof onnx.FunctionProto\n * @instance\n */\n FunctionProto.prototype.attribute = $util.emptyArray;\n\n /**\n * FunctionProto attributeProto.\n * @member {Array.} attributeProto\n * @memberof onnx.FunctionProto\n * @instance\n */\n FunctionProto.prototype.attributeProto = $util.emptyArray;\n\n /**\n * FunctionProto node.\n * @member {Array.} node\n * @memberof onnx.FunctionProto\n * @instance\n */\n FunctionProto.prototype.node = $util.emptyArray;\n\n /**\n * FunctionProto docString.\n * @member {string} docString\n * @memberof onnx.FunctionProto\n * @instance\n */\n FunctionProto.prototype.docString = \"\";\n\n /**\n * FunctionProto opsetImport.\n * @member {Array.} opsetImport\n * @memberof onnx.FunctionProto\n * @instance\n */\n FunctionProto.prototype.opsetImport = $util.emptyArray;\n\n /**\n * FunctionProto domain.\n * @member {string} domain\n * @memberof onnx.FunctionProto\n * @instance\n */\n FunctionProto.prototype.domain = \"\";\n\n /**\n * Creates a new FunctionProto instance using the specified properties.\n * @function create\n * @memberof onnx.FunctionProto\n * @static\n * @param {onnx.IFunctionProto=} [properties] Properties to set\n * @returns {onnx.FunctionProto} FunctionProto instance\n */\n FunctionProto.create = function create(properties) {\n return new FunctionProto(properties);\n };\n\n /**\n * Encodes the specified FunctionProto message. Does not implicitly {@link onnx.FunctionProto.verify|verify} messages.\n * @function encode\n * @memberof onnx.FunctionProto\n * @static\n * @param {onnx.IFunctionProto} message FunctionProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n FunctionProto.encode = function encode(message, writer) {\n if (!writer)\n writer = $Writer.create();\n if (message.name != null && Object.hasOwnProperty.call(message, \"name\"))\n writer.uint32(/* id 1, wireType 2 =*/10).string(message.name);\n if (message.input != null && message.input.length)\n for (var i = 0; i < message.input.length; ++i)\n writer.uint32(/* id 4, wireType 2 =*/34).string(message.input[i]);\n if (message.output != null && message.output.length)\n for (var i = 0; i < message.output.length; ++i)\n writer.uint32(/* id 5, wireType 2 =*/42).string(message.output[i]);\n if (message.attribute != null && message.attribute.length)\n for (var i = 0; i < message.attribute.length; ++i)\n writer.uint32(/* id 6, wireType 2 =*/50).string(message.attribute[i]);\n if (message.node != null && message.node.length)\n for (var i = 0; i < message.node.length; ++i)\n $root.onnx.NodeProto.encode(message.node[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim();\n if (message.docString != null && Object.hasOwnProperty.call(message, \"docString\"))\n writer.uint32(/* id 8, wireType 2 =*/66).string(message.docString);\n if (message.opsetImport != null && message.opsetImport.length)\n for (var i = 0; i < message.opsetImport.length; ++i)\n $root.onnx.OperatorSetIdProto.encode(message.opsetImport[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim();\n if (message.domain != null && Object.hasOwnProperty.call(message, \"domain\"))\n writer.uint32(/* id 10, wireType 2 =*/82).string(message.domain);\n if (message.attributeProto != null && message.attributeProto.length)\n for (var i = 0; i < message.attributeProto.length; ++i)\n $root.onnx.AttributeProto.encode(message.attributeProto[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim();\n return writer;\n };\n\n /**\n * Encodes the specified FunctionProto message, length delimited. Does not implicitly {@link onnx.FunctionProto.verify|verify} messages.\n * @function encodeDelimited\n * @memberof onnx.FunctionProto\n * @static\n * @param {onnx.IFunctionProto} message FunctionProto message or plain object to encode\n * @param {$protobuf.Writer} [writer] Writer to encode to\n * @returns {$protobuf.Writer} Writer\n */\n FunctionProto.encodeDelimited = function encodeDelimited(message, writer) {\n return this.encode(message, writer).ldelim();\n };\n\n /**\n * Decodes a FunctionProto message from the specified reader or buffer.\n * @function decode\n * @memberof onnx.FunctionProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @param {number} [length] Message length if known beforehand\n * @returns {onnx.FunctionProto} FunctionProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n FunctionProto.decode = function decode(reader, length) {\n if (!(reader instanceof $Reader))\n reader = $Reader.create(reader);\n var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.FunctionProto();\n while (reader.pos < end) {\n var tag = reader.uint32();\n switch (tag >>> 3) {\n case 1: {\n message.name = reader.string();\n break;\n }\n case 4: {\n if (!(message.input && message.input.length))\n message.input = [];\n message.input.push(reader.string());\n break;\n }\n case 5: {\n if (!(message.output && message.output.length))\n message.output = [];\n message.output.push(reader.string());\n break;\n }\n case 6: {\n if (!(message.attribute && message.attribute.length))\n message.attribute = [];\n message.attribute.push(reader.string());\n break;\n }\n case 11: {\n if (!(message.attributeProto && message.attributeProto.length))\n message.attributeProto = [];\n message.attributeProto.push($root.onnx.AttributeProto.decode(reader, reader.uint32()));\n break;\n }\n case 7: {\n if (!(message.node && message.node.length))\n message.node = [];\n message.node.push($root.onnx.NodeProto.decode(reader, reader.uint32()));\n break;\n }\n case 8: {\n message.docString = reader.string();\n break;\n }\n case 9: {\n if (!(message.opsetImport && message.opsetImport.length))\n message.opsetImport = [];\n message.opsetImport.push($root.onnx.OperatorSetIdProto.decode(reader, reader.uint32()));\n break;\n }\n case 10: {\n message.domain = reader.string();\n break;\n }\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n };\n\n /**\n * Decodes a FunctionProto message from the specified reader or buffer, length delimited.\n * @function decodeDelimited\n * @memberof onnx.FunctionProto\n * @static\n * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from\n * @returns {onnx.FunctionProto} FunctionProto\n * @throws {Error} If the payload is not a reader or valid buffer\n * @throws {$protobuf.util.ProtocolError} If required fields are missing\n */\n FunctionProto.decodeDelimited = function decodeDelimited(reader) {\n if (!(reader instanceof $Reader))\n reader = new $Reader(reader);\n return this.decode(reader, reader.uint32());\n };\n\n /**\n * Verifies a FunctionProto message.\n * @function verify\n * @memberof onnx.FunctionProto\n * @static\n * @param {Object.} message Plain object to verify\n * @returns {string|null} `null` if valid, otherwise the reason why it is not\n */\n FunctionProto.verify = function verify(message) {\n if (typeof message !== \"object\" || message === null)\n return \"object expected\";\n if (message.name != null && message.hasOwnProperty(\"name\"))\n if (!$util.isString(message.name))\n return \"name: string expected\";\n if (message.input != null && message.hasOwnProperty(\"input\")) {\n if (!Array.isArray(message.input))\n return \"input: array expected\";\n for (var i = 0; i < message.input.length; ++i)\n if (!$util.isString(message.input[i]))\n return \"input: string[] expected\";\n }\n if (message.output != null && message.hasOwnProperty(\"output\")) {\n if (!Array.isArray(message.output))\n return \"output: array expected\";\n for (var i = 0; i < message.output.length; ++i)\n if (!$util.isString(message.output[i]))\n return \"output: string[] expected\";\n }\n if (message.attribute != null && message.hasOwnProperty(\"attribute\")) {\n if (!Array.isArray(message.attribute))\n return \"attribute: array expected\";\n for (var i = 0; i < message.attribute.length; ++i)\n if (!$util.isString(message.attribute[i]))\n return \"attribute: string[] expected\";\n }\n if (message.attributeProto != null && message.hasOwnProperty(\"attributeProto\")) {\n if (!Array.isArray(message.attributeProto))\n return \"attributeProto: array expected\";\n for (var i = 0; i < message.attributeProto.length; ++i) {\n var error = $root.onnx.AttributeProto.verify(message.attributeProto[i]);\n if (error)\n return \"attributeProto.\" + error;\n }\n }\n if (message.node != null && message.hasOwnProperty(\"node\")) {\n if (!Array.isArray(message.node))\n return \"node: array expected\";\n for (var i = 0; i < message.node.length; ++i) {\n var error = $root.onnx.NodeProto.verify(message.node[i]);\n if (error)\n return \"node.\" + error;\n }\n }\n if (message.docString != null && message.hasOwnProperty(\"docString\"))\n if (!$util.isString(message.docString))\n return \"docString: string expected\";\n if (message.opsetImport != null && message.hasOwnProperty(\"opsetImport\")) {\n if (!Array.isArray(message.opsetImport))\n return \"opsetImport: array expected\";\n for (var i = 0; i < message.opsetImport.length; ++i) {\n var error = $root.onnx.OperatorSetIdProto.verify(message.opsetImport[i]);\n if (error)\n return \"opsetImport.\" + error;\n }\n }\n if (message.domain != null && message.hasOwnProperty(\"domain\"))\n if (!$util.isString(message.domain))\n return \"domain: string expected\";\n return null;\n };\n\n /**\n * Creates a FunctionProto message from a plain object. Also converts values to their respective internal types.\n * @function fromObject\n * @memberof onnx.FunctionProto\n * @static\n * @param {Object.} object Plain object\n * @returns {onnx.FunctionProto} FunctionProto\n */\n FunctionProto.fromObject = function fromObject(object) {\n if (object instanceof $root.onnx.FunctionProto)\n return object;\n var message = new $root.onnx.FunctionProto();\n if (object.name != null)\n message.name = String(object.name);\n if (object.input) {\n if (!Array.isArray(object.input))\n throw TypeError(\".onnx.FunctionProto.input: array expected\");\n message.input = [];\n for (var i = 0; i < object.input.length; ++i)\n message.input[i] = String(object.input[i]);\n }\n if (object.output) {\n if (!Array.isArray(object.output))\n throw TypeError(\".onnx.FunctionProto.output: array expected\");\n message.output = [];\n for (var i = 0; i < object.output.length; ++i)\n message.output[i] = String(object.output[i]);\n }\n if (object.attribute) {\n if (!Array.isArray(object.attribute))\n throw TypeError(\".onnx.FunctionProto.attribute: array expected\");\n message.attribute = [];\n for (var i = 0; i < object.attribute.length; ++i)\n message.attribute[i] = String(object.attribute[i]);\n }\n if (object.attributeProto) {\n if (!Array.isArray(object.attributeProto))\n throw TypeError(\".onnx.FunctionProto.attributeProto: array expected\");\n message.attributeProto = [];\n for (var i = 0; i < object.attributeProto.length; ++i) {\n if (typeof object.attributeProto[i] !== \"object\")\n throw TypeError(\".onnx.FunctionProto.attributeProto: object expected\");\n message.attributeProto[i] = $root.onnx.AttributeProto.fromObject(object.attributeProto[i]);\n }\n }\n if (object.node) {\n if (!Array.isArray(object.node))\n throw TypeError(\".onnx.FunctionProto.node: array expected\");\n message.node = [];\n for (var i = 0; i < object.node.length; ++i) {\n if (typeof object.node[i] !== \"object\")\n throw TypeError(\".onnx.FunctionProto.node: object expected\");\n message.node[i] = $root.onnx.NodeProto.fromObject(object.node[i]);\n }\n }\n if (object.docString != null)\n message.docString = String(object.docString);\n if (object.opsetImport) {\n if (!Array.isArray(object.opsetImport))\n throw TypeError(\".onnx.FunctionProto.opsetImport: array expected\");\n message.opsetImport = [];\n for (var i = 0; i < object.opsetImport.length; ++i) {\n if (typeof object.opsetImport[i] !== \"object\")\n throw TypeError(\".onnx.FunctionProto.opsetImport: object expected\");\n message.opsetImport[i] = $root.onnx.OperatorSetIdProto.fromObject(object.opsetImport[i]);\n }\n }\n if (object.domain != null)\n message.domain = String(object.domain);\n return message;\n };\n\n /**\n * Creates a plain object from a FunctionProto message. Also converts values to other types if specified.\n * @function toObject\n * @memberof onnx.FunctionProto\n * @static\n * @param {onnx.FunctionProto} message FunctionProto\n * @param {$protobuf.IConversionOptions} [options] Conversion options\n * @returns {Object.} Plain object\n */\n FunctionProto.toObject = function toObject(message, options) {\n if (!options)\n options = {};\n var object = {};\n if (options.arrays || options.defaults) {\n object.input = [];\n object.output = [];\n object.attribute = [];\n object.node = [];\n object.opsetImport = [];\n object.attributeProto = [];\n }\n if (options.defaults) {\n object.name = \"\";\n object.docString = \"\";\n object.domain = \"\";\n }\n if (message.name != null && message.hasOwnProperty(\"name\"))\n object.name = message.name;\n if (message.input && message.input.length) {\n object.input = [];\n for (var j = 0; j < message.input.length; ++j)\n object.input[j] = message.input[j];\n }\n if (message.output && message.output.length) {\n object.output = [];\n for (var j = 0; j < message.output.length; ++j)\n object.output[j] = message.output[j];\n }\n if (message.attribute && message.attribute.length) {\n object.attribute = [];\n for (var j = 0; j < message.attribute.length; ++j)\n object.attribute[j] = message.attribute[j];\n }\n if (message.node && message.node.length) {\n object.node = [];\n for (var j = 0; j < message.node.length; ++j)\n object.node[j] = $root.onnx.NodeProto.toObject(message.node[j], options);\n }\n if (message.docString != null && message.hasOwnProperty(\"docString\"))\n object.docString = message.docString;\n if (message.opsetImport && message.opsetImport.length) {\n object.opsetImport = [];\n for (var j = 0; j < message.opsetImport.length; ++j)\n object.opsetImport[j] = $root.onnx.OperatorSetIdProto.toObject(message.opsetImport[j], options);\n }\n if (message.domain != null && message.hasOwnProperty(\"domain\"))\n object.domain = message.domain;\n if (message.attributeProto && message.attributeProto.length) {\n object.attributeProto = [];\n for (var j = 0; j < message.attributeProto.length; ++j)\n object.attributeProto[j] = $root.onnx.AttributeProto.toObject(message.attributeProto[j], options);\n }\n return object;\n };\n\n /**\n * Converts this FunctionProto to JSON.\n * @function toJSON\n * @memberof onnx.FunctionProto\n * @instance\n * @returns {Object.} JSON object\n */\n FunctionProto.prototype.toJSON = function toJSON() {\n return this.constructor.toObject(this, $protobuf.util.toJSONOptions);\n };\n\n /**\n * Gets the default type url for FunctionProto\n * @function getTypeUrl\n * @memberof onnx.FunctionProto\n * @static\n * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default \"type.googleapis.com\")\n * @returns {string} The default type url\n */\n FunctionProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {\n if (typeUrlPrefix === undefined) {\n typeUrlPrefix = \"type.googleapis.com\";\n }\n return typeUrlPrefix + \"/onnx.FunctionProto\";\n };\n\n return FunctionProto;\n })();\n\n return onnx;\n})();\n\nmodule.exports = $root;\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {flatbuffers} from 'flatbuffers';\nimport Long from 'long';\n\nimport {Graph} from './graph';\nimport {onnxruntime} from './ort-schema/flatbuffers/ort-generated';\nimport {onnx} from './ort-schema/protobuf/onnx';\nimport {Tensor} from './tensor';\n\n// check the inputs shape before running an OP.\n// return true when the inputs pass the check\n// return false when the inputs do not fit the requirement\n// throw exception when fatal error or not implemented\nexport function checkInputsShape(inputs: Tensor[], ...expectedDimensions: number[]): boolean {\n if (!inputs || inputs.length !== expectedDimensions.length) {\n return false;\n }\n for (let i = 0; i < inputs.length; i++) {\n if (!inputs[i].dims || inputs[i].dims.length !== expectedDimensions[i]) {\n return false;\n }\n }\n return true;\n}\n\n// Evaluates the given expression and asserts error message if condition is unmet.\nexport function assert(expr: boolean, msg: () => string) {\n if (!expr) {\n throw new Error(typeof msg === 'string' ? msg : msg());\n }\n}\n\nexport class ArrayUtil {\n /**\n * Verifies if 2 input arrays contain the same elements.\n * @param n1 Array 1\n * @param n2 Array 2\n * @returns Whether these 2 are equal\n */\n static arraysEqual(\n n1: readonly number[]|Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Uint8ClampedArray|\n Float32Array|Float64Array,\n n2: readonly number[]|Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Uint8ClampedArray|\n Float32Array|Float64Array) {\n if (n1.length !== n2.length) {\n return false;\n }\n for (let i = 0; i < n1.length; i++) {\n if (n1[i] !== n2[i]) {\n return false;\n }\n }\n return true;\n }\n}\n\nexport class MatMulUtil {\n /**\n * Fix the input shapes for MatMul operation if they need fixing\n * @param dimsA The shape of tensor A. Should be an array of positive integers\n * @param dimsB The shape of tensor B. Should be an array of positive integers\n * @returns A tuple containing the preprocessed input shapes as required by ONNX specifications\n */\n static preprocessInputShapes(dimsA: readonly number[], dimsB: readonly number[]):\n [readonly number[], readonly number[]] {\n // If the first argument is 1-D, it is promoted to a matrix by prepending\n // a 1 to its dimensions. After matrix multiplication the prepended 1 is\n // removed.\n const a = (dimsA.length === 1) ? [1, dimsA[0]] : dimsA;\n\n // If the second argument is 1-D, it is promoted to a matrix by appending\n // a 1 to its dimensions. After matrix multiplication the appended 1 is\n // removed.\n const b = (dimsB.length === 1) ? [dimsB[0], 1] : dimsB;\n\n return [a, b];\n }\n\n /**\n * Fix the output shape computed for MatMul operation if it needs fixing\n * @param outputShape The computed outputShape. Should be an array (atleast of length 2) of positive integers.\n * This will be mutated.\n * @param aRank The rank of tensor A.\n * @param bRank The rank of tensor B.\n */\n static postprocessOutputShape(outputShape: number[], aRank: number, bRank: number) {\n // Remove prepended dimension if first input is 1d\n if (aRank === 1) {\n // outputShape = outputShape.slice(0, outputShape.length - 2).concat(outputShape.slice(outputShape.length - 1));\n outputShape.splice(outputShape.length - 2, 1);\n }\n // Remove appended dimension if second input is 1d\n if (bRank === 1) {\n outputShape.pop();\n }\n }\n\n /**\n * Calculate the expected shape when matrix multiplication\n * @param a The shape of tensor A. Should be a tuple of 2 positive integers\n * @param b The shape of tensor B. Should be a tuple of 2 positive integers\n * @returns The expected shape of the result, or undefined if N/A\n */\n static calcMatMulShape(a: [number, number], b: [number, number]): [number, number]|undefined {\n return (a[1] !== b[0]) ? undefined : [a[0], b[1]];\n }\n}\n\nexport class BroadcastUtil {\n /**\n * Calculate the expected shape when broadcasting 2 tensors\n * @param a The shape of tensor A. Should be an array of positive integers\n * @param b The shape of tensor B. Should be an array of positive integers\n * @param isMatMul Whether the operation is MatMul\n * @returns The expected shape of the result, or undefined if N/A\n */\n static calcShape(adims: readonly number[], bdims: readonly number[], isMatMul = false): readonly number[]|undefined {\n const arank = adims.length;\n const brank = bdims.length;\n if (arank === 0) {\n return bdims;\n }\n if (brank === 0) {\n return adims;\n }\n const crank = Math.max(adims.length, bdims.length);\n const cdims = new Array(crank);\n\n // calculate the last 2 dimension if it is MatMul\n if (isMatMul) {\n if (arank < 2 || brank < 2) {\n return undefined;\n }\n const cShapeMatMul =\n MatMulUtil.calcMatMulShape([adims[arank - 2], adims[arank - 1]], [bdims[brank - 2], bdims[brank - 1]]);\n if (cShapeMatMul === undefined) {\n return undefined;\n }\n [cdims[crank - 2], cdims[crank - 1]] = cShapeMatMul;\n }\n\n for (let i = isMatMul ? 3 : 1; i <= crank; i++) {\n const aLen = arank - i < 0 ? 1 : adims[arank - i];\n const bLen = brank - i < 0 ? 1 : bdims[brank - i];\n\n if (aLen !== bLen && aLen > 1 && bLen > 1) {\n return undefined;\n }\n cdims[crank - i] = Math.max(aLen, bLen);\n }\n\n return cdims;\n }\n\n /**\n * Given the indices of a broadcasted tensor, calculate the original indices\n * @param broadcastedIndices The given indices of the broadcasted tensor.\n * @param originalShape The original shape of the tensor before broadcas\n * @returns The calculated indices that maps to the original tensor.\n */\n static index(broadcastedIndices: readonly number[], originalShape: readonly number[]): number[] {\n // NOTE 1: we assume the parameter broadcastedIndices is valid. ie. it should have the same\n // length as the broadcasted shape, and for each dimension the index should\n // not be out of range.\n const originalIndices = new Array(originalShape.length);\n BroadcastUtil.fillIndex(broadcastedIndices, originalShape, originalIndices);\n return originalIndices;\n }\n\n /**\n * Given the indices of a broadcasted tensor, calculate the original indices\n * @param broadcastedIndices The given indices of the broadcasted tensor.\n * @param originalShape The original shape of the tensor before broadcast\n * @param originalIndices The mapping of broadcastedIndices to the originalIndices (output parameter - will be\n * mutated).\n */\n static fillIndex(broadcastedIndices: readonly number[], originalShape: readonly number[], originalIndices: number[]) {\n // NOTE 1: we assume the parameter broadcastedIndices is valid. ie. it should have the same length as the\n // broadcasted shape, and for each dimension the index should not be out of range.\n // NOTE 2: we assume the parameter originalIndices has the same length as the originalShape\n const dimOffset = broadcastedIndices.length - originalShape.length;\n for (let i = 0; i < originalShape.length; i++) {\n originalIndices[i] = broadcastedIndices[dimOffset + i] % originalShape[i];\n }\n }\n\n /**\n * Perform the broadcasting operation on the specific operator\n * @param a The input tensor A\n * @param b The input tensor B\n * @param op The operator lambda function\n * @param inplace Whether to write the result back to A.\n * @returns The result tensor, or undefined if input not broadcastable.\n */\n static calc(\n a: Tensor, b: Tensor, op: (a: string|number, b: string|number) => (string | number), inplace: boolean,\n resultType?: Tensor.DataType): Tensor|undefined {\n const outputShape = BroadcastUtil.calcShape(a.dims, b.dims);\n\n if (outputShape) {\n if (inplace && !ShapeUtil.areEqual(outputShape, a.dims)) {\n // B is not broadcastable to A, failed to calculate inplace.\n return undefined;\n }\n\n const size = ShapeUtil.size(outputShape);\n const c = inplace ? a : new Tensor(outputShape, resultType || a.type);\n\n // both inputs are scalars\n if (outputShape.length === 0) {\n c.set([], op(a.get([]) as number, b.get([]) as number));\n }\n\n // atleast one input is a non-scalar\n else {\n const outputIndices = new Array(outputShape.length);\n const originalIndicesA = new Array(a.dims.length);\n const originalIndicesB = new Array(b.dims.length);\n let valA: string|number = 0;\n let valB: string|number = 0;\n let isAScalar = false;\n let isBScalar = false;\n if (a.dims.length === 0) {\n valA = a.get([]) as number;\n isAScalar = true;\n }\n if (b.dims.length === 0) {\n valB = b.get([]) as number;\n isBScalar = true;\n }\n let rest: number;\n for (let i = 0; i < size; i++) {\n // traversal indices\n rest = i;\n for (let j = outputShape.length - 1; j >= 0; j--) {\n outputIndices[j] = rest % outputShape[j];\n rest = Math.floor(rest / outputShape[j]);\n }\n\n if (!isAScalar) {\n // map outputIndices (which is actually broadcasted) to the originalIndices\n BroadcastUtil.fillIndex(outputIndices, a.dims, originalIndicesA);\n valA = a.get(originalIndicesA) as number;\n }\n if (!isBScalar) {\n BroadcastUtil.fillIndex(outputIndices, b.dims, originalIndicesB);\n valB = b.get(originalIndicesB) as number;\n }\n\n c.set(outputIndices, op(valA, valB));\n }\n }\n\n return c;\n }\n\n return undefined;\n }\n\n /**\n * Determine if a shape is unidirectional broadcastable to another shape\n * @param shape The input shape\n * @param finalShape The desired shape after broadcasting\n */\n static isValidBroadcast(shape: readonly number[], finalShape: readonly number[]): boolean {\n // align shape to the right\n const inputRank = shape.length;\n const finalRank = finalShape.length;\n if (inputRank > finalRank) {\n return false;\n }\n for (let i = 1; i <= inputRank; i++) {\n if (shape[inputRank - i] !== 1 && shape[inputRank - i] !== finalShape[finalRank - i]) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Determine the broadcasted dims in input shape based on the given output shape.\n * Note that this function only returns the broadcasted dims.\n * @param inputShape The input shape\n * @param outputShape The output shape\n * @returns The broadcasted dims in input shape.\n */\n static getBroadcastDims(inputShape: readonly number[], outputShape: readonly number[]): number[] {\n const inRank = inputShape.length;\n const dims: number[] = [];\n for (let i = 0; i < inRank; i++) {\n const dim = inRank - 1 - i;\n const a = inputShape[dim] || 1;\n const b = outputShape[outputShape.length - 1 - i] || 1;\n if (b > 1 && a === 1) {\n dims.unshift(dim);\n }\n }\n return dims;\n }\n}\n\n// copy array helper\n// mimics memcpy as much as possible\nexport function arrayCopyHelper(\n target: number[]|Tensor.NumberType, source: number[]|Tensor.NumberType, targetIndex: number, sourceIndex: number,\n blockSize: number) {\n if (sourceIndex < 0 || sourceIndex >= source.length) {\n throw new Error('sourceIndex out of bounds');\n }\n if (targetIndex < 0 || targetIndex >= target.length) {\n throw new Error('targetIndex out of bounds');\n }\n if (sourceIndex + blockSize > source.length) {\n throw new Error('source indices to be copied are outside bounds');\n }\n if (targetIndex + blockSize > target.length) {\n throw new Error('target array is too small to hold result');\n }\n\n for (let offset = 0; offset < blockSize; offset++) {\n target[targetIndex + offset] = source[sourceIndex + offset];\n }\n}\n\nexport class GemmUtil {\n // will make sure input shapes are compatible for this op\n // and return back the shape of the output in the form of a tuple\n // will throw exception if the input shapes are not compatible\n static getShapeOfGemmResult(\n leftShape: readonly number[], transLeft: boolean, rightShape: readonly number[], transRight: boolean,\n biasShape?: readonly number[]): readonly number[] {\n if (leftShape.length !== 2 || rightShape.length !== 2) {\n throw new Error('shape need to be of size 2');\n }\n\n let M: number;\n let K: number;\n let N: number;\n\n if (transLeft) {\n M = leftShape[1];\n K = leftShape[0];\n } else {\n M = leftShape[0];\n K = leftShape[1];\n }\n\n let kDim = -1;\n\n if (transRight) {\n N = rightShape[0];\n kDim = 1;\n } else {\n N = rightShape[1];\n kDim = 0;\n }\n\n if (rightShape[kDim] !== K) {\n throw new Error('dimension mismatch');\n }\n\n if (M <= 0 || N <= 0 || K <= 0) {\n throw new Error('invalid shape specified');\n }\n\n if (biasShape && !BroadcastUtil.isValidBroadcast(biasShape, [M, N])) {\n throw new Error('gemm: invalid bias shape for broadcast');\n }\n\n return [M, N, K];\n }\n}\n\nexport class ProtoUtil {\n static tensorDataTypeFromProto(typeProto: onnx.TensorProto.DataType|\n onnxruntime.experimental.fbs.TensorDataType): Tensor.DataType {\n switch (typeProto) {\n case onnx.TensorProto.DataType.INT8:\n return 'int8';\n case onnx.TensorProto.DataType.UINT8:\n return 'uint8';\n case onnx.TensorProto.DataType.BOOL:\n return 'bool';\n case onnx.TensorProto.DataType.INT16:\n return 'int16';\n case onnx.TensorProto.DataType.UINT16:\n return 'uint16';\n case onnx.TensorProto.DataType.INT32:\n return 'int32';\n case onnx.TensorProto.DataType.UINT32:\n return 'uint32';\n case onnx.TensorProto.DataType.FLOAT:\n return 'float32';\n case onnx.TensorProto.DataType.DOUBLE:\n return 'float64';\n case onnx.TensorProto.DataType.STRING:\n return 'string';\n\n // For INT64/UINT64, reduce their value to 32-bits.\n // Should throw exception when overflow\n case onnx.TensorProto.DataType.INT64:\n return 'int32';\n case onnx.TensorProto.DataType.UINT64:\n return 'uint32';\n\n default:\n throw new Error(`unsupported data type: ${onnx.TensorProto.DataType[typeProto]}`);\n }\n }\n\n static tensorDataTypeStringToEnum(type: string): onnx.TensorProto.DataType {\n switch (type) {\n case 'int8':\n return onnx.TensorProto.DataType.INT8;\n case 'uint8':\n return onnx.TensorProto.DataType.UINT8;\n case 'bool':\n return onnx.TensorProto.DataType.BOOL;\n case 'int16':\n return onnx.TensorProto.DataType.INT16;\n case 'uint16':\n return onnx.TensorProto.DataType.UINT16;\n case 'int32':\n return onnx.TensorProto.DataType.INT32;\n case 'uint32':\n return onnx.TensorProto.DataType.UINT32;\n case 'float32':\n return onnx.TensorProto.DataType.FLOAT;\n case 'float64':\n return onnx.TensorProto.DataType.DOUBLE;\n case 'string':\n return onnx.TensorProto.DataType.STRING;\n case 'int64':\n return onnx.TensorProto.DataType.INT64;\n case 'uint64':\n return onnx.TensorProto.DataType.UINT64;\n\n default:\n throw new Error(`unsupported data type: ${type}`);\n }\n }\n\n static tensorDimsFromProto(dims: Array): number[] {\n // get rid of Long type for dims\n return dims.map(d => Long.isLong(d) ? d.toNumber() : d);\n }\n\n static tensorValueTypeFromProto(valueType: onnx.TypeProto.ITensor): Graph.ValueType {\n return {\n tensorType: ProtoUtil.tensorDataTypeFromProto(valueType.elemType!),\n shape: {dims: ProtoUtil.tensorDimsFromProto(valueType.shape!.dim!.map(d => d.dimValue!))}\n };\n }\n\n static tensorDimsFromORTFormat(tensor: onnxruntime.experimental.fbs.Tensor) {\n const dims = [];\n for (let i = 0; i < tensor.dimsLength(); i++) {\n dims.push(LongUtil.longToNumber(tensor.dims(i)!));\n }\n return dims;\n }\n\n static tensorAttributesFromORTFormat(node: onnxruntime.experimental.fbs.Node) {\n const attributes = [];\n for (let i = 0; i < node.attributesLength(); i++) {\n attributes.push(node.attributes(i)!);\n }\n return attributes;\n }\n}\n\nexport class LongUtil {\n // This function is called to get a number from long type of data for attribute, dim, and ir version,\n // which values are signed integers.\n // To make it more generic, add an optional parameter to convert to a unsigned number.\n static longToNumber(n: Long|flatbuffers.Long|number, unsigned?: boolean) {\n if (Long.isLong(n)) {\n return n.toNumber();\n } else if (n instanceof flatbuffers.Long) {\n return Long.fromValue({low: n.low, high: n.high, unsigned: unsigned ?? false}).toNumber();\n }\n return n;\n }\n static isLong(n: unknown) {\n return Long.isLong(n) || n instanceof flatbuffers.Long;\n }\n}\n\nexport class ShapeUtil {\n static size(dims: readonly number[]): number {\n return ShapeUtil.getSizeFromDimensionRange(dims, 0, dims.length);\n }\n\n // `axis` inclusive\n static sizeFromDimension(dims: readonly number[], axis: number): number {\n if (axis < 0 || axis > dims.length) {\n throw new Error(`invalid dimension of ${axis} for sizeFromDimension as Tensor has ${dims.length} dimensions.`);\n }\n return ShapeUtil.getSizeFromDimensionRange(dims, axis, dims.length);\n }\n\n // `axis` exclusive\n static sizeToDimension(dims: readonly number[], axis: number): number {\n if (axis < 0 || axis > dims.length) {\n throw new Error(`invalid dimension of ${axis} for sizeToDimension as Tensor has ${dims.length} dimensions.`);\n }\n return ShapeUtil.getSizeFromDimensionRange(dims, 0, axis);\n }\n\n static getSizeFromDimensionRange(dims: readonly number[], start: number, end: number): number {\n let size = 1;\n for (let i = start; i < end; i++) {\n // safety check as this method is called by multiple other methods requiring size.\n // size cannot be 0 or negative.\n if (dims[i] <= 0) {\n throw new Error(\n // eslint-disable-next-line max-len\n 'cannot get valid size from specified dimension range. Most likely the range contains 0 or negative values in them.');\n }\n size *= dims[i];\n }\n return size;\n }\n\n static computeStrides(dims: readonly number[]): readonly number[] {\n const rank = dims.length;\n if (rank === 0) {\n return [];\n } else if (rank === 1) {\n return [1];\n }\n const strides = new Array(rank);\n strides[rank - 1] = 1;\n strides[rank - 2] = dims[rank - 1];\n for (let i = rank - 3; i >= 0; --i) {\n strides[i] = strides[i + 1] * dims[i + 1];\n }\n return strides;\n }\n\n static transpose(dims: readonly number[]): readonly number[] {\n const copy = dims.slice();\n return copy.reverse();\n }\n\n static indicesToOffset(indices: readonly number[], strides: readonly number[], axis?: number): number {\n if (axis === undefined) {\n axis = indices.length;\n }\n let offset = 0;\n for (let i = 0; i < axis; ++i) {\n offset += strides[i] * indices[i];\n }\n return offset;\n }\n\n static offsetToIndices(offset: number, strides: readonly number[]): readonly number[] {\n const rank = strides.length;\n if (rank === 0) {\n return [];\n } else if (rank === 1) {\n return [offset * strides[0]];\n }\n const indices: number[] = new Array(strides.length);\n for (let i = 0; i < indices.length - 1; ++i) {\n indices[i] = Math.floor(offset / strides[i]);\n offset -= indices[i] * strides[i];\n }\n indices[indices.length - 1] = offset;\n return indices;\n }\n\n /**\n * normailze axis of range [-r, r) into [0, r).\n */\n static normalizeAxis(axis: number, tensorRank: number): number {\n if (axis < -tensorRank && axis >= tensorRank) {\n throw new Error('unsupported axis for this operation.');\n }\n return axis < 0 ? axis + tensorRank : axis;\n }\n\n static normalizeAxes(axes: readonly number[], tensorRank: number): number[] {\n return axes.map(x => this.normalizeAxis(x, tensorRank));\n }\n\n // Increment an index into a tensor (in lexicographic\n // ordering), wrapping around the specified upper_bound.\n /**\n * Increment an index into a tensor (in lexicographic ordering), wrapping around the specified upper_bound.\n * @param index Given index to increment (Will be mutated)\n * @param dims The dimensions of the tensor for which the given index corresponds to\n * @param axisToIncrementOn The 1-indexed axis to increment on. If undefined, axisToIncrementOn == rank\n */\n static incrementIndex(index: number[], dims: readonly number[], axisToIncrementOn?: number) {\n if (dims.length === 0 || index.length === 0) {\n throw new Error('Index incrementing unsupported for scalar Tensor');\n }\n if (axisToIncrementOn === undefined) {\n axisToIncrementOn = dims.length;\n } else {\n if (axisToIncrementOn <= 0 || axisToIncrementOn > dims.length) {\n throw new Error('Incorrect axis to increment on');\n }\n }\n\n for (let k = axisToIncrementOn - 1; k >= 0; --k) {\n index[k]++;\n if (index[k] < dims[k]) {\n break;\n }\n index[k] = 0;\n }\n }\n\n /**\n * Produces a new dimensions array based on the values in the 'originalDimensions' and 'shape' array\n * Used in Reshape\n * @param originalDims Original Shape array\n * @param shapeHints array containing values to compute the new dimensions\n * For example:\n * originalDims = [2,2] and shapeHints = [0,-1] will return [2,2]\n * originalDims = [2,2] and shapeHints = [4] will return [4]\n * originalDims = [2,2] and shapeHints = [5] will throw an exception\n * https://github.com/onnx/onnx/blob/main/docs/Operators.md#Reshape\n */\n\n static calculateReshapedDims(originalDims: readonly number[], shapeHints: ArrayLike): number[] {\n // reshape to a Scalar Tensor\n if (shapeHints.length === 0) {\n if (originalDims.length === 0 || ShapeUtil.size(originalDims) === 1) {\n return [];\n } else {\n throw new Error('cannot reshape to a scalar Tensor');\n }\n }\n\n const nDims = shapeHints.length;\n const reshapedDims = new Array(nDims);\n let unknownDimension = -1;\n let newTensorSize = 1;\n for (let i = 0; i < nDims; i++) {\n if (shapeHints[i] < -1) {\n throw new Error('a dimension in shape hints cannot be less than -1');\n }\n if (shapeHints[i] === -1) {\n if (unknownDimension !== -1) {\n throw new Error('at most one dimension in shape hints can be -1');\n }\n unknownDimension = i;\n } else {\n if (shapeHints[i] === 0) {\n if (i >= originalDims.length) {\n throw new Error('the dimension with value zero exceeds the dimension size of the input tensor');\n }\n reshapedDims[i] = originalDims[i];\n } else {\n reshapedDims[i] = shapeHints[i];\n }\n newTensorSize *= reshapedDims[i];\n }\n }\n\n const oldTensorSize = ShapeUtil.size(originalDims);\n if (unknownDimension !== -1) {\n if (oldTensorSize % newTensorSize !== 0) {\n throw new Error(`the input tensor cannot be reshaped to the requested shape. Input shape: [${\n originalDims}] Output shape: [${shapeHints}]`);\n }\n reshapedDims[unknownDimension] = oldTensorSize / newTensorSize;\n }\n // validate sizes from originalDims and reshapedDims match\n else {\n if (newTensorSize !== oldTensorSize) {\n throw new Error('reshapedDims and originalDims don\\'t have matching sizes');\n }\n }\n return reshapedDims;\n }\n\n /**\n * Sorts a given array based on the indices in the Perm array\n * Used in Transpose\n * @param a Array to be sorted such as dims or strides\n * @param perm Perm given; if null a will be reversed\n */\n static sortBasedOnPerm(a: readonly number[], perm?: readonly number[]): readonly number[] {\n if (perm) {\n return perm.map((v) => a[v]);\n } else {\n return a.slice().reverse();\n }\n }\n\n /**\n * Pads a given shape according to the padding values\n * @param dims shape of the Tensor to be padded\n * @param pad pad values\n */\n static padShape(dims: readonly number[], pad: readonly number[]): readonly number[] {\n const rank = dims.length;\n return dims.map((v, i) => v + pad[i] + pad[i + rank]);\n }\n\n /**\n * Determines if the two shapes are identical\n * @param shape1\n * @param shape2\n */\n static areEqual(shape1: readonly number[], shape2: readonly number[]): boolean {\n if (shape1.length !== shape2.length) {\n return false;\n }\n return shape1.every((v, i) => v === shape2[i]);\n }\n\n /**\n * Validates if the given `dims` or `shape` is valid in ONNX.js context and returns data size\n * @param dims - input `dims` that needs to be checked\n */\n static validateDimsAndCalcSize(dims: readonly number[]): number {\n if (dims.length > 6) {\n throw new TypeError('Only rank 0 to 6 is supported for tensor shape.');\n }\n let size = 1;\n for (const n of dims) {\n if (!Number.isInteger(n)) {\n throw new TypeError(`Invalid shape: ${n} is not an integer`);\n }\n if (n < 0 || n > 2147483647) {\n throw new TypeError(`Invalid shape: length ${n} is not allowed`);\n }\n size *= n;\n }\n return size;\n }\n\n /**\n * Determines the shape of output tensor y = flatten(x, axis)\n * @param dims - shape of input tensor\n * @param axis - flatten axis, in the range [-r, r]\n */\n static flattenShape(dims: readonly number[], axis: number): readonly number[] {\n if (axis < 0) {\n axis += dims.length;\n }\n const total = dims.reduce((x, y) => x * y, 1);\n const right = dims.slice(axis).reduce((x, y) => x * y, 1);\n const outputDims = [total / right, right];\n\n return outputDims;\n }\n\n /**\n * Determines the shape of output tensor y = squeeze(x, axes)\n * @param dims - shape of input tensor\n * @param axes - squeeze axes\n */\n static squeezeShape(dims: readonly number[], axes: readonly number[]): readonly number[] {\n const outputDims = new Array();\n\n // sanity check\n axes = ShapeUtil.normalizeAxes(axes, dims.length);\n\n for (let i = 0; i < dims.length; i++) {\n const inSqueezeList = axes.indexOf(i) >= 0;\n if (inSqueezeList && dims[i] !== 1) {\n throw new Error('squeeze an axis of size different than 1');\n }\n\n if ((axes.length === 0 && dims[i] > 1) || (axes.length > 0 && !inSqueezeList)) {\n outputDims.push(dims[i]);\n }\n }\n\n return outputDims;\n }\n\n /**\n * Determines the shape of output tensor y = unsqueeze(x, axes)\n * @param dims - shape of input tensor\n * @param axes - unsqueeze axes\n */\n static unsqueezeShape(dims: readonly number[], axes: readonly number[]): readonly number[] {\n const outputDims = new Array(dims.length + axes.length);\n\n // initialize the array elements to 0\n outputDims.fill(0);\n\n // set all axes indices to 1 in outputDims and check for duplicates\n for (let i = 0; i < axes.length; i++) {\n const axis = ShapeUtil.normalizeAxis(axes[i], outputDims.length);\n if (axis >= outputDims.length) {\n throw new Error('\\'axes\\' has an out of range axis');\n }\n if (outputDims[axis] !== 0) {\n throw new Error('\\'axes\\' has a duplicate axis');\n }\n\n outputDims[axis] = 1;\n }\n\n // fill in the zero entries of outputDims with the input tensor's shape\n let inputDimsIterator = 0;\n for (let i = 0; i < outputDims.length; i++) {\n if (outputDims[i] === 0) {\n outputDims[i] = dims[inputDimsIterator++];\n }\n }\n\n // sanity check assertion. 'inputDimsIterator'\n // should be equal to the length of 'dims'\n if (inputDimsIterator !== dims.length) {\n throw new Error('the unsqueezed dimension could not be established');\n }\n\n return outputDims;\n }\n}\n\n// bunch of helper methods that do a variety of math operations\nexport class MathUtil {\n // y = (x*x) + y\n static sqr(\n target: number[]|Tensor.NumberType, source: number[]|Tensor.NumberType, targetIndex: number, sourceIndex: number,\n blockSize: number) {\n if (sourceIndex < 0 || sourceIndex >= source.length) {\n throw new Error('sourceIndex out of bounds');\n }\n if (targetIndex < 0 || targetIndex >= target.length) {\n throw new Error('targetIndex out of bounds');\n }\n if (sourceIndex + blockSize > source.length) {\n throw new Error('source indices to be copied are outside bounds');\n }\n if (targetIndex + blockSize > target.length) {\n throw new Error('target array is too small to hold result');\n }\n\n for (let offset = 0; offset < blockSize; offset++) {\n target[targetIndex + offset] += Math.pow(source[sourceIndex + offset], 2);\n }\n }\n\n // y = ax + y\n static axpy(\n target: number[]|Tensor.NumberType, source: number[]|Tensor.NumberType, targetIndex: number, sourceIndex: number,\n blockSize: number, alpha: number) {\n if (sourceIndex < 0 || sourceIndex >= source.length) {\n throw new Error('sourceIndex out of bounds');\n }\n if (targetIndex < 0 || targetIndex >= target.length) {\n throw new Error('targetIndex out of bounds');\n }\n if (sourceIndex + blockSize > source.length) {\n throw new Error('source indices to be copied are outside bounds');\n }\n if (targetIndex + blockSize > target.length) {\n throw new Error('target array is too small to hold result');\n }\n\n for (let offset = 0; offset < blockSize; offset++) {\n target[targetIndex + offset] += (alpha * source[sourceIndex + offset]);\n }\n }\n\n // y = pow(x, b)\n static powx(\n target: number[]|Tensor.NumberType, source: number[]|Tensor.NumberType, targetIndex: number, sourceIndex: number,\n blockSize: number, b: number) {\n if (sourceIndex < 0 || sourceIndex >= source.length) {\n throw new Error('sourceIndex out of bounds');\n }\n if (targetIndex < 0 || targetIndex >= target.length) {\n throw new Error('targetIndex out of bounds');\n }\n if (sourceIndex + blockSize > source.length) {\n throw new Error('source indices to be copied are outside bounds');\n }\n if (targetIndex + blockSize > target.length) {\n throw new Error('target array is too small to hold result');\n }\n\n for (let offset = 0; offset < blockSize; offset++) {\n target[targetIndex + offset] = Math.pow(source[sourceIndex + offset], b);\n }\n }\n\n // y = x * y\n static mul(\n target: number[]|Tensor.NumberType, source: number[]|Tensor.NumberType, targetIndex: number, sourceIndex: number,\n blockSize: number) {\n if (sourceIndex < 0 || sourceIndex >= source.length) {\n throw new Error('sourceIndex out of bounds');\n }\n if (targetIndex < 0 || targetIndex >= target.length) {\n throw new Error('targetIndex out of bounds');\n }\n if (sourceIndex + blockSize > source.length) {\n throw new Error('source indices to be copied are outside bounds');\n }\n if (targetIndex + blockSize > target.length) {\n throw new Error('target array is too small to hold result');\n }\n\n for (let offset = 0; offset < blockSize; offset++) {\n target[targetIndex + offset] = (source[sourceIndex + offset] * target[targetIndex + offset]);\n }\n }\n}\n\nexport class SplitUtil {\n /**\n * Calculates new Shapes from existing one and the splits given along the axis provides\n * @param dims Shape of the Tensor to be splitted into two or more Shapes\n * @param axis The dimension along which the Tensor will be split\n * @param splits Offsets for the start of each split\n */\n static splitShape(dims: readonly number[], axis: number, split: number[], numOutputs?: number):\n [number[][], number[]] {\n if (split.length === 0) {\n if (!numOutputs) {\n throw new Error('need to know number of outputs when the \\'split\\' attribute is not specified');\n }\n SplitUtil.determineSplit(dims[axis], numOutputs, split);\n }\n\n const shapes: number[][] = [];\n const offsets = [0];\n for (let i = 0; i < split.length; ++i) {\n if (i !== 0) {\n offsets.push(offsets[i - 1] + split[i - 1]);\n }\n const shape = dims.slice();\n shape[axis] = split[i];\n shapes.push(shape);\n }\n return [shapes, offsets];\n }\n\n static determineSplit(numElementsAlongAxis: number, numOutputs: number, split: number[]) {\n // If 'split' is not specified by the user, we need to partition the number of elements equally among the outputs\n if (numElementsAlongAxis % numOutputs !== 0) {\n throw new Error('cannot split tensor to equal sized parts');\n }\n for (let i = 0; i < numOutputs; ++i) {\n split.push(numElementsAlongAxis / numOutputs);\n }\n }\n}\n\nexport class ReduceUtil {\n /**\n * Perform reduce operations on the specific operator\n * @param a Input tensor data\n * @param axes The dimensions along which the Tensor will be reduced\n * @param keepdims If set to true, the axes which are reduced are left in the\n * result as dimensions with size one.\n * @param op1 The operation to be performed on each element in the tensor\n * @param op2 The operation to be performed between elements in the tensor\n */\n static calcReduce(\n a: Tensor, axes: number[], keepdims: boolean, op1: (b: number) => number,\n op2: (a: number, b: number) => number): Tensor {\n const dims = a.dims.slice(0);\n // if axes is not set, perform reduce on all axes\n if (axes.length === 0) {\n dims.forEach((_d, ind) => axes.push(ind));\n }\n // get a temporary broadcastable output shape\n const outputDims = ReduceUtil.calcReduceShape(dims, axes, true);\n\n // loop through the output and calculate result one by one\n const size = ShapeUtil.size(outputDims);\n const y = new Tensor(outputDims, a.type);\n const strides = ShapeUtil.computeStrides(outputDims);\n const inputStrides = ShapeUtil.computeStrides(dims);\n const indicesY = new Array(dims.length);\n for (let i = 0; i < size; i++) {\n const indices = ShapeUtil.offsetToIndices(i, strides);\n // map index\n BroadcastUtil.fillIndex(indices, dims, indicesY);\n y.set(\n indices,\n ReduceUtil.calcReduceByAxis(\n a.numberData, axes, dims, 0, ShapeUtil.indicesToOffset(indicesY, inputStrides), op1, op2));\n }\n\n if (keepdims) {\n return y;\n } else {\n // keepdims == 0, calculate the expected shape\n return new Tensor(\n ReduceUtil.calcReduceShape(dims, axes, keepdims), y.type, undefined, undefined, y.data, y.dataId);\n }\n }\n\n /**\n * Perform reduce operations on the specific operator on specific axes\n * @param a Input tensor data\n * @param axes The dimensions along which the Tensor will be reduced\n * @param dims The input dimension.\n * @param curAxisInd Index in axes specifying the current dimension along\n * which the tensor will be reduced\n * @param pos The current index of element to perform operation\n * @param op1 The operation to be performed on each element in the tensor\n * @param op2 The operation to be performed between elements in the tensor\n */\n static calcReduceByAxis(\n input: Tensor.NumberType, axes: number[], dims: number[], curAxisInd: number, pos: number,\n op1: (b: number) => number, op2: (a: number, b: number) => number): number {\n let res = 0;\n if (curAxisInd >= axes.length) {\n return op1(input[pos]);\n }\n const axis = axes[curAxisInd];\n const step = axis >= dims.length ? 1 : ShapeUtil.size(dims.slice(axis + 1));\n for (let i = 0; i < dims[axis]; i++) {\n res = i === 0 ? ReduceUtil.calcReduceByAxis(input, axes, dims, curAxisInd + 1, pos, op1, op2) :\n op2(res, ReduceUtil.calcReduceByAxis(input, axes, dims, curAxisInd + 1, pos, op1, op2));\n pos += step;\n }\n return res;\n }\n\n /**\n * Calculate the expected shape of a reduce operation\n * @param dims The input tensor dimension\n * @param axes The dimensions along which the Tensor will be reduced\n * @param keepdims If set to true, the axes which are reduced are left in the\n * result as dimensions with size one.\n */\n static calcReduceShape(dims: readonly number[], axes: readonly number[], keepDims: boolean): number[] {\n const outputDims = dims.slice();\n for (let i = 0; i < axes.length; i++) {\n if (keepDims) {\n outputDims[axes[i]] = 1;\n } else {\n outputDims[axes[i]] = 0;\n }\n }\n return outputDims.filter(dim => dim !== 0);\n }\n}\n\nexport class PoolConvUtil {\n /**\n * Adjust the kernel, strides, pads to correct rank. Set to default value if not present\n * @param isGlobalOperator If true, perform global pooling.\n * @param inputDims The input tensor dimension.\n * @param kernelShape The size of the kernel along each axis.\n * @param strides Stride along each axis.\n * @param dilations Dilation along each axis.\n * @param pads Padding for the beginning and ending along each axis.\n */\n static adjustPoolAttributes(\n isGlobalOperator: boolean, inputDims: readonly number[], kernelShape: number[], strides: number[],\n dilations: number[], pads: number[]) {\n if (!isGlobalOperator && kernelShape.length !== inputDims.length - 2) {\n throw new Error('length of specified kernel shapes should be 2 less than length of input dimensions');\n }\n\n if (isGlobalOperator) {\n // adjust kernel shape to cover the input dims\n for (let dim = 0; dim < inputDims.length - 2; dim++) {\n if (dim >= kernelShape.length) {\n kernelShape.push(inputDims[dim + 2]);\n } else {\n kernelShape[dim] = inputDims[dim + 2];\n }\n }\n }\n\n // adjust strides length to match kernel shape length\n for (let dim = 0; dim < kernelShape.length; dim++) {\n if (dim < strides.length) {\n if (strides[dim] < 0) {\n throw new Error('strides should be greater than or equal to 1');\n }\n } else {\n strides.push(1);\n }\n }\n\n // adjust dilation value\n for (let dim = 0; dim < kernelShape.length; dim++) {\n if (dim < dilations.length) {\n if (dilations[dim] < 0) {\n throw new Error('dilations should be greater than or equal to 1');\n }\n } else {\n dilations.push(1);\n }\n }\n\n // adjust pads length to match 2 * kernel shape length\n for (let dim = 0; dim < kernelShape.length * 2; dim++) {\n if (dim < pads.length) {\n if (pads[dim] < 0) {\n throw new Error('pad should be greater than or equal to 1');\n }\n } else {\n pads.push(0);\n }\n }\n\n // sanity checks for values in kernel shapes and pads\n for (let dim = 0; dim < kernelShape.length; dim++) {\n if (kernelShape[dim] <= 0) {\n throw new Error('kernel shapes need to be greater than 0');\n }\n\n if (pads[dim] >= kernelShape[dim] || pads[dim + kernelShape.length] >= kernelShape[dim]) {\n throw new Error('pads should be smaller than kernel');\n }\n }\n }\n\n // adjust pad values based on 'autoPad' attribute\n static adjustPadsBasedOnAutoPad(\n inputDims: readonly number[], strides: readonly number[], dilations: readonly number[],\n kernelShape: readonly number[], pads: number[], autoPad?: string) {\n if (!autoPad) {\n return;\n }\n\n if (pads.length !== 2 * (inputDims.length - 2)) {\n throw new Error('length of pads should be twice the length of data dimensions');\n }\n\n if (strides.length !== (inputDims.length - 2)) {\n throw new Error('length of strides should be the length of data dimensions');\n }\n\n if (kernelShape.length !== (inputDims.length - 2)) {\n throw new Error('length of kernel shapes should be the length of data dimensions');\n }\n\n for (let dim = 0; dim < inputDims.length - 2; dim++) {\n PoolConvUtil.adjustPadAndReturnShape(\n inputDims[dim + 2], strides[dim], dilations[dim], kernelShape[dim], pads, dim, dim + inputDims.length - 2,\n autoPad);\n }\n }\n\n /**\n * Calculate the output shape for Pool ops based on input attributes. (Should be used only for Pool ops)\n * @param isGlobalOperator If true, perform global pooling.\n * @param inputDims The input tensor dimension. (inputs[0].dims)\n * @param strides Stride along each axis.\n * @param dilations Dilation along each axis.\n * @param kernelShape The size of the kernel along each axis.\n * @param pads Padding for the beginning and ending along each axis.\n * @param autoPad DEPRECATED attribute supported for legacy models. Specifies how to implicitly calculate pads in each\n * dimension. Can take values NOTSET, SAME_UPPER, SAME_LOWER, or VALID.\n */\n static computePoolOutputShape(\n isGlobalOperator: boolean, inputDims: readonly number[], strides: number[], dilations: number[],\n kernelShape: number[], pads: number[], autoPad?: string): number[] {\n if (inputDims.length <= 0) {\n throw new Error('input shape must be of size greater than 0');\n }\n\n // Add batch size and number of channels of output\n const outputDims = [inputDims[0], inputDims[1]];\n\n PoolConvUtil.computeShapeHelper(\n isGlobalOperator, inputDims, outputDims, strides, dilations, kernelShape, pads, autoPad);\n return outputDims;\n }\n\n /**\n * Calculate the output shape for Conv op based on input attributes. (Should be used only for Conv op)\n * @param inputDims The input tensor dimension. (inputs[0].dims)\n * @param filterDims The filter tensor dimension. (inputs[1].dims)\n * @param strides Stride along each axis.\n * @param kernelShape The size of the kernel along each axis.\n * @param pads Padding for the beginning and ending along each axis.\n * @param autoPad DEPRECATED attribute supported for legacy models. Specifies how to implicitly calculate pads in each\n * dimension. Can take values NOTSET, SAME_UPPER, SAME_LOWER, or VALID.\n */\n static computeConvOutputShape(\n inputDims: readonly number[], filterDims: readonly number[], strides: number[], dilations: number[],\n kernelShape: number[], pads: number[], autoPad?: string): number[] {\n if (inputDims.length <= 0 || filterDims.length <= 0) {\n throw new Error('invalid input tensor dims or invalid filter tensor dims');\n }\n\n // Add batch size and number of channels of output\n const outputDims = [inputDims[0], filterDims[0]];\n\n PoolConvUtil.computeShapeHelper(false, inputDims, outputDims, strides, dilations, kernelShape, pads, autoPad);\n return outputDims;\n }\n\n // will compute output shapes for data dimensions ONLY (i.e.) no batch size and channels\n // called by computePoolOutputShape() and computeConvOutputShape()\n // adjust pads based on 'autoPad' attribute prior to shape computation\n private static computeShapeHelper(\n isGlobalOperator: boolean, inputDims: readonly number[], outputDims: number[], strides: readonly number[],\n dilations: readonly number[], kernelShape: readonly number[], pads: number[], autoPad?: string) {\n if (isGlobalOperator) {\n for (let dim = 0; dim < inputDims.length - 2; dim++) {\n outputDims.push(1);\n }\n } else {\n for (let dim = 0; dim < inputDims.length - 2; dim++) {\n outputDims.push(PoolConvUtil.adjustPadAndReturnShape(\n inputDims[dim + 2], strides[dim], dilations[dim], kernelShape[dim], pads, dim, dim + inputDims.length - 2,\n autoPad));\n }\n }\n }\n\n // helper for computeShapeHelper() and adjustPadsBasedOnAutoPad()\n // adjusts pad value for given 'autoPad' string and computes output shape along a particular dimension\n private static adjustPadAndReturnShape(\n inSize: number, stride: number, dilation: number, kernel: number, pads: number[], padHeadIndex: number,\n padTailIndex: number, autoPad?: string): number {\n const dkernel = dilation * (kernel - 1) + 1;\n if (autoPad && autoPad !== 'NOTSET') {\n switch (autoPad) {\n case 'VALID':\n pads[padHeadIndex] = 0;\n pads[padTailIndex] = 0;\n return Math.floor(((inSize - dkernel) / stride) + 1);\n case 'SAME_LOWER':\n case 'SAME_UPPER':\n if (dilation !== 1) {\n throw new Error('Dilation not supported for SAME_UPPER or SAME_LOWER');\n } else {\n const legacyTargetSize = (inSize + stride - 1) / stride;\n const padNeeded = (legacyTargetSize - 1) * stride + kernel - inSize;\n pads[padHeadIndex] =\n (autoPad === 'SAME_LOWER') ? Math.floor((padNeeded + 1) / 2) : Math.floor(padNeeded / 2);\n pads[padTailIndex] = padNeeded - pads[padHeadIndex];\n return Math.floor(((inSize + padNeeded - kernel) / stride) + 1);\n }\n default:\n throw new Error('Unsupported AutoPad type');\n }\n } else {\n return Math.floor(((inSize + pads[padHeadIndex] + pads[padTailIndex] - dkernel) / stride) + 1);\n }\n }\n}\n\nexport const MIN_CLIP = -3.4028234663852886e+38;\nexport const MAX_CLIP = 3.4028234663852886e+38;\n\nexport function decodeUtf8String(buffer: Uint8Array): string {\n return new TextDecoder().decode(buffer);\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Guid} from 'guid-typescript';\nimport Long from 'long';\n\nimport {onnxruntime} from './ort-schema/flatbuffers/ort-generated';\nimport {onnx} from './ort-schema/protobuf/onnx';\nimport {decodeUtf8String, ProtoUtil, ShapeUtil} from './util';\n\nimport ortFbs = onnxruntime.experimental.fbs;\n\nexport declare namespace Tensor {\n export interface DataTypeMap {\n bool: Uint8Array;\n float32: Float32Array;\n float64: Float64Array;\n string: string[];\n int8: Int8Array;\n uint8: Uint8Array;\n int16: Int16Array;\n uint16: Uint16Array;\n int32: Int32Array;\n uint32: Uint32Array;\n int64: BigInt64Array;\n }\n\n export type DataType = keyof DataTypeMap;\n\n export type StringType = Tensor.DataTypeMap['string'];\n export type BooleanType = Tensor.DataTypeMap['bool'];\n export type IntegerType = Tensor.DataTypeMap['int8']|Tensor.DataTypeMap['uint8']|Tensor.DataTypeMap['int16']|\n Tensor.DataTypeMap['uint16']|Tensor.DataTypeMap['int32']|Tensor.DataTypeMap['uint32'];\n export type FloatType = Tensor.DataTypeMap['float32']|Tensor.DataTypeMap['float64'];\n export type NumberType = BooleanType|IntegerType|FloatType;\n\n export type Id = Guid;\n}\n\ntype TensorData = Tensor.DataTypeMap[Tensor.DataType];\n\ntype DataProvider = (id: Tensor.Id) => TensorData;\ntype AsyncDataProvider = (id: Tensor.Id) => Promise;\n\nexport class Tensor {\n /**\n * get the underlying tensor data\n */\n get data(): TensorData {\n if (this.cache === undefined) {\n const data = this.dataProvider!(this.dataId);\n if (data.length !== this.size) {\n throw new Error('Length of data provided by the Data Provider is inconsistent with the dims of this Tensor.');\n }\n this.cache = data;\n }\n return this.cache;\n }\n\n /**\n * get the underlying string tensor data. Should only use when type is STRING\n */\n get stringData() {\n if (this.type !== 'string') {\n throw new TypeError('data type is not string');\n }\n\n return this.data as Tensor.StringType;\n }\n\n /**\n * get the underlying integer tensor data. Should only use when type is one of the following: (UINT8, INT8, UINT16,\n * INT16, INT32, UINT32, BOOL)\n */\n get integerData() {\n switch (this.type) {\n case 'uint8':\n case 'int8':\n case 'uint16':\n case 'int16':\n case 'int32':\n case 'uint32':\n case 'bool':\n return this.data as Tensor.IntegerType;\n\n default:\n throw new TypeError('data type is not integer (uint8, int8, uint16, int16, int32, uint32, bool)');\n }\n }\n\n /**\n * get the underlying float tensor data. Should only use when type is one of the following: (FLOAT, DOUBLE)\n */\n get floatData() {\n switch (this.type) {\n case 'float32':\n case 'float64':\n return this.data as Tensor.FloatType;\n\n default:\n throw new TypeError('data type is not float (float32, float64)');\n }\n }\n\n /**\n * get the underlying number tensor data. Should only use when type is one of the following: (UINT8, INT8, UINT16,\n * INT16, INT32, UINT32, BOOL, FLOAT, DOUBLE)\n */\n get numberData() {\n if (this.type !== 'string') {\n return this.data as Tensor.NumberType;\n }\n throw new TypeError('type cannot be non-number (string)');\n }\n\n /**\n * get value of an element at the given indices\n */\n get(indices: readonly number[]): Tensor.DataTypeMap[Tensor.DataType][number] {\n return this.data[ShapeUtil.indicesToOffset(indices, this.strides)];\n }\n\n /**\n * set value of an element at the given indices\n */\n set(indices: readonly number[], value: Tensor.DataTypeMap[Tensor.DataType][number]) {\n this.data[ShapeUtil.indicesToOffset(indices, this.strides)] = value;\n }\n\n /**\n * get the underlying tensor data asynchronously\n */\n async getData(): Promise {\n if (this.cache === undefined) {\n this.cache = await this.asyncDataProvider!(this.dataId);\n }\n return this.cache;\n }\n\n /**\n * get the number of elements in the tensor\n */\n public readonly size: number;\n\n private _strides: readonly number[];\n /**\n * get the strides for each dimension\n */\n get strides(): readonly number[] {\n if (!this._strides) {\n this._strides = ShapeUtil.computeStrides(this.dims);\n }\n return this._strides;\n }\n\n constructor(\n /**\n * get the dimensions of the tensor\n */\n public readonly dims: readonly number[],\n /**\n * get the type of the tensor\n */\n public readonly type: Tensor.DataType, private dataProvider?: DataProvider,\n private asyncDataProvider?: AsyncDataProvider, private cache?: TensorData,\n /**\n * get the data ID that used to map to a tensor data\n */\n public readonly dataId: Guid = Guid.create()) {\n this.size = ShapeUtil.validateDimsAndCalcSize(dims);\n const size = this.size;\n const empty = (dataProvider === undefined && asyncDataProvider === undefined && cache === undefined);\n\n if (cache !== undefined) {\n if (cache.length !== size) {\n throw new RangeError('Input dims doesn\\'t match data length.');\n }\n }\n\n if (type === 'string') {\n if (cache !== undefined && (!Array.isArray(cache) || !cache.every(i => typeof i === 'string'))) {\n throw new TypeError('cache should be a string array');\n }\n\n if (empty) {\n this.cache = new Array(size);\n }\n } else {\n if (cache !== undefined) {\n const constructor = dataviewConstructor(type);\n if (!(cache instanceof constructor)) {\n throw new TypeError(`cache should be type ${constructor.name}`);\n }\n }\n\n if (empty) {\n const buf = new ArrayBuffer(size * sizeof(type));\n this.cache = createView(buf, type);\n }\n }\n }\n\n /**\n * Construct new Tensor from a ONNX Tensor object\n * @param tensorProto the ONNX Tensor\n */\n static fromProto(tensorProto: onnx.ITensorProto): Tensor {\n if (!tensorProto) {\n throw new Error('cannot construct Value from an empty tensor');\n }\n const type = ProtoUtil.tensorDataTypeFromProto(tensorProto.dataType!);\n const dims = ProtoUtil.tensorDimsFromProto(tensorProto.dims!);\n\n const value = new Tensor(dims, type);\n\n if (type === 'string') {\n // When it's STRING type, the value should always be stored in field\n // 'stringData'\n tensorProto.stringData!.forEach((str, i) => {\n value.data[i] = decodeUtf8String(str);\n });\n\n } else if (\n tensorProto.rawData && typeof tensorProto.rawData.byteLength === 'number' &&\n tensorProto.rawData.byteLength > 0) {\n // NOT considering segment for now (IMPORTANT)\n\n // populate value from rawData\n const dataDest = value.data;\n const dataSource =\n new DataView(tensorProto.rawData.buffer, tensorProto.rawData.byteOffset, tensorProto.rawData.byteLength);\n const elementSize = sizeofProto(tensorProto.dataType!);\n const length = tensorProto.rawData.byteLength / elementSize;\n\n if (tensorProto.rawData.byteLength % elementSize !== 0) {\n throw new Error('invalid buffer length');\n }\n if (dataDest.length !== length) {\n throw new Error('buffer length mismatch');\n }\n\n for (let i = 0; i < length; i++) {\n const n = readProto(dataSource, tensorProto.dataType!, i * elementSize);\n dataDest[i] = n;\n }\n } else {\n // populate value from array\n let array: Array;\n switch (tensorProto.dataType) {\n case onnx.TensorProto.DataType.FLOAT:\n array = tensorProto.floatData!;\n break;\n case onnx.TensorProto.DataType.INT32:\n case onnx.TensorProto.DataType.INT16:\n case onnx.TensorProto.DataType.UINT16:\n case onnx.TensorProto.DataType.INT8:\n case onnx.TensorProto.DataType.UINT8:\n case onnx.TensorProto.DataType.BOOL:\n array = tensorProto.int32Data!;\n break;\n case onnx.TensorProto.DataType.INT64:\n array = tensorProto.int64Data!;\n break;\n case onnx.TensorProto.DataType.DOUBLE:\n array = tensorProto.doubleData!;\n break;\n case onnx.TensorProto.DataType.UINT32:\n case onnx.TensorProto.DataType.UINT64:\n array = tensorProto.uint64Data!;\n break;\n default:\n // should never run here\n throw new Error('unspecific error');\n }\n\n if (array === null || array === undefined) {\n throw new Error('failed to populate data from a tensorproto value');\n }\n\n const data = value.data;\n if (data.length !== array.length) {\n throw new Error('array length mismatch');\n }\n\n for (let i = 0; i < array.length; i++) {\n const element = array[i];\n if (Long.isLong(element)) {\n data[i] = longToNumber(element, tensorProto.dataType);\n } else {\n data[i] = element;\n }\n }\n }\n\n return value;\n }\n\n /**\n * Construct new Tensor from raw data\n * @param data the raw data object. Should be a string array for 'string' tensor, and the corresponding typed array\n * for other types of tensor.\n * @param dims the dimensions of the tensor\n * @param type the type of the tensor\n */\n static fromData(data: Tensor.DataTypeMap[Tensor.DataType], dims: readonly number[], type: Tensor.DataType) {\n return new Tensor(dims, type, undefined, undefined, data);\n }\n\n static fromOrtTensor(ortTensor: ortFbs.Tensor) {\n if (!ortTensor) {\n throw new Error('cannot construct Value from an empty tensor');\n }\n const dims = ProtoUtil.tensorDimsFromORTFormat(ortTensor);\n const type = ProtoUtil.tensorDataTypeFromProto(ortTensor.dataType());\n\n const value = new Tensor(dims, type);\n\n if (type === 'string') {\n // When it's STRING type, the value should always be stored in field\n // 'stringData'\n for (let i = 0; i < ortTensor.stringDataLength(); i++) {\n value.data[i] = ortTensor.stringData(i);\n }\n\n } else if (\n ortTensor.rawDataArray() && typeof ortTensor.rawDataLength() === 'number' && ortTensor.rawDataLength() > 0) {\n // NOT considering segment for now (IMPORTANT)\n\n // populate value from rawData\n const dataDest = value.data;\n const dataSource = new DataView(\n ortTensor.rawDataArray()!.buffer, ortTensor.rawDataArray()!.byteOffset, ortTensor.rawDataLength());\n const elementSize = sizeofProto(ortTensor.dataType());\n const length = ortTensor.rawDataLength() / elementSize;\n\n if (ortTensor.rawDataLength() % elementSize !== 0) {\n throw new Error('invalid buffer length');\n }\n if (dataDest.length !== length) {\n throw new Error('buffer length mismatch');\n }\n\n for (let i = 0; i < length; i++) {\n const n = readProto(dataSource, ortTensor.dataType(), i * elementSize);\n dataDest[i] = n;\n }\n }\n return value;\n }\n}\n\nfunction sizeof(type: Tensor.DataType): number {\n switch (type) {\n case 'bool':\n case 'int8':\n case 'uint8':\n return 1;\n case 'int16':\n case 'uint16':\n return 2;\n case 'int32':\n case 'uint32':\n case 'float32':\n return 4;\n case 'float64':\n return 8;\n default:\n throw new Error(`cannot calculate sizeof() on type ${type}`);\n }\n}\n\nfunction sizeofProto(type: onnx.TensorProto.DataType|ortFbs.TensorDataType): number {\n switch (type) {\n case onnx.TensorProto.DataType.UINT8:\n case onnx.TensorProto.DataType.INT8:\n case onnx.TensorProto.DataType.BOOL:\n return 1;\n case onnx.TensorProto.DataType.UINT16:\n case onnx.TensorProto.DataType.INT16:\n return 2;\n case onnx.TensorProto.DataType.FLOAT:\n case onnx.TensorProto.DataType.INT32:\n case onnx.TensorProto.DataType.UINT32:\n return 4;\n case onnx.TensorProto.DataType.INT64:\n case onnx.TensorProto.DataType.DOUBLE:\n case onnx.TensorProto.DataType.UINT64:\n return 8;\n default:\n throw new Error(`cannot calculate sizeof() on type ${onnx.TensorProto.DataType[type]}`);\n }\n}\n\nfunction createView(dataBuffer: ArrayBuffer, type: Tensor.DataType) {\n return new (dataviewConstructor(type))(dataBuffer);\n}\n\nfunction dataviewConstructor(type: Tensor.DataType) {\n switch (type) {\n case 'bool':\n case 'uint8':\n return Uint8Array;\n case 'int8':\n return Int8Array;\n case 'int16':\n return Int16Array;\n case 'uint16':\n return Uint16Array;\n case 'int32':\n return Int32Array;\n case 'uint32':\n return Uint32Array;\n case 'int64':\n return BigInt64Array;\n case 'float32':\n return Float32Array;\n case 'float64':\n return Float64Array;\n default:\n // should never run to here\n throw new Error('unspecified error');\n }\n}\n\n// convert a long number to a 32-bit integer (cast-down)\nfunction longToNumber(i: Long, type: onnx.TensorProto.DataType|ortFbs.TensorDataType): number {\n // INT64, UINT32, UINT64\n if (type === onnx.TensorProto.DataType.INT64 || type === ortFbs.TensorDataType.INT64) {\n if (i.greaterThanOrEqual(2147483648) || i.lessThan(-2147483648)) {\n throw new TypeError('int64 is not supported');\n }\n } else if (\n type === onnx.TensorProto.DataType.UINT32 || type === ortFbs.TensorDataType.UINT32 ||\n type === onnx.TensorProto.DataType.UINT64 || type === ortFbs.TensorDataType.UINT64) {\n if (i.greaterThanOrEqual(4294967296) || i.lessThan(0)) {\n throw new TypeError('uint64 is not supported');\n }\n } else {\n throw new TypeError(`not a LONG type: ${onnx.TensorProto.DataType[type]}`);\n }\n\n return i.toNumber();\n}\n\n// read one value from TensorProto\nfunction readProto(view: DataView, type: onnx.TensorProto.DataType|ortFbs.TensorDataType, byteOffset: number): number {\n switch (type) {\n case onnx.TensorProto.DataType.BOOL:\n case onnx.TensorProto.DataType.UINT8:\n return view.getUint8(byteOffset);\n case onnx.TensorProto.DataType.INT8:\n return view.getInt8(byteOffset);\n case onnx.TensorProto.DataType.UINT16:\n return view.getUint16(byteOffset, true);\n case onnx.TensorProto.DataType.INT16:\n return view.getInt16(byteOffset, true);\n case onnx.TensorProto.DataType.FLOAT:\n return view.getFloat32(byteOffset, true);\n case onnx.TensorProto.DataType.INT32:\n return view.getInt32(byteOffset, true);\n case onnx.TensorProto.DataType.UINT32:\n return view.getUint32(byteOffset, true);\n case onnx.TensorProto.DataType.INT64:\n return longToNumber(\n Long.fromBits(view.getUint32(byteOffset, true), view.getUint32(byteOffset + 4, true), false), type);\n case onnx.TensorProto.DataType.DOUBLE:\n return view.getFloat64(byteOffset, true);\n case onnx.TensorProto.DataType.UINT64:\n return longToNumber(\n Long.fromBits(view.getUint32(byteOffset, true), view.getUint32(byteOffset + 4, true), true), type);\n default:\n throw new Error(`cannot read from DataView for type ${onnx.TensorProto.DataType[type]}`);\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\n/**\n * represent a version irrelevant abstraction of for GLSL source code\n */\nexport interface Glsl {\n readonly version: string;\n readonly attribute: string;\n readonly varyingVertex: string;\n readonly varyingFrag: string;\n readonly texture2D: string;\n readonly output: string;\n readonly outputDeclaration: string;\n}\n\nconst GLSL_ES_2_0: Glsl = {\n version: '',\n attribute: 'attribute',\n varyingVertex: 'varying',\n varyingFrag: 'varying',\n texture2D: 'texture2D',\n output: 'gl_FragColor',\n outputDeclaration: '',\n};\nconst GLSL_ES_3_0: Glsl = {\n version: '#version 300 es',\n attribute: 'in',\n varyingVertex: 'out',\n varyingFrag: 'in',\n texture2D: 'texture',\n output: 'outputColor',\n outputDeclaration: 'out vec4 outputColor;',\n};\n\nexport function getGlsl(version: 1|2) {\n return version === 1 ? GLSL_ES_2_0 : GLSL_ES_3_0;\n}\n\nexport function getVertexShaderSource(version: 1|2): string {\n const glsl = getGlsl(version);\n return `${glsl.version}\n precision highp float;\n ${glsl.attribute} vec3 position;\n ${glsl.attribute} vec2 textureCoord;\n\n ${glsl.varyingVertex} vec2 TexCoords;\n\n void main()\n {\n gl_Position = vec4(position, 1.0);\n TexCoords = textureCoord;\n }`;\n}\n\nexport function getFragShaderPreamble(version: 1|2): string {\n const glsl = getGlsl(version);\n return `${glsl.version}\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n ${glsl.varyingFrag} vec2 TexCoords;\n ${glsl.outputDeclaration}\n const vec2 halfCR = vec2(0.5, 0.5);\n\n // Custom vector types to handle higher dimenalities.\n struct ivec5\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n };\n\n struct ivec6\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n int v;\n };\n\n int imod(int x, int y) {\n return x - y * (x / y);\n }\n\n `;\n}\n\nexport function getDefaultFragShaderMain(version: 1|2, outputShapeLength: number): string {\n const glsl = getGlsl(version);\n return `\n void main() {\n int indices[${outputShapeLength}];\n toVec(TexCoords, indices);\n vec4 result = vec4(process(indices));\n ${glsl.output} = result;\n }\n `;\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Tensor} from '../../tensor';\n\n/**\n * Layout info is used for mapping n-dimensional array to 2D textures\n * The layout is created by the TextureLayoutStrategy based on\n * the Tensor's dimensions and strides\n */\nexport interface TextureLayout {\n width: number;\n height: number;\n /**\n * specify the number of value that encoded in a single pixel\n */\n channels: 1|2|3|4;\n /**\n * whether in packed mode or not\n */\n isPacked?: boolean;\n /**\n * the normalized shape\n */\n shape: readonly number[];\n /**\n * the stride of each dimensions, calculated according to shape\n */\n strides: readonly number[];\n /**\n * the original shape(dims) of the corresponding tensor\n */\n unpackedShape: readonly number[];\n\n reversedWH?: boolean;\n}\nexport interface TextureData extends TextureLayout {\n tensor: Tensor;\n texture: WebGLTexture;\n}\n\nexport enum TextureType {\n unpacked, // <-- normal unpacked texture\n unpackedReversed, // <-- unpacked texture used in old ONNX.js implementation (deprecated)\n packed, // <-- normal packed texture\n downloadUint8AsFloat, // <-- ONLY used in texture downloading for iOS devices\n packedLastDimension // <-- ONLY used in old ONNX.js Conv implementation for input W (deprecated)\n}\n\nexport interface TensorInfo {\n id?: Tensor.Id;\n dims: readonly number[];\n type: Tensor.DataType;\n textureType: TextureType;\n}\n\nexport interface ProgramVariable {\n type: 'float'|'int';\n name: string;\n arrayLength?: number;\n data: number|number[];\n}\n\n/**\n * A set of metadata of a shader program.\n */\nexport interface ProgramMetadata {\n /**\n * the name of the program. used for debugging and profiling\n */\n name: string;\n /**\n * texture types for each input\n */\n inputTypes: TextureType[];\n /**\n * names of each input\n */\n inputNames: string[];\n /**\n * an optional string as a cache hint in the artifact cache\n */\n cacheHint?: string;\n}\n\n/**\n * A ProgramInfoLoader allows\n */\nexport interface ProgramInfoLoader extends ProgramMetadata {\n /**\n * a function to get the program info\n */\n get(): ProgramInfo;\n}\n\n/**\n * A set of data that represent a shader program\n */\nexport interface ProgramInfo extends ProgramMetadata {\n /**\n * information of uniform variables\n */\n variables?: ProgramVariable[];\n /**\n * tensor info for output\n */\n output: TensorInfo;\n /**\n * the shader's processing source code\n */\n shaderSource: string;\n /**\n * whether the shader source contains a customized main function implementation\n */\n hasMain?: boolean;\n}\n\nexport interface VariableInfo {\n type: 'float'|'int';\n name: string;\n arrayLength?: number;\n}\n\nexport interface ProgramVariable {\n type: 'float'|'int';\n name: string;\n arrayLength?: number;\n data: number|number[];\n}\n\n/**\n * Information of uniforms that shader uses\n */\nexport interface UniformInfo {\n type: 'sampler2D'|VariableInfo['type'];\n name: string;\n arrayLength?: number;\n}\n\nexport interface UniformLocation extends UniformInfo {\n location: WebGLUniformLocation;\n}\n\n/**\n * Artifact is the result of compilation\n * It does not contain input of output data\n * However anything that could be run as a \"program\"\n */\nexport interface Artifact {\n programInfo: ProgramInfo;\n program: WebGLProgram;\n uniformLocations: UniformLocation[];\n attribLocations: {position: number; textureCoord: number};\n}\nexport declare namespace Artifact {\n type UniformLocations = Artifact['uniformLocations'];\n type AttribLocations = Artifact['attribLocations'];\n}\n\nexport interface UniformData {\n [name: string]: number|number[];\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {assert} from '../../util';\n/**\n * Given a non RGBA shape calculate the R version\n * It is assumed that the dimensions are multiples of given channels\n * NOTE: it is always the last dim that gets packed.\n * @param unpackedShape original shape to create a packed version from\n */\nexport function getPackedShape(unpackedShape: readonly number[]): readonly number[] {\n const len = unpackedShape.length;\n return unpackedShape.slice(0, len - 1).concat(unpackedShape[len - 1] / 4);\n}\n\nexport async function repeatedTry(\n checkFn: () => boolean, delayFn = (_counter: number) => 0, maxCounter?: number): Promise {\n return new Promise((resolve, reject) => {\n let tryCount = 0;\n\n const tryFn = () => {\n if (checkFn()) {\n resolve();\n return;\n }\n\n tryCount++;\n\n const nextBackoff = delayFn(tryCount);\n\n if (maxCounter != null && tryCount >= maxCounter) {\n reject();\n return;\n }\n setTimeout(tryFn, nextBackoff);\n };\n\n tryFn();\n });\n}\n\n/**\n * Generates the function name from an input sampler name.\n * @param samplerName Name of the sampler.\n */\nexport function generateShaderFuncNameFromInputSamplerName(samplerName: string): string {\n assert(typeof samplerName !== 'undefined' && samplerName.length !== 0, () => 'empty string found for sampler name');\n return 'get' + samplerName.charAt(0).toUpperCase() + samplerName.slice(1);\n}\n\n/**\n * Generates the function name from an input sampler name at output coordinates.\n * @param samplerName Name of the sampler.\n */\nexport function generateShaderFuncNameFromInputSamplerNameAtOutCoords(samplerName: string): string {\n assert(typeof samplerName !== 'undefined' && samplerName.length !== 0, () => 'empty string found for sampler name');\n return 'get' + samplerName.charAt(0).toUpperCase() + samplerName.slice(1) + 'AtOutCoords';\n}\n\n/** Returns a new input shape (a copy) that has a squeezed logical shape. */\nexport function squeezeInputShape(inputShape: readonly number[], squeezedShape: number[]): number[] {\n // Deep copy.\n let newInputShape: number[] = JSON.parse(JSON.stringify(inputShape));\n newInputShape = squeezedShape;\n return newInputShape;\n}\n\n/** Returns a list of squeezed parameters for shader functions */\nexport function getSqueezedParams(params: string[], keptDims: number[]): string {\n return keptDims.map(d => params[d]).join(', ');\n}\n\n/** Returns the data type for different ranks. */\nexport function getCoordsDataType(rank: number): string {\n if (rank <= 1) {\n return 'int';\n } else if (rank === 2) {\n return 'ivec2';\n } else if (rank === 3) {\n return 'ivec3';\n } else if (rank === 4) {\n return 'ivec4';\n } else if (rank === 5) {\n return 'ivec5';\n } else if (rank === 6) {\n return 'ivec6';\n } else {\n throw Error(`GPU for rank ${rank} is not yet supported`);\n }\n}\n\nexport function getGlChannels(rank = 6): string[] {\n return ['x', 'y', 'z', 'w', 'u', 'v'].slice(0, rank);\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {getGlChannels} from '../utils';\n\nexport function getVecChannels(name: string, rank: number): string[] {\n return getGlChannels(rank).map(d => `${name}.${d}`);\n}\n\nexport function getChannels(name: string, rank: number): string[] {\n if (rank === 1) {\n return [name];\n }\n return getVecChannels(name, rank);\n}\n\nexport function unpackFromChannel(): string {\n return `\n float getChannel(vec4 frag, int dim) {\n int modCoord = imod(dim, 2);\n return modCoord == 0 ? frag.r : frag.g;\n }\n\n float getChannel(vec4 frag, vec2 innerDims) {\n vec2 modCoord = mod(innerDims, 2.);\n return modCoord.x == 0. ?\n (modCoord.y == 0. ? frag.r : frag.g) :\n (modCoord.y == 0. ? frag.b : frag.a);\n }\n `;\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Tensor} from '../../../tensor';\nimport {getGlsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, TextureType} from '../types';\nimport {getCoordsDataType} from '../utils';\n\nimport {getChannels} from './packing-utils';\n\nconst packProgramMetadata = {\n name: 'pack',\n inputNames: ['A'],\n inputTypes: [TextureType.unpackedReversed]\n};\n\nconst createPackProgramInfo = (handler: WebGLInferenceHandler, input: Tensor): ProgramInfo => {\n const glsl = getGlsl(handler.session.backend.glContext.version);\n const inputShape = input.dims;\n\n const inputRank = inputShape.length;\n // createTextureLayoutFromShape won't change output rank. Need to verify by running tests\n const outputRank = input.dims.length;\n\n const coordsDataType = getCoordsDataType(outputRank);\n const channels = getChannels('rc', outputRank);\n const setup = getSetup(outputRank, channels, inputShape[inputShape.length - 2], inputShape[inputShape.length - 1]);\n\n let reversedInputWH;\n if (inputRank === 0) {\n reversedInputWH = [1, 1];\n } else if (inputRank === 1) {\n reversedInputWH = [inputShape[0], 1];\n } else {\n reversedInputWH = [inputShape[outputRank - 1], inputShape[outputRank - 2]];\n }\n const outOfBoundsCondition = getOutOfBoundsCondition(outputRank, reversedInputWH, channels);\n const output = getOutput(inputShape, channels);\n\n const shaderSource = `\n void main() {\n ${coordsDataType} rc = getOutputCoords();\n\n if(${outOfBoundsCondition}) {\n ${glsl.output} = vec4(0);\n } else {\n ${setup}\n\n ${glsl.output} = vec4(${output});\n }\n }\n `;\n return {\n ...packProgramMetadata,\n hasMain: true,\n output: {dims: input.dims, type: input.type, textureType: TextureType.packed},\n shaderSource\n };\n};\n\nexport const createPackProgramInfoLoader = (handler: WebGLInferenceHandler, input: Tensor): ProgramInfoLoader =>\n ({...packProgramMetadata, get: () => createPackProgramInfo(handler, input)});\n\n/**\n * check output coordinate location and return false if it is outside input's width/height boundary\n */\nfunction getOutOfBoundsCondition(rank: number, shape: readonly number[], dims: string[]): string {\n if (rank === 0) {\n return 'false';\n }\n if (rank === 1) {\n return `rc > ${shape[0]}`;\n }\n\n let cond = '';\n for (let i = rank - 2; i < rank; i++) {\n cond += `${dims[i]} >= ${shape[i - rank + 2]}`;\n if (i < rank - 1) {\n cond += '||';\n }\n }\n\n return cond;\n}\n\n/**\n * code snippet to sample input texture with output coordinates\n */\nfunction getOutput(shape: readonly number[], dims: string[]): string {\n const rank = shape.length;\n\n if (rank === 0) {\n return 'getA(), 0, 0, 0';\n }\n\n if (rank === 1) {\n return `getA(rc),\n rc + 1 >= ${shape[0]} ? 0. : getA(rc + 1),\n 0, 0`;\n }\n\n const coord00 = 'r, c';\n const coord01 = 'r, cp1';\n const coord10 = 'rp1, c';\n const coord11 = 'rp1, cp1';\n let D = '';\n if (rank > 2) {\n for (let i = 0; i < rank - 2; ++i) {\n D = D + `${dims[i]},`;\n }\n }\n return `getA(${D}${coord00}),\n rEdge ? 0. : getA(${D}${coord10}),\n cEdge ? 0. : getA(${D}${coord01}),\n rEdge || cEdge ? 0. : getA(${D}${coord11})`;\n}\n\n/**\n * code snippet to setup 4 coordinates and edge conditions\n */\nfunction getSetup(rank: number, dims: string[], rows: number, cols: number): string {\n if (rank === 0 || rank === 1) {\n return '';\n }\n // rank >= 2 for width+height pack.\n else {\n const setup = `\n int r = ${dims[rank - 2]};\n int c = ${dims[rank - 1]};\n int rp1 = ${dims[rank - 2]} + 1;\n int cp1 = ${dims[rank - 1]} + 1;\n bool rEdge = rp1 >= ${cols};\n bool cEdge = cp1 >= ${rows};\n `;\n return setup;\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Tensor} from '../../../tensor';\nimport {ShapeUtil} from '../../../util';\nimport {getGlsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, ProgramMetadata, TextureType} from '../types';\n\nimport {unpackFromChannel} from './packing-utils';\n\nconst createPackedReshape3DProgramMetadata = (outputShape3D: readonly number[]) =>\n ({name: 'Reshape (packed)', inputTypes: [TextureType.packed], inputNames: ['A'], cacheHint: `${outputShape3D}`});\n\nconst createPackedReshape3DProgramInfo =\n (handler: WebGLInferenceHandler, input3D: Tensor, metadata: ProgramMetadata, outputShape3D: readonly number[]):\n ProgramInfo => {\n const inputShape3D = input3D.dims as [number, number, number];\n const squeezedOutputShape = outputShape3D as [number, number, number];\n\n let mainLoop = '';\n for (let i = 0; i < 4; i++) {\n let outputCoords = '';\n switch (i) {\n case 0:\n outputCoords = 'outputCoords = rc;';\n break;\n case 1:\n outputCoords = 'outputCoords = ivec3(rc.x, rc.y+1, rc.z);';\n break;\n case 2:\n outputCoords = 'outputCoords = ivec3(rc.x, rc.y, rc.z+1);';\n break;\n case 3:\n outputCoords = 'outputCoords = ivec3(rc.x, rc.y+1, rc.z+1);';\n break;\n default:\n throw new Error();\n }\n\n mainLoop += `\n ${outputCoords}\n ${i > 0 ? 'if(outputCoords.y < rows && outputCoords.z < cols){' : ''}\n int flattenedIndex = getFlattenedIndex(outputCoords);\n\n ivec3 inputRC = inputCoordsFromReshapedOutCoords(flattenedIndex);\n vec2 innerDims = vec2(float(inputRC.y),float(inputRC.z));\n\n result[${i}] = getChannel(getA(inputRC.x, inputRC.y, inputRC.z), innerDims);\n\n ${i > 0 ? '}' : ''}\n `;\n }\n const glsl = getGlsl(handler.session.backend.glContext.version);\n\n const shaderSource = `\n ${getReshapedInputCoords(inputShape3D)}\n ${getFlattenedIndexFrom3D(squeezedOutputShape)}\n ${unpackFromChannel()}\n\n void main() {\n ivec3 rc = getOutputCoords();\n\n vec4 result = vec4(0.0);\n\n ivec3 outputCoords;\n int rows = ${squeezedOutputShape[2]};\n int cols = ${squeezedOutputShape[1]};\n\n ${mainLoop}\n ${glsl.output} = result;\n }\n `;\n\n return {\n ...metadata,\n output: {dims: squeezedOutputShape, type: input3D.type, textureType: TextureType.packed},\n shaderSource,\n hasMain: true\n };\n };\n\nexport const createPackedReshape3DProgramInfoLoader =\n (handler: WebGLInferenceHandler, input3D: Tensor, outputShape3D: readonly number[]): ProgramInfoLoader => {\n const metadata = createPackedReshape3DProgramMetadata(outputShape3D);\n return {...metadata, get: () => createPackedReshape3DProgramInfo(handler, input3D, metadata, outputShape3D)};\n };\n\nexport function processDims3D(shape: ArrayLike): [number, number, number] {\n if (shape.length === 0) {\n return [1, 1, 1];\n }\n // TODO: squeeze other shapes to 2D case\n let batch = 1;\n for (let i = 0; i < shape.length - 2; ++i) {\n batch *= shape[i];\n }\n return [batch, shape.length > 1 ? shape[shape.length - 2] : 1, shape[shape.length - 1]];\n}\n\n// For packed reshape, we need to re-arrange texel data for output shape.\n// Our pack is designed to pack a 2x2 tile in last h and w dimension, so\n// for the reshaped new tensor, we just need to re-arrange the last h and\n// w dimension. For any shape that is not in 3D, i.e. [batch, W, H], we\n// first convert it to 3D by collapsing other dimension to batch dim, then\n// process with the last two dimensions.\n// Note: we only need the shape tensor to calculate output shape, so the\n// content in shape tensor is never uploaded to GPU. It is always kept in CPU.\n// TODO: optimize the algorithm -- in some cases, if the last two dims are\n// the same between input shape and output shape, the packed reshape can be\n// treated as no-op.\nexport function isReshapeCheap(dims: readonly number[], reshapedDims: readonly number[]) {\n let isCheapReshape = false;\n if (dims.length === 0 || reshapedDims.length === 0) { // scalar\n isCheapReshape = true;\n } else if (dims.length < 2 || reshapedDims.length < 2) { // 1D\n isCheapReshape = dims[dims.length - 1] === reshapedDims[reshapedDims.length - 1];\n } else { // 2D +\n isCheapReshape = dims[dims.length - 1] === reshapedDims[reshapedDims.length - 1] &&\n dims[dims.length - 2] === reshapedDims[reshapedDims.length - 2];\n }\n\n return isCheapReshape;\n}\n\nfunction getReshapedInputCoords(shape: [number, number, number]): string {\n const strides = ShapeUtil.computeStrides(shape);\n const coords = ['b', 'r', 'c'];\n const index = 'index';\n const coordsFromIndexSnippet = strides\n .map((stride, i) => {\n const line1 = `int ${coords[i]} = ${index} / ${stride}`;\n const line2 = i === strides.length - 1 ?\n `int ${coords[i + 1]} = ${index} - ${coords[i]} * ${stride}` :\n `index -= ${coords[i]} * ${stride}`;\n return `${line1}; ${line2};`;\n })\n .join('');\n\n return `\n ivec3 inputCoordsFromReshapedOutCoords(int index) {\n ${coordsFromIndexSnippet}\n return ivec3(b, r, c);\n }\n `;\n}\n\nfunction getFlattenedIndexFrom3D(shape: [number, number, number]): string {\n const strides = ShapeUtil.computeStrides(shape);\n\n return `\n int getFlattenedIndex(ivec3 coords) {\n // reverse y, z order\n return coords.x * ${strides[0]} + coords.z * ${strides[1]} + coords.y;\n }\n`;\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {getGlsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {TextureData, TextureType} from '../types';\n\nexport const encodeAsUint8 = (inferenceHandler: WebGLInferenceHandler, input: TextureData): TextureData => {\n const outputShape = input.shape;\n const glsl = getGlsl(inferenceHandler.session.backend.glContext.version);\n /**\n * https://github.com/tensorflow/tfjs-core/blob/master/src/kernels/webgl/encode_float_gpu.ts\n */\n const shaderSource = `\n const float FLOAT_MAX = 1.70141184e38;\n const float FLOAT_MIN = 1.17549435e-38;\n\n bool isNaN(float val) {\n return (val < 1.0 || 0.0 < val || val == 0.0) ? false : true;\n }\n\n highp vec4 encodeAsUint8(highp float v) {\n if (isNaN(v)) {\n return vec4(255, 255, 255, 255);\n }\n\n highp float av = abs(v);\n\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 255.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n highp float e = floor(log2(av));\n highp float m = exp2(fract(log2(av))) - 1.0;\n\n c[2] = floor(128.0 * m);\n m -= c[2] / 128.0;\n c[1] = floor(32768.0 * m);\n m -= c[1] / 32768.0;\n c[0] = floor(8388608.0 * m);\n\n highp float ebias = e + 127.0;\n c[3] = floor(ebias / 2.0);\n ebias -= c[3] * 2.0;\n c[2] += floor(ebias) * 128.0;\n\n c[3] += 128.0 * step(0.0, -v);\n\n return c / 255.0;\n }\n\n void main() {\n float value = ${glsl.texture2D}(X,TexCoords).r;\n ${glsl.output} = encodeAsUint8(value);\n }`;\n const programInfo = {\n name: 'Uint8Encode',\n inputTypes: [TextureType.unpacked],\n inputNames: ['X'],\n output: {dims: outputShape, type: input.tensor.type, textureType: TextureType.downloadUint8AsFloat},\n shaderSource,\n hasMain: true\n };\n return inferenceHandler.executeProgram(programInfo, [input.tensor]);\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Tensor} from '../../../tensor';\nimport {getGlsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, TextureType} from '../types';\nimport {getCoordsDataType} from '../utils';\n\nimport {getChannels, unpackFromChannel} from './packing-utils';\n\nconst unpackProgramMetadata = {\n name: 'unpack',\n inputNames: ['A'],\n inputTypes: [TextureType.packed]\n};\n\nexport const createUnpackProgramInfo = (handler: WebGLInferenceHandler, input: Tensor): ProgramInfo => {\n const rank = input.dims.length;\n\n const channels = getChannels('rc', rank);\n const innerDims = channels.slice(-2);\n const coordsDataType = getCoordsDataType(rank);\n const unpackChannel = unpackFromChannel();\n const isScalar = (input.dims.length === 0);\n const sourceCoords = isScalar ? '' : getSourceCoords(rank, channels);\n const coords = rank <= 1 ? 'rc' : `vec2(${innerDims.join(',')})`;\n const glsl = getGlsl(handler.session.backend.glContext.version);\n const shaderSource = `\n ${unpackChannel}\n void main() {\n ${coordsDataType} rc = getOutputCoords();\n\n // Sample the texture with the coords to get the rgba channel value.\n vec4 packedInput = getA(${sourceCoords});\n\n ${glsl.output} = vec4(getChannel(packedInput, ${coords}), 0, 0, 0);\n }\n `;\n\n return {\n ...unpackProgramMetadata,\n hasMain: true,\n output: {dims: input.dims, type: input.type, textureType: TextureType.unpacked},\n shaderSource\n };\n};\n\nexport const createUnpackProgramInfoLoader = (handler: WebGLInferenceHandler, input: Tensor): ProgramInfoLoader =>\n ({...unpackProgramMetadata, get: () => createUnpackProgramInfo(handler, input)});\n\nfunction getSourceCoords(rank: number, dims: string[]): string {\n if (rank === 1) {\n return 'rc';\n }\n\n let coords = '';\n for (let i = 0; i < rank; i++) {\n coords += dims[i];\n if (i < rank - 1) {\n coords += ',';\n }\n }\n return coords;\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Logger} from '../../instrument';\n\nexport declare namespace Encoder {\n export interface DataTypeMap {\n float: Float32Array;\n byte: Uint8Array;\n int: Uint32Array;\n }\n export type DataType = keyof DataTypeMap;\n type DataArrayType = DataTypeMap[DataType];\n}\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport const enum EncoderUsage {\n Default = 0,\n UploadOnly,\n Download4BytesAsFloat32,\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\n/**\n * Abstraction for mapping data types to texture texlets\n * Encoding means how a Float32 is mapped to 1 or 4 channels for each texlet\n * Decoding means how a texlet's channels are mapped to a resulting Float32\n */\nexport interface DataEncoder {\n internalFormat: number;\n format: number;\n textureType: number;\n channelSize: number;\n encode(src: Encoder.DataArrayType, textureSize: number): Encoder.DataArrayType;\n allocate(size: number): Encoder.DataArrayType;\n decode(buffer: Encoder.DataArrayType, dataSize: number): Encoder.DataArrayType;\n}\n/**\n * WebGL2 data encoder\n * Uses R32F as the format for texlet\n */\nexport class RedFloat32DataEncoder implements DataEncoder {\n internalFormat: number;\n format: number;\n textureType: number;\n channelSize: number;\n constructor(gl: WebGL2RenderingContext, channels = 1) {\n if (channels === 1) {\n this.internalFormat = gl.R32F;\n this.format = gl.RED;\n this.textureType = gl.FLOAT;\n this.channelSize = channels;\n } else if (channels === 4) {\n this.internalFormat = gl.RGBA32F;\n this.format = gl.RGBA;\n this.textureType = gl.FLOAT;\n this.channelSize = channels;\n } else {\n throw new Error(`Invalid number of channels: ${channels}`);\n }\n }\n encode(src: Encoder.DataArrayType, textureSize: number): Encoder.DataArrayType {\n let result: Float32Array;\n let source: Float32Array;\n if (src.constructor !== Float32Array) {\n Logger.warning('Encoder', 'data was not of type Float32; creating new Float32Array');\n source = new Float32Array(src);\n }\n if (textureSize * this.channelSize > src.length) {\n Logger.warning('Encoder', 'Source data too small. Allocating larger array');\n source = src as Float32Array;\n result = this.allocate(textureSize * this.channelSize) as Float32Array;\n source.forEach((v, i) => result[i] = v);\n } else {\n source = src as Float32Array;\n result = source;\n }\n return result;\n }\n allocate(size: number): Encoder.DataArrayType {\n return new Float32Array(size * 4);\n }\n decode(buffer: Encoder.DataArrayType, dataSize: number): Float32Array {\n if (this.channelSize === 1) {\n const filteredData = (buffer as Float32Array).filter((_value, index) => index % 4 === 0).subarray(0, dataSize);\n return filteredData;\n }\n return buffer.subarray(0, dataSize) as Float32Array;\n }\n}\n/**\n * Data encoder for WebGL 1 with support for floating point texture\n */\nexport class RGBAFloatDataEncoder implements DataEncoder {\n internalFormat: number;\n format: number;\n textureType: number;\n channelSize: number;\n constructor(gl: WebGLRenderingContext, channels = 1, textureType?: number) {\n if (channels !== 1 && channels !== 4) {\n throw new Error(`Invalid number of channels: ${channels}`);\n }\n this.internalFormat = gl.RGBA;\n this.format = gl.RGBA;\n this.channelSize = channels;\n this.textureType = textureType || gl.FLOAT;\n }\n encode(src: Float32Array, textureSize: number): Encoder.DataArrayType {\n let dest = src;\n if (this.channelSize === 1) {\n Logger.verbose('Encoder', 'Exploding into a larger array');\n dest = this.allocate(textureSize) as Float32Array;\n src.forEach((v, i) => dest[i * 4] = v);\n }\n return dest;\n }\n allocate(size: number): Encoder.DataArrayType {\n return new Float32Array(size * 4);\n }\n decode(buffer: Encoder.DataArrayType, dataSize: number): Float32Array {\n if (this.channelSize === 1) {\n const filteredData = (buffer as Float32Array).filter((_value, index) => index % 4 === 0).subarray(0, dataSize);\n return filteredData;\n }\n return buffer.subarray(0, dataSize) as Float32Array;\n }\n}\n\nexport class Uint8DataEncoder implements DataEncoder {\n internalFormat: number;\n format: number;\n textureType: number;\n channelSize = 4;\n constructor(gl: WebGLRenderingContext, channels = 1) {\n if (channels === 1) {\n this.internalFormat = gl.ALPHA;\n this.format = gl.ALPHA; // not tested\n this.textureType = gl.UNSIGNED_BYTE;\n this.channelSize = channels;\n } else if (channels === 4) {\n this.internalFormat = gl.RGBA;\n this.format = gl.RGBA;\n this.textureType = gl.UNSIGNED_BYTE;\n this.channelSize = channels;\n } else {\n throw new Error(`Invalid number of channels: ${channels}`);\n }\n }\n encode(src: Uint8Array, _textureSize: number): Encoder.DataArrayType {\n return new Uint8Array(src.buffer, src.byteOffset, src.byteLength);\n }\n allocate(size: number): Encoder.DataArrayType {\n return new Uint8Array(size * this.channelSize);\n }\n decode(buffer: Encoder.DataArrayType, dataSize: number): Uint8Array {\n if (buffer instanceof Uint8Array) {\n return buffer.subarray(0, dataSize);\n }\n throw new Error(`Invalid array type: ${buffer.constructor}`);\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {ShapeUtil} from '../../util';\n\nimport {TextureLayoutStrategy, WidthHeightPrefs} from './texture-layout-strategy';\nimport {TextureLayout, TextureType} from './types';\n\nexport const createTextureLayoutFromTextureType =\n (textureLayoutStrategy: TextureLayoutStrategy, shape: readonly number[],\n textureType: TextureType): TextureLayout => {\n const channel = (textureType === TextureType.unpacked || textureType === TextureType.unpackedReversed) ? 1 : 4;\n const isPacked = textureType === TextureType.packed;\n const reverseWH = (textureType === TextureType.unpackedReversed || textureType === TextureType.packed);\n const breakAxis = textureType === TextureType.packedLastDimension ? shape.length - 1 : undefined;\n const unpackedShape = textureType === TextureType.packedLastDimension ?\n shape.map((d, i) => i === shape.length - 1 ? d * 4 : d) :\n undefined;\n return createTextureLayoutFromShape(\n textureLayoutStrategy, shape, channel, unpackedShape, {isPacked, reverseWH, breakAxis});\n };\n\nexport const calculateTextureWidthAndHeight =\n (textureLayoutStrategy: TextureLayoutStrategy, shape: readonly number[], textureType: TextureType):\n [number, number] => {\n const layout = createTextureLayoutFromTextureType(textureLayoutStrategy, shape, textureType);\n return [layout.width, layout.height];\n };\n\n/**\n * Create a TextureLayout object from shape.\n */\nexport const createTextureLayoutFromShape =\n (textureLayoutStrategy: TextureLayoutStrategy, shape: readonly number[], channels: 1|4 = 1,\n unpackedShape?: readonly number[], prefs?: WidthHeightPrefs): TextureLayout => {\n const isPacked = !!(prefs && prefs.isPacked);\n const [width, height] = textureLayoutStrategy.computeTextureWH(isPacked ? unpackedShape || shape : shape, prefs);\n const rank = shape.length;\n let inferredDims = shape.slice(0);\n if (rank === 0) {\n inferredDims = [1];\n }\n if (channels === 1) {\n // unpackedShape will take `shape` and not `inferredDims` so as to create a scalar Tensor if need be\n unpackedShape = shape;\n } else if (isPacked) {\n if (channels !== 4) {\n throw new Error('a packed texture must be 4-channel');\n }\n unpackedShape = shape;\n if (rank > 0) {\n inferredDims[rank - 1] = Math.ceil(inferredDims[rank - 1] / 2);\n }\n if (rank > 1) {\n inferredDims[rank - 2] = Math.ceil(inferredDims[rank - 2] / 2);\n }\n } else if (!unpackedShape) {\n throw new Error('Unpacked shape is needed when using channels > 1');\n }\n return {\n width,\n height,\n channels,\n isPacked,\n shape: inferredDims,\n strides: ShapeUtil.computeStrides(inferredDims),\n unpackedShape,\n reversedWH: (prefs && prefs.reverseWH)\n };\n };\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {InferenceHandler} from '../../backend';\nimport {Logger} from '../../instrument';\nimport {Tensor} from '../../tensor';\nimport {ShapeUtil} from '../../util';\n\nimport {createPackProgramInfoLoader} from './ops/pack';\nimport {createPackedReshape3DProgramInfoLoader, isReshapeCheap, processDims3D} from './ops/reshape-packed';\nimport {encodeAsUint8} from './ops/uint8-encode';\nimport {createUnpackProgramInfoLoader} from './ops/unpack';\nimport {WebGLSessionHandler} from './session-handler';\nimport {EncoderUsage} from './texture-data-encoder';\nimport {calculateTextureWidthAndHeight, createTextureLayoutFromShape, createTextureLayoutFromTextureType} from './texture-layout';\nimport {Artifact, ProgramInfo, ProgramInfoLoader, TextureData, TextureLayout, TextureType} from './types';\n\nconst getProgramInfoUniqueKey =\n (programInfo: ProgramInfo|ProgramInfoLoader, inputTextureDatas: TextureData[]): string => {\n const inputs =\n inputTextureDatas.map(texture => `${texture.unpackedShape.join(',')};${texture.width}x${texture.height}`)\n .join('_');\n let key = programInfo.name;\n if (programInfo.cacheHint) {\n key += '[' + programInfo.cacheHint + ']';\n }\n key += ':' + inputs;\n return key;\n };\n\nexport class WebGLInferenceHandler implements InferenceHandler {\n private packedTextureDataCache: Map;\n private unpackedTextureDataCache: Map;\n constructor(public session: WebGLSessionHandler) {\n this.packedTextureDataCache = new Map();\n this.unpackedTextureDataCache = new Map();\n }\n\n /**\n * @returns [width, height]\n */\n calculateTextureWidthAndHeight(shape: readonly number[], textureType: TextureType): [number, number] {\n return calculateTextureWidthAndHeight(this.session.layoutStrategy, shape, textureType);\n }\n\n executeProgram(program: ProgramInfo|ProgramInfoLoader, inputs: readonly Tensor[]): TextureData {\n if (inputs.length < program.inputNames.length) {\n throw new Error(`Input size mustn't be less than ${program.inputNames.length}.`);\n }\n if (program.inputNames.length !== program.inputTypes.length) {\n throw new Error('input names size does not match input types');\n }\n\n // create texture info for input\n const inputTextureDatas: TextureData[] = [];\n for (let i = 0; i < program.inputNames.length; ++i) {\n inputTextureDatas[i] = this.getOrCreateTextureData(inputs[i], program.inputTypes[i]);\n }\n\n const key = getProgramInfoUniqueKey(program, inputTextureDatas);\n let artifact = this.session.programManager.getArtifact(key);\n const programInfo = artifact ?\n artifact.programInfo :\n (typeof (program as ProgramInfoLoader).get === 'function' ? (program as ProgramInfoLoader).get() :\n (program as ProgramInfo));\n\n // create texture info for output\n const outputTextureLayout = createTextureLayoutFromTextureType(\n this.session.layoutStrategy, programInfo.output.dims, programInfo.output.textureType);\n const outputTextureData = this.createTextureData(outputTextureLayout, programInfo.output.type);\n\n if (!artifact) {\n artifact = this.session.programManager.build(programInfo, inputTextureDatas, outputTextureData);\n this.session.programManager.setArtifact(key, artifact);\n }\n\n this.runProgram(artifact, inputTextureDatas, outputTextureData);\n return outputTextureData;\n }\n\n run(program: ProgramInfoLoader, inputs: readonly Tensor[]): Tensor {\n const outputTextureData = this.executeProgram(program, inputs);\n return outputTextureData.tensor;\n }\n\n private runProgram(artifact: Artifact, inputs: TextureData[], output: TextureData): void {\n // input should match\n for (let i = 0; i < inputs.length; ++i) {\n if (!!inputs[i].isPacked !== (artifact.programInfo.inputTypes[i] === TextureType.packed)) {\n throw new Error(`input[${i}] property packed inconsistent`);\n }\n }\n\n // output should match\n if (!!output.isPacked !== (artifact.programInfo.output.textureType === TextureType.packed)) {\n throw new Error('output property packed inconsistent');\n }\n\n this.session.programManager.run(artifact, inputs, output);\n }\n\n /**\n * Create a TextureData object from a tensor.\n * Usage = EncoderUsage.UploadOnly.\n * If a related texture data is found in cache, returns it;\n * Otherwise:\n * Creates a new texture layout if not provided;\n * Creates WebGLTexture with the layout;\n * Upload tensor data to the texture;\n * Creates a texture data object associated with the given tensor.\n * @param tensor the tensor with data to upload\n */\n private getOrCreateTextureData(tensor: Tensor, textureType: TextureType) {\n let td = this.getTextureData(tensor.dataId, textureType === TextureType.packed);\n\n if (!td) {\n // check if we have texture data in different type\n td = this.getTextureData(tensor.dataId, textureType !== TextureType.packed);\n if (td) {\n if (textureType === TextureType.packed) {\n return this.pack(td);\n } else {\n return this.unpack(td);\n }\n }\n }\n\n if (!td) {\n const layout = createTextureLayoutFromTextureType(this.session.layoutStrategy, tensor.dims, textureType);\n\n if (textureType === TextureType.packedLastDimension) {\n const group = 1;\n const channels = 4;\n const shape = tensor.dims;\n if (shape.length === 4) {\n // pre-processing for kernel data of Conv.\n //\n // TODO: currently this is a hacking to overwrite Conv's weight. The correct way to do this should be:\n // 1. implement texture based const-folding\n // 2. create a WebGL program \"preprocessConvWeight\" to do the same work as below\n // 3. run the program before dotProduct.\n //\n const adjustedKernelShape = [shape[0], Math.ceil((shape[1] * shape[2] * shape[3]) / channels)];\n const adjustedLayout =\n createTextureLayoutFromTextureType(this.session.layoutStrategy, adjustedKernelShape, textureType);\n let buffer = tensor.numberData;\n if (shape[1] * shape[2] * shape[3] % channels !== 0) {\n const numFeatureMaps = shape[0];\n const oldRowSize = shape[1] * shape[2] * shape[3];\n const newRowSize = Math.ceil(oldRowSize * group / channels) * channels;\n const newSize = numFeatureMaps * newRowSize;\n buffer = new Float32Array(newSize);\n for (let f = 0; f < numFeatureMaps; ++f) {\n const oldOffset = f * oldRowSize;\n const newOffset = f * newRowSize + f % group * oldRowSize;\n buffer.set(tensor.numberData.subarray(oldOffset, oldOffset + oldRowSize), newOffset);\n }\n }\n return this.createTextureData(adjustedLayout, tensor.type, buffer, tensor, EncoderUsage.UploadOnly);\n }\n }\n\n if (textureType === TextureType.packed) {\n const unpackedTextureLayout =\n createTextureLayoutFromShape(this.session.layoutStrategy, tensor.dims, 1, [], {reverseWH: true});\n const unpackedTextureData = this.createTextureData(\n unpackedTextureLayout, tensor.type, tensor.numberData, tensor, EncoderUsage.UploadOnly);\n td = this.pack(unpackedTextureData);\n } else {\n td = this.createTextureData(layout, tensor.type, tensor.numberData, tensor, EncoderUsage.UploadOnly);\n }\n }\n return td;\n }\n\n /**\n * Create a TextureData object using the given data and bind to the given tensor.\n * Usage = EncoderUsage.UploadOnly.\n * NOTE: this function is a hack for Conv implementation. should remove this function, after rewriting Conv\n * implementation by Graph.Transformer\n * @param dataType the tensor data type\n * @param data the actual data to upload\n * @param tensor the tensor to bind. tensor's data is ignored.\n */\n createTextureDataFromLayoutBindTensor(\n layout: TextureLayout, dataType: Tensor.DataType, data: Tensor.NumberType, tensor: Tensor): TextureData {\n return this.createTextureData(layout, dataType, data, tensor, EncoderUsage.UploadOnly);\n }\n\n private createTextureData(\n layout: TextureLayout, dataType: Tensor.DataType, data?: Tensor.NumberType, tensor?: Tensor,\n usage?: EncoderUsage): TextureData {\n Logger.verbose('InferenceHandler', `Creating TextureData: layout:[${JSON.stringify(layout)}]`);\n const texture = this.session.textureManager.createTextureFromLayout(dataType, layout, data, usage);\n return this.createTextureDataFromTexture(layout, dataType, texture, tensor);\n }\n\n reshapeUnpacked(input: Tensor, reshapedDims: readonly number[]): Tensor {\n const inputTD = this.getOrCreateTextureData(input, TextureType.unpacked);\n const newTextureLayout: TextureLayout = {\n channels: inputTD.channels,\n height: inputTD.height,\n width: inputTD.width,\n // handle reshaping into scalar Tensors\n shape: reshapedDims.length !== 0 ? reshapedDims : [1],\n strides: ShapeUtil.computeStrides(reshapedDims),\n unpackedShape: reshapedDims,\n };\n const newTextureData = this.createTextureDataFromTexture(newTextureLayout, input.type, inputTD.texture);\n return newTextureData.tensor;\n }\n\n reshapePacked(input: Tensor, reshapedDims: readonly number[]): Tensor {\n const inputTD = this.getOrCreateTextureData(input, TextureType.packed);\n\n // check if the reshape is 'cheap'\n if (isReshapeCheap(input.dims, reshapedDims)) {\n const newTextureLayout: TextureLayout = {\n channels: inputTD.channels,\n height: inputTD.height,\n width: inputTD.width,\n // handle reshaping into scalar Tensors\n shape: reshapedDims.length !== 0 ? reshapedDims : [1],\n strides: ShapeUtil.computeStrides(reshapedDims),\n unpackedShape: reshapedDims,\n isPacked: true\n };\n const newTextureData = this.createTextureDataFromTexture(newTextureLayout, input.type, inputTD.texture);\n return newTextureData.tensor;\n }\n\n const squeezedInputShape = processDims3D(input.dims);\n const squeezedOutputShape = processDims3D(reshapedDims);\n\n const squeezedInputTensor = this.reshapePacked(input, squeezedInputShape);\n const squeezedOutputTensor = this.run(\n createPackedReshape3DProgramInfoLoader(this, squeezedInputTensor, squeezedOutputShape), [squeezedInputTensor]);\n const outputTensor = this.reshapePacked(squeezedOutputTensor, reshapedDims);\n return outputTensor;\n }\n\n cast(input: Tensor, type: Tensor.DataType): Tensor {\n const inputTD = this.getOrCreateTextureData(input, TextureType.unpacked);\n const newTextureData = this.createTextureDataFromTexture(inputTD as TextureLayout, type, inputTD.texture);\n return newTextureData.tensor;\n }\n\n private createTextureDataFromTexture(\n layout: TextureLayout, dataType: Tensor.DataType, texture: WebGLTexture, tensor?: Tensor, tensorId?: Tensor.Id) {\n const textureData: TextureData = {\n ...layout,\n tensor: tensor ||\n new Tensor(\n layout.unpackedShape, dataType, (_id: Tensor.Id) => this.readTexture(textureData),\n async (_id: Tensor.Id) => this.readTextureAsync(textureData), undefined, tensorId),\n texture\n };\n this.setTextureData(textureData.tensor.dataId, textureData, layout.isPacked);\n return textureData;\n }\n\n private getTextureData(tensorId: Tensor.Id, isPacked = false): TextureData|undefined {\n return this.session.isInitializer(tensorId) ? this.session.getTextureData(tensorId, isPacked) :\n isPacked ? this.packedTextureDataCache.get(tensorId) :\n this.unpackedTextureDataCache.get(tensorId);\n }\n setTextureData(tensorId: Tensor.Id, td: TextureData, isPacked = false): void {\n if (this.session.isInitializer(tensorId)) {\n this.session.setTextureData(tensorId, td, isPacked);\n } else {\n (isPacked ? this.packedTextureDataCache : this.unpackedTextureDataCache).set(tensorId, td);\n }\n }\n isTextureLayoutCached(tensor: Tensor, isPacked = false): boolean {\n return !!this.getTextureData(tensor.dataId, isPacked);\n }\n\n dispose(): void {\n this.session.textureManager.clearActiveTextures();\n this.packedTextureDataCache.forEach(td => this.session.textureManager.releaseTexture(td));\n this.packedTextureDataCache = new Map();\n this.unpackedTextureDataCache.forEach(td => this.session.textureManager.releaseTexture(td));\n this.unpackedTextureDataCache = new Map();\n }\n\n readTexture(textureData: TextureData): Tensor.NumberType {\n if (textureData.isPacked) {\n return this.readTexture(this.unpack(textureData));\n }\n if (!this.session.backend.glContext.isFloat32DownloadSupported) {\n return this.session.textureManager.readUint8TextureAsFloat(encodeAsUint8(this, textureData));\n }\n return this.session.textureManager.readTexture(textureData, textureData.tensor.type, textureData.channels);\n }\n\n async readTextureAsync(textureData: TextureData): Promise {\n if (textureData.isPacked) {\n return this.readTextureAsync(this.unpack(textureData));\n }\n if (!this.session.backend.glContext.isFloat32DownloadSupported) {\n return this.session.textureManager.readUint8TextureAsFloat(encodeAsUint8(this, textureData));\n }\n return this.session.textureManager.readTextureAsync(textureData, textureData.tensor.type, textureData.channels);\n }\n\n pack(input: TextureData): TextureData {\n const outputTextureData = this.executeProgram(createPackProgramInfoLoader(this, input.tensor), [input.tensor]);\n return outputTextureData;\n }\n\n unpack(input: TextureData): TextureData {\n const outputTextureData = this.executeProgram(createUnpackProgramInfoLoader(this, input.tensor), [input.tensor]);\n return outputTextureData;\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nclass AttributeWithCacheKeyImpl {\n constructor(attribute: Record) {\n Object.assign(this, attribute);\n }\n\n private key: string;\n public get cacheKey(): string {\n if (!this.key) {\n this.key =\n Object.getOwnPropertyNames(this).sort().map(name => `${(this as Record)[name]}`).join(';');\n }\n return this.key;\n }\n}\n\nexport interface AttributeWithCacheKey {\n readonly cacheKey: string;\n}\n\nexport const createAttributeWithCacheKey = >(attribute: T): T&AttributeWithCacheKey =>\n new AttributeWithCacheKeyImpl(attribute) as unknown as T & AttributeWithCacheKey;\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {AttributeWithCacheKey, createAttributeWithCacheKey} from '../../../attribute-with-cache-key';\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {getGlsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, TextureType} from '../types';\n\nexport interface BatchNormalizationAttributes extends AttributeWithCacheKey {\n epsilon: number;\n momentum: number;\n spatial: number;\n}\n\nconst batchNormalizationProgramMetadata = {\n name: 'BatchNormalization',\n inputNames: ['A', 'Scale', 'B', 'Mean', 'Variance'],\n inputTypes:\n [TextureType.unpacked, TextureType.unpacked, TextureType.unpacked, TextureType.unpacked, TextureType.unpacked]\n};\n\nexport const batchNormalization: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: BatchNormalizationAttributes): Tensor[] => {\n validateInputs(inputs);\n const output = inferenceHandler.run(\n {\n ...batchNormalizationProgramMetadata,\n cacheHint: attributes.cacheKey,\n get: () => createBatchNormalizationProgramInfo(inferenceHandler, inputs, attributes)\n },\n inputs);\n return [output];\n };\n\nexport const parseBatchNormalizationAttributes: OperatorInitialization =\n (node: Graph.Node): BatchNormalizationAttributes => {\n const epsilon = node.attributes.getFloat('epsilon', 1e-5);\n const momentum = node.attributes.getFloat('momentum', 0.9);\n const spatial = node.attributes.getInt('spatial', 1);\n return createAttributeWithCacheKey({epsilon, momentum, spatial});\n };\n\nconst createBatchNormalizationProgramInfo =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: BatchNormalizationAttributes):\n ProgramInfo => {\n const glsl = getGlsl(inferenceHandler.session.backend.glContext.version);\n const rank = inputs[0].dims.length;\n const [scaleWidth, scaleHeight] =\n inferenceHandler.calculateTextureWidthAndHeight(inputs[1].dims, TextureType.unpacked);\n const shaderSource = `\n float process(int[${rank}] indices) {\n vec2 position = offsetToCoords(indices[1], ${scaleWidth}, ${scaleHeight});\n float scale = getColorAsFloat(${glsl.texture2D}(Scale, position));\n float mean = getColorAsFloat(${glsl.texture2D}(Mean, position));\n float variance = getColorAsFloat(${glsl.texture2D}(Variance, position));\n float b = getColorAsFloat(${glsl.texture2D}(B, position));\n\n return scale * ( (_A(indices) - mean) / sqrt(variance + float(${attributes.epsilon})) ) + b;\n }`;\n return {\n ...batchNormalizationProgramMetadata,\n output: {dims: inputs[0].dims, type: inputs[0].type, textureType: TextureType.unpacked},\n shaderSource\n };\n };\n\nconst validateInputs = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length !== 5) {\n throw new Error('BatchNormalization requires 5 inputs.');\n }\n\n const X = inputs[0];\n const scale = inputs[1];\n const B = inputs[2];\n const mean = inputs[3];\n const var_ = inputs[4];\n\n // input should atleast have three dimensions - N,C,dim1,...,dimn\n // other inputs can have only one dimensions\n if (X.dims.length < 3 || scale.dims.length !== 1 || B.dims.length !== 1 || mean.dims.length !== 1 ||\n var_.dims.length !== 1) {\n throw new Error('invalid input shape.');\n }\n if (scale.dims[0] !== X.dims[1] || B.dims[0] !== X.dims[1] || mean.dims[0] !== X.dims[1] ||\n var_.dims[0] !== X.dims[1]) {\n throw new Error('invalid input shape.');\n }\n if ((X.type !== 'float32' && X.type !== 'float64') || (scale.type !== 'float32' && scale.type !== 'float64') ||\n (B.type !== 'float32' && B.type !== 'float64') || (mean.type !== 'float32' && mean.type !== 'float64') ||\n (var_.type !== 'float32' && var_.type !== 'float64')) {\n throw new Error('invalid input tensor types.');\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {ProgramInfo, TextureLayout} from './types';\nimport {WebGLContext} from './webgl-context';\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum FunctionType {\n ValueBased,\n Positional\n}\nexport interface GlslFunction {\n body: string;\n name: string;\n type: T;\n}\nexport type GlslValueFunction = GlslFunction;\nexport interface GlslPositionalFunction extends GlslFunction {\n inputShape: readonly number[];\n outputShape: readonly number[];\n}\n\nexport class GlslContext {\n constructor(\n public glContext: WebGLContext, public programInfo: ProgramInfo, public inputTextureLayouts: TextureLayout[],\n public outputTextureLayout: TextureLayout) {}\n}\nexport abstract class GlslLib {\n constructor(public context: GlslContext) {}\n abstract getFunctions(): {[name: string]: GlslLibRoutine};\n abstract getCustomTypes(): {[name: string]: string};\n}\n\n// abstraction to represent a GLSL library routine and it's dependencies\nexport class GlslLibRoutine {\n constructor(public routineBody: string, public dependencies?: string[]) {}\n}\n\n// abstraction to represent a GLSL library routine and it's dependencies AS GRAPH Nodes\n// this level of abstraction is used to topologically sort routines before fragment shade inclusion\nexport class GlslLibRoutineNode {\n dependencies: GlslLibRoutineNode[];\n routineBody: string;\n constructor(public name: string, routineBody?: string, dependencies?: GlslLibRoutineNode[]) {\n if (dependencies) {\n this.dependencies = dependencies;\n } else {\n this.dependencies = [];\n }\n\n if (routineBody) {\n this.routineBody = routineBody;\n }\n }\n addDependency(node: GlslLibRoutineNode) {\n if (node) {\n this.dependencies.push(node);\n }\n }\n}\n\n// topologically sort GLSL library routines (graph nodes abstraction) before shader script inclusion\nexport class TopologicalSortGlslRoutines {\n static returnOrderedNodes(nodes: GlslLibRoutineNode[]): GlslLibRoutineNode[] {\n if (!nodes || nodes.length === 0) {\n return [];\n }\n\n if (nodes.length === 1) {\n return nodes;\n }\n\n const cycleCheck = new Set();\n const alreadyTraversed = new Set();\n const result = new Array();\n\n this.createOrderedNodes(nodes, cycleCheck, alreadyTraversed, result);\n return result;\n }\n\n private static createOrderedNodes(\n graphNodes: GlslLibRoutineNode[], cycleCheck: Set, alreadyTraversed: Set,\n result: GlslLibRoutineNode[]) {\n for (let i = 0; i < graphNodes.length; ++i) {\n this.dfsTraverse(graphNodes[i], cycleCheck, alreadyTraversed, result);\n }\n }\n\n private static dfsTraverse(\n root: GlslLibRoutineNode, cycleCheck: Set, alreadyTraversed: Set, result: GlslLibRoutineNode[]) {\n // if this root has already been traversed return\n if (!root || alreadyTraversed.has(root.name)) {\n return;\n }\n\n // cyclic dependency has been detected\n if (cycleCheck.has(root.name)) {\n throw new Error('Cyclic dependency detected. Can\\'t topologically sort routines needed for shader.');\n }\n\n // hold this node to detect cycles if any\n cycleCheck.add(root.name);\n\n // traverse children in a dfs fashion\n const dependencies = root.dependencies;\n if (dependencies && dependencies.length > 0) {\n for (let i = 0; i < dependencies.length; ++i) {\n this.dfsTraverse(dependencies[i], cycleCheck, alreadyTraversed, result);\n }\n }\n\n // add to result holder\n result.push(root);\n\n // mark this node as traversed so that we don't traverse from this again\n alreadyTraversed.add(root.name);\n\n // release the hold\n cycleCheck.delete(root.name);\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Tensor} from '../../../tensor';\nimport {BroadcastUtil, ShapeUtil} from '../../../util';\nimport {FunctionType, GlslValueFunction} from '../glsl-definitions';\nimport {getGlsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, TextureType} from '../types';\n\nexport function glslAdd(): GlslValueFunction {\n const name = 'add_';\n const body = `\n float ${name}(float a, float b) {\n return a + b;\n }\n vec4 ${name}(vec4 v1, vec4 v2) {\n return v1 + v2;\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nexport function glslDiv(): GlslValueFunction {\n const name = 'div_';\n const body = `\n float ${name}(float a, float b) {\n return a / b;\n }\n vec4 ${name}(vec4 v1, vec4 v2) {\n return v1 / v2;\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nexport function glslMul(): GlslValueFunction {\n const name = 'mul_';\n const body = `\n float ${name}(float a, float b) {\n return a * b;\n }\n vec4 ${name}(vec4 v1, vec4 v2) {\n return v1 * v2;\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nexport function glslSub(): GlslValueFunction {\n const name = 'sub_';\n const body = `\n float ${name}(float a, float b) {\n return a - b;\n }\n vec4 ${name}(vec4 v1, vec4 v2) {\n return v1 - v2;\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nexport function glslEqual(): GlslValueFunction {\n const name = 'equal_';\n const body = `\n float ${name}(float a, float b) {\n return float(a == b);\n }\n vec4 ${name}(vec4 v1, vec4 v2) {\n return vec4(equal(v1, v2));\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nexport function glslGreater(): GlslValueFunction {\n const name = 'greater_';\n const body = `\n float ${name}(float a, float b) {\n return float(a > b);\n }\n vec4 ${name}(vec4 v1, vec4 v2) {\n return vec4( v1.r > v2.r ,\n v1.g > v2.g,\n v1.b > v2.b,\n v1.a > v2.a );\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nexport function glslLess(): GlslValueFunction {\n const name = 'less_';\n const body = `\n float ${name}(float a, float b) {\n return float(a < b);\n }\n vec4 ${name}(vec4 v1, vec4 v2) {\n return vec4( v1.r < v2.r ,\n v1.g < v2.g,\n v1.b < v2.b,\n v1.a < v2.a );\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nexport function glslAnd(): GlslValueFunction {\n const name = 'and_';\n const body = `\n float ${name}(float a, float b) {\n return float( bool(a) && bool(b) );\n }\n vec4 ${name}(vec4 v1, vec4 v2) {\n bvec4 b1 = bvec4(v1);\n bvec4 b2 = bvec4(v2);\n return vec4( b1.r && b2.r ,\n b1.g && b2.g,\n b1.b && b2.b,\n b1.a && b2.a );\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nexport function glslOr(): GlslValueFunction {\n const name = 'or_';\n const body = `\n float ${name}(float a, float b) {\n return float( bool(a) || bool(b) );\n }\n vec4 ${name}(vec4 v1, vec4 v2) {\n bvec4 b1 = bvec4(v1);\n bvec4 b2 = bvec4(v2);\n return vec4( b1.r || b2.r ,\n b1.g || b2.g,\n b1.b || b2.b,\n b1.a || b2.a );\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nexport function glslXor(): GlslValueFunction {\n const name = 'xor_';\n const body = `\n float ${name}(float a, float b) {\n return float( bool(a) ^^ bool(b) );\n }\n vec4 ${name}(vec4 v1, vec4 v2) {\n bvec4 b1 = bvec4(v1);\n bvec4 b2 = bvec4(v2);\n return vec4( b1.r ^^ b2.r ,\n b1.g ^^ b2.g,\n b1.b ^^ b2.b,\n b1.a ^^ b2.a );\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nexport function glslPow(): GlslValueFunction {\n return glslBuiltinBinary('pow');\n}\nexport function glslPRelu(): GlslValueFunction {\n const name = 'prelu_';\n const body = `\n float ${name}(float a, float b) {\n return a < 0.0 ? a * b: a;\n }\n vec4 ${name}(vec4 v1, vec4 v2) {\n return vec4(\n v1.r < 0.0 ? v1.r * v2.r: v1.r,\n v1.g < 0.0 ? v1.g * v2.g: v1.g,\n v1.b < 0.0 ? v1.b * v2.b: v1.b,\n v1.a < 0.0 ? v1.a * v2.a: v1.a\n );\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\n\nfunction glslBuiltinBinary(fname: string): GlslValueFunction {\n const name = `${fname}_`;\n const body = `\n float ${name}(float a, float b) {\n return ${fname}(a, b);\n }\n vec4 ${name}(vec4 v1, vec4 v2) {\n return ${fname}(v1, v2);\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\n\nconst createBinaryProgramInfoLoader =\n (handler: WebGLInferenceHandler, inputs: Tensor[], glslFunc: GlslValueFunction,\n outputTensorType: Tensor.DataType = inputs[0].type, cacheKey?: string): ProgramInfoLoader => {\n const textureType = handler.session.pack ? TextureType.packed : TextureType.unpacked;\n return {\n name: glslFunc.name,\n inputNames: ['A', 'B'],\n inputTypes: [textureType, textureType],\n cacheHint: cacheKey,\n get: () => createBinaryProgramInfo(handler, inputs, glslFunc, outputTensorType)\n };\n };\n\nconst createBinaryProgramInfo =\n (handler: WebGLInferenceHandler, inputs: Tensor[], glslFunc: GlslValueFunction,\n outputTensorType: Tensor.DataType = inputs[0].type): ProgramInfo => {\n const textureType = handler.session.pack ? TextureType.packed : TextureType.unpacked;\n const isBroadcast = !ShapeUtil.areEqual(inputs[0].dims, inputs[1].dims);\n let outputShape = inputs[0].dims;\n\n const usePackedTexture = handler.session.pack;\n\n if (isBroadcast) {\n const calculatedShape = BroadcastUtil.calcShape(inputs[0].dims, inputs[1].dims, false);\n if (!calculatedShape) {\n throw new Error('Can\\'t perform binary op on the given tensors');\n }\n outputShape = calculatedShape;\n const outputRank = outputShape.length;\n const aRank = inputs[0].dims.length !== 0 ? inputs[0].dims.length : 1;\n const bRank = inputs[1].dims.length !== 0 ? inputs[1].dims.length : 1;\n const aBcast = inputs[0].dims.length !== 0 ? 'bcastIndices_A(indices, aindices);' : 'aindices[0] = 0;';\n const bBcast = inputs[1].dims.length !== 0 ? 'bcastIndices_B(indices, bindices);' : 'bindices[0] = 0;';\n\n const glsl = getGlsl(handler.session.backend.glContext.version);\n const shaderSource = usePackedTexture ? `\n ${glslFunc.body}\n void main() {\n vec4 a = getAAtOutCoords();\n vec4 b = getBAtOutCoords();\n vec4 result = ${glslFunc.name}(a, b);\n ${glsl.output} = result;\n }` :\n `\n ${glslFunc.body}\n float process(int indices[${outputRank}]) {\n int aindices[${aRank}];\n int bindices[${bRank}];\n ${aBcast}\n ${bBcast}\n return ${glslFunc.name}(_A(aindices), _B(bindices));\n }`;\n\n return {\n name: glslFunc.name,\n inputNames: ['A', 'B'],\n inputTypes: [textureType, textureType],\n output: {dims: outputShape, type: outputTensorType, textureType},\n shaderSource,\n hasMain: usePackedTexture\n };\n }\n const glsl = getGlsl(handler.session.backend.glContext.version);\n const shaderSource = `\n ${glslFunc.body}\n void main() {\n vec4 v1 = ${glsl.texture2D}(A, TexCoords);\n vec4 v2 = ${glsl.texture2D}(B, TexCoords);\n vec4 result = ${glslFunc.name}(v1, v2);\n ${glsl.output} = result;\n }\n `;\n\n return {\n name: glslFunc.name,\n inputNames: ['A', 'B'],\n inputTypes: [textureType, textureType],\n output: {dims: inputs[0].dims, type: outputTensorType, textureType},\n shaderSource,\n hasMain: true\n };\n };\n\nexport const add = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createBinaryProgramInfoLoader(handler, inputs, glslAdd()), inputs)];\n\nexport const and = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createBinaryProgramInfoLoader(handler, inputs, glslAnd(), 'bool'), inputs)];\n\nexport const div = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createBinaryProgramInfoLoader(handler, inputs, glslDiv()), inputs)];\n\nexport const equal = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createBinaryProgramInfoLoader(handler, inputs, glslEqual(), 'bool'), inputs)];\n\nexport const greater = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createBinaryProgramInfoLoader(handler, inputs, glslGreater(), 'bool'), inputs)];\n\nexport const less = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createBinaryProgramInfoLoader(handler, inputs, glslLess(), 'bool'), inputs)];\n\nexport const mul = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createBinaryProgramInfoLoader(handler, inputs, glslMul()), inputs)];\n\nexport const or = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createBinaryProgramInfoLoader(handler, inputs, glslOr(), 'bool'), inputs)];\n\nexport const pow = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createBinaryProgramInfoLoader(handler, inputs, glslPow()), inputs)];\n\nexport const pRelu = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createBinaryProgramInfoLoader(handler, inputs, glslPRelu()), inputs)];\n\nexport const sub = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createBinaryProgramInfoLoader(handler, inputs, glslSub()), inputs)];\n\nexport const xor = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createBinaryProgramInfoLoader(handler, inputs, glslXor(), 'bool'), inputs)];\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {ProtoUtil} from '../../../util';\nimport {WebGLInferenceHandler} from '../inference-handler';\n\nexport const cast: OperatorImplementation =\n (handler: WebGLInferenceHandler, inputs: Tensor[], to: Tensor.DataType): Tensor[] => {\n validateInputs(inputs);\n return [handler.cast(inputs[0], to)];\n };\n\nexport const parseCastAttributes: OperatorInitialization = (node: Graph.Node): Tensor.DataType =>\n ProtoUtil.tensorDataTypeFromProto(node.attributes.getInt('to'));\n\nconst validateInputs = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length !== 1) {\n throw new Error('Cast requires 1 input.');\n }\n\n if (inputs[0].type === 'string') {\n throw new Error('Invalid input type.');\n }\n};","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Tensor} from '../../../tensor';\nimport {getGlsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, ProgramMetadata, TextureType} from '../types';\nimport {getCoordsDataType, getGlChannels} from '../utils';\n\nimport {ConcatAttributes} from './concat';\nimport {getChannels, unpackFromChannel} from './packing-utils';\n\nconst createPackedConcatProgramMetadata = (inputCount: number, cacheHint: string) => ({\n name: 'Concat (packed)',\n inputNames: Array.from({length: inputCount}, (_v, i) => `X${i}`),\n inputTypes: Array(inputCount).fill(TextureType.packed),\n cacheHint\n});\n\nconst createPackedConcatProgramInfo =\n (handler: WebGLInferenceHandler, metadata: ProgramMetadata, inputs: Tensor[], axis: number): ProgramInfo => {\n const inputShape = inputs[0].dims.slice();\n if (axis >= inputShape.length || axis < (-1 * inputShape.length)) {\n throw new Error('axis specified for concat doesn\\'t match input dimensionality');\n }\n if (axis < 0) {\n axis = inputShape.length + axis;\n }\n // ensure all of the non-concatenated axes match each other\n // calculate the shape of the output tensor while we do that\n const outputShape = inputShape.slice(0);\n for (let i = 1; i < inputs.length; i++) {\n const dataNShape = inputs[i].dims.slice();\n for (let axisIndex = 0; axisIndex < inputShape.length; axisIndex++) {\n // add to the placeholder for computing output shape\n if (axisIndex === axis) {\n outputShape[axis] += dataNShape[axisIndex];\n }\n // ensure all non-cancatenated axes match each other\n else if (inputShape[axisIndex] !== dataNShape[axisIndex]) {\n throw new Error('non concat dimensions must match');\n }\n }\n }\n\n const rank = outputShape.length;\n const coords = getChannels('coords', rank);\n const dtype = getCoordsDataType(rank);\n const unpackChannel = unpackFromChannel();\n\n const shapes = inputs.map(i => i.dims);\n const channels = getGlChannels(rank);\n const offsets: number[] = new Array(shapes.length - 1);\n\n offsets[0] = shapes[0][axis];\n for (let i = 1; i < offsets.length; i++) {\n offsets[i] = offsets[i - 1] + shapes[i][axis];\n }\n\n const channel = channels[axis];\n const lastChannels = channels.slice(-2);\n const allChannels = channels.join();\n\n let getValueSnippet = `if (${channel} < ${offsets[0]}) {\n return getChannel(\n getX0(${allChannels}), vec2(${lastChannels.join()}));\n }`;\n for (let i = 1; i < offsets.length; i++) {\n const shift = offsets[i - 1];\n getValueSnippet += `\n if (${channel} < ${offsets[i]} && ${channel} >= ${offsets[i - 1]}) {\n return getChannel(\n getX${i}(${getShiftedChannelsSnippet(channels, channel, shift)}),\n vec2(${getShiftedChannelsSnippet(lastChannels, channel, shift)}));\n }`;\n }\n const lastIndex = offsets.length;\n const shift = offsets[offsets.length - 1];\n getValueSnippet += `\n return getChannel(\n getX${lastIndex}(${getShiftedChannelsSnippet(channels, channel, shift)}),\n vec2(${getShiftedChannelsSnippet(lastChannels, channel, shift)}));`;\n\n const glsl = getGlsl(handler.session.backend.glContext.version);\n\n const shaderSource = `\n ${unpackChannel}\n float getValue(${channels.map(x => 'int ' + x)}) {\n ${getValueSnippet}\n }\n\n void main() {\n ${dtype} coords = getOutputCoords();\n int lastDim = coords.${channels[rank - 1]};\n coords.${channels[rank - 1]} = coords.${channels[rank - 2]};\n coords.${channels[rank - 2]} = lastDim;\n\n vec4 result = vec4(getValue(${coords}), 0., 0., 0.);\n\n ${coords[rank - 1]} = ${coords[rank - 1]} + 1;\n if (${coords[rank - 1]} < ${outputShape[rank - 1]}) {\n result.g = getValue(${coords});\n }\n\n ${coords[rank - 2]} = ${coords[rank - 2]} + 1;\n if (${coords[rank - 2]} < ${outputShape[rank - 2]}) {\n result.a = getValue(${coords});\n }\n\n ${coords[rank - 1]} = ${coords[rank - 1]} - 1;\n if (${coords[rank - 2]} < ${outputShape[rank - 2]} &&\n ${coords[rank - 1]} < ${outputShape[rank - 1]}) {\n result.b = getValue(${coords});\n }\n ${glsl.output} = result;\n }\n `;\n\n return {\n ...metadata,\n output: {dims: outputShape, type: inputs[0].type, textureType: TextureType.packed},\n shaderSource,\n hasMain: true,\n };\n };\n\nexport const createPackedConcatProgramInfoLoader =\n (handler: WebGLInferenceHandler, inputs: Tensor[], attributes: ConcatAttributes): ProgramInfoLoader => {\n const metadata = createPackedConcatProgramMetadata(inputs.length, attributes.cacheKey);\n return {...metadata, get: () => createPackedConcatProgramInfo(handler, metadata, inputs, attributes.axis)};\n };\n\nconst getShiftedChannelsSnippet = (channels: string[], channel: string, shift: number): string => {\n const channelIdx = channels.indexOf(channel);\n const res = channels.map((c, idx) => {\n if (idx === channelIdx) {\n return `${c} - ${shift}`;\n } else {\n return c;\n }\n });\n return res.join();\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {AttributeWithCacheKey, createAttributeWithCacheKey} from '../../../attribute-with-cache-key';\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, ProgramMetadata, TextureType} from '../types';\n\nimport {createPackedConcatProgramInfoLoader} from './concat-packed';\n\nexport interface ConcatAttributes extends AttributeWithCacheKey {\n readonly axis: number;\n}\n\nexport const concat: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: ConcatAttributes): Tensor[] => {\n validateInputs(inputs);\n if (inferenceHandler.session.pack && inputs[0].dims.length > 1) {\n const output =\n inferenceHandler.run(createPackedConcatProgramInfoLoader(inferenceHandler, inputs, attributes), inputs);\n return [output];\n } else {\n const output =\n inferenceHandler.run(createUnpackedConcatProgramInfoLoader(inferenceHandler, inputs, attributes), inputs);\n return [output];\n }\n };\n\nconst createUnpackedConcatProgramMetadata = (inputCount: number, cacheHint: string) => ({\n name: 'Concat',\n inputNames: Array.from({length: inputCount}, (_v, i) => `X${i}`),\n inputTypes: Array(inputCount).fill(TextureType.unpacked),\n cacheHint\n});\n\nconst createUnpackedConcatProgramInfo =\n (_handler: WebGLInferenceHandler, metadata: ProgramMetadata, inputs: Tensor[], axis: number): ProgramInfo => {\n const inputShape = inputs[0].dims.slice();\n if (axis >= inputShape.length || axis < (-1 * inputShape.length)) {\n throw new Error('axis specified for concat doesn\\'t match input dimensionality');\n }\n if (axis < 0) {\n axis = inputShape.length + axis;\n }\n // ensure all of the non-concatenated axes match each other\n // calculate the shape of the output tensor while we do that\n const outputShape = inputShape.slice(0);\n for (let i = 1; i < inputs.length; i++) {\n const dataNShape = inputs[i].dims.slice();\n for (let axisIndex = 0; axisIndex < inputShape.length; axisIndex++) {\n // add to the placeholder for computing output shape\n if (axisIndex === axis) {\n outputShape[axis] += dataNShape[axisIndex];\n }\n // ensure all non-cancatenated axes match each other\n else if (inputShape[axisIndex] !== dataNShape[axisIndex]) {\n throw new Error('non concat dimensions must match');\n }\n }\n }\n\n const rank = outputShape.length;\n\n const sizeInConcatAxis = new Array(inputs.length);\n let previousSum = 0;\n for (let i = 0; i < sizeInConcatAxis.length; ++i) {\n previousSum += inputs[i].dims[axis];\n sizeInConcatAxis[i] = previousSum;\n }\n\n let getTextureIndexWhereDataResidesMethod = '';\n // in most cases linear search is sufficient, as in most scenarios, only 2 tensors are concatenated\n if (inputs.length < 5) {\n getTextureIndexWhereDataResidesMethod = getTextureIndexWhereDataResidesLinearSearch(sizeInConcatAxis);\n } else {\n getTextureIndexWhereDataResidesMethod = getTextureIndexWhereDataResidesBinarySearch(sizeInConcatAxis);\n }\n\n const fetchDataFromCorrectTextureMethod = getFetchDataFromCorrectTextureMethod(inputs.length, rank);\n const getSizeInConcatAxisValueFromIndexMethod = getGetSizeInConcatAxisValueFromIndexMethod(sizeInConcatAxis);\n const shaderSource = `\n ${fetchDataFromCorrectTextureMethod}\n ${getSizeInConcatAxisValueFromIndexMethod}\n ${getTextureIndexWhereDataResidesMethod}\n float process(int indices[${rank}]) {\n int textureIndex = getTextureWhereDataResides (indices[${axis}]);\n\n if(textureIndex != 0) {\n indices[${axis}] = indices[${axis}] - int(getSizeInConcatAxisValueFromIndex(textureIndex-int(1)));\n }\n\n return fetchDataFromCorrectTexture(textureIndex, indices);\n }`;\n return {\n ...metadata,\n output: {dims: outputShape, type: inputs[0].type, textureType: TextureType.unpacked},\n shaderSource,\n };\n };\n\nconst createUnpackedConcatProgramInfoLoader =\n (handler: WebGLInferenceHandler, inputs: Tensor[], attributes: ConcatAttributes): ProgramInfoLoader => {\n const metadata = createUnpackedConcatProgramMetadata(inputs.length, attributes.cacheKey);\n return {...metadata, get: () => createUnpackedConcatProgramInfo(handler, metadata, inputs, attributes.axis)};\n };\n\nconst getTextureIndexWhereDataResidesLinearSearch = (sizeInConcatAxis: number[]): string => {\n const searchAxis = sizeInConcatAxis.map((size, i) => `if(index<${size}) {return ${i};}\n`);\n return `int getTextureWhereDataResides(int index) {\n ${searchAxis.join('')}\n }`;\n};\n\n// TODO: Implement BinarySearch in GLSL\nconst getTextureIndexWhereDataResidesBinarySearch = (sizeInConcatAxis: number[]): string =>\n getTextureIndexWhereDataResidesLinearSearch(sizeInConcatAxis);\n\nconst getFetchDataFromCorrectTextureMethod = (numberOfTensors: number, tensorRank: number) => {\n const codeLines: string[] = [`float fetchDataFromCorrectTexture(int textureIndex, int indices[${tensorRank}]) {`];\n for (let i = 0; i < numberOfTensors; ++i) {\n if (i === 0) {\n codeLines.push(\n '\\t' +\n `if (textureIndex == ${i}) { return _X${i}(indices); }`);\n } else if (i === numberOfTensors - 1) {\n codeLines.push(\n '\\t' +\n `else { return _X${i}(indices); }`);\n } else {\n codeLines.push(\n '\\t' +\n `else if (textureIndex == ${i}) { return _X${i}(indices); }`);\n }\n }\n codeLines.push(\n '\\t' +\n '}');\n return codeLines.join('\\n');\n};\n\nconst getGetSizeInConcatAxisValueFromIndexMethod = (sizeInConcatAxis: number[]): string => {\n const codeLines: string[] = ['int getSizeInConcatAxisValueFromIndex(int index) {'];\n for (let i = 0; i < sizeInConcatAxis.length; ++i) {\n if (i === 0) {\n codeLines.push(\n '\\t' +\n `if (index == ${i}) { return ${sizeInConcatAxis[i]}; }`);\n } else if (i === sizeInConcatAxis.length - 1) {\n codeLines.push(\n '\\t' +\n `else { return ${sizeInConcatAxis[i]}; }`);\n } else {\n codeLines.push(\n '\\t' +\n `else if (index == ${i}) { return ${sizeInConcatAxis[i]}; }`);\n }\n }\n codeLines.push(\n '\\t' +\n '}');\n\n return codeLines.join('\\n');\n};\n\nexport const parseConcatAttributes: OperatorInitialization = (node: Graph.Node): ConcatAttributes =>\n createAttributeWithCacheKey({axis: node.attributes.getInt('axis')});\n\nconst validateInputs = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length < 1) {\n throw new Error('too few inputs');\n }\n\n const inputType = inputs[0].type;\n const inputDimensionality = inputs[0].dims.length;\n\n // TODO: Support string concat\n if (inputType === 'string') {\n throw new Error('string tensor is not supported yet');\n }\n\n for (const input of inputs) {\n // make sure types of all inputs match\n if (input.type !== inputType) {\n throw new Error('input tensors should be one type');\n }\n\n // make sure the dimensionality of all inputs are the same\n if (input.dims.length !== inputDimensionality) {\n throw new Error('input tensors should have the same shape');\n }\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {AttributeWithCacheKey, createAttributeWithCacheKey} from '../../../attribute-with-cache-key';\nimport {Graph} from '../../../graph';\nimport {Tensor} from '../../../tensor';\nimport {MAX_CLIP, MIN_CLIP} from '../../../util';\nimport {FunctionType, GlslValueFunction} from '../glsl-definitions';\nimport {getGlsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, ProgramMetadata, TextureType} from '../types';\n\nexport function glslAbs(): GlslValueFunction {\n return glslBuiltinUnary('abs');\n}\nexport function glslAcos(): GlslValueFunction {\n return glslBuiltinUnary('acos');\n}\nexport function glslAsin(): GlslValueFunction {\n return glslBuiltinUnary('asin');\n}\nexport function glslAtan(): GlslValueFunction {\n return glslBuiltinUnary('atan');\n}\nexport function glslCeil(): GlslValueFunction {\n return glslBuiltinUnary('ceil');\n}\nexport function glslCos(): GlslValueFunction {\n return glslBuiltinUnary('cos');\n}\nexport function glslElu(alpha: number): GlslValueFunction {\n const name = 'elu';\n const body = `\n const float alpha = float(${alpha});\n\n float ${name}_(float a) {\n return a >= 0.0 ? a: (exp(a) - 1.0) * alpha;\n }\n vec4 ${name}_(vec4 v) {\n return vec4(${name}_(v.x), ${name}_(v.y), ${name}_(v.z), ${name}_(v.w));\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nexport function glslExp(): GlslValueFunction {\n return glslBuiltinUnary('exp');\n}\nexport function glslFloor(): GlslValueFunction {\n return glslBuiltinUnary('floor');\n}\nexport function glslClip(min: number, max: number): GlslValueFunction {\n const name = 'clip';\n const body = `\n const float min = float(${min});\n const float max = float(${max});\n\n float ${name}_(float a) {\n return clamp(a, min, max);\n }\n vec4 ${name}_(vec4 v) {\n return clamp(v, min, max);\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nexport function glslIdentity(): GlslValueFunction {\n const name = 'indentity';\n const body = `\n float ${name}_(float a) {\n return a;\n }\n vec4 ${name}_(vec4 v) {\n return v;\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nexport function glslLeakyRelu(alpha: number): GlslValueFunction {\n const name = 'leakyRelu';\n const body = `\n const float alpha = float(${alpha});\n\n float ${name}_(float a) {\n return a < 0.0 ? a * alpha : a;\n }\n vec4 ${name}_(vec4 v) {\n return vec4(${name}_(v.x), ${name}_(v.y), ${name}_(v.z), ${name}_(v.w));\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nexport function glslLog(): GlslValueFunction {\n return glslBuiltinUnary('log');\n}\nexport function glslNeg(): GlslValueFunction {\n const name = 'neg';\n const body = `\n float ${name}_(float a) {\n return -a;\n }\n vec4 ${name}_(vec4 v) {\n return -v;\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nexport function glslNot(): GlslValueFunction {\n const name = 'not';\n const body = `\n float ${name}_(float a) {\n return float( ! bool(a) );\n }\n bool ${name}_(bool a) {\n return !a;\n }\n vec4 ${name}_(vec4 v) {\n return vec4(!bool(v.x), !bool(v.y), !bool(v.z), !bool(v.w));\n }\n bvec4 ${name}_(bvec4 v) {\n return bvec4(!v.x, !v.y, !v.z, !v.w);\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nexport function glslSin(): GlslValueFunction {\n return glslBuiltinUnary('sin');\n}\nexport function glslRelu(): GlslValueFunction {\n const name = 'relu';\n const body = `\n float ${name}_(float a) {\n return max( a, 0.0 );\n }\n vec4 ${name}_(vec4 v) {\n return max( v, 0.0 );\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nexport function glslSigmoid(): GlslValueFunction {\n const name = 'sigmoid';\n const body = `\n float ${name}_(float a) {\n return 1.0 / (1.0 + exp(-a));\n }\n vec4 ${name}_(vec4 v) {\n return 1.0 / (1.0 + exp(-v));\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nexport function glslSqrt(): GlslValueFunction {\n return glslBuiltinUnary('sqrt');\n}\nexport function glslTan(): GlslValueFunction {\n return glslBuiltinUnary('tan');\n}\nexport function glslTanh(): GlslValueFunction {\n const name = 'tanh';\n const body = `\n float ${name}_(float a) {\n a = clamp(a, -10., 10.);\n a = exp(2.*a);\n return (a - 1.) / (a + 1.);\n }\n vec4 ${name}_(vec4 v) {\n v = clamp(v, -10., 10.);\n v = exp(2.*v);\n return (v - 1.) / (v + 1.);\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\nfunction glslBuiltinUnary(name: string): GlslValueFunction {\n const body = `\n float ${name}_(float a) {\n return ${name}(a);\n }\n vec4 ${name}_(vec4 v) {\n return ${name}(v);\n }\n `;\n return {body, name, type: FunctionType.ValueBased};\n}\n\n/////\n/////\n/////\n\nconst createElementwiseProgramInfo =\n (handler: WebGLInferenceHandler, metadata: ProgramMetadata, input: Tensor, glslFunc: GlslValueFunction):\n ProgramInfo => {\n const textureType = handler.session.pack ? TextureType.packed : TextureType.unpacked;\n const glsl = getGlsl(handler.session.backend.glContext.version);\n return {\n ...metadata,\n output: {dims: input.dims, type: input.type, textureType},\n shaderSource: `\n ${glslFunc.body}\n void main() {\n vec4 v = ${glsl.texture2D}(A, TexCoords);\n v = ${glslFunc.name}_(v);\n ${glsl.output} = v;\n }\n `,\n hasMain: true\n };\n };\n\nconst createElementwiseProgramInfoLoader =\n (handler: WebGLInferenceHandler, input: Tensor, glslFunc: GlslValueFunction, cacheKey?: string):\n ProgramInfoLoader => {\n const textureType = handler.session.pack ? TextureType.packed : TextureType.unpacked;\n const metadata = {name: glslFunc.name, inputTypes: [textureType], inputNames: ['A'], cacheHint: cacheKey};\n return {...metadata, get: () => createElementwiseProgramInfo(handler, metadata, input, glslFunc)};\n };\n\nexport const abs = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createElementwiseProgramInfoLoader(handler, inputs[0], glslAbs()), inputs)];\n\nexport const acos = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createElementwiseProgramInfoLoader(handler, inputs[0], glslAcos()), inputs)];\n\nexport const asin = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createElementwiseProgramInfoLoader(handler, inputs[0], glslAsin()), inputs)];\n\nexport const atan = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createElementwiseProgramInfoLoader(handler, inputs[0], glslAtan()), inputs)];\n\nexport interface ClipAttributes extends AttributeWithCacheKey {\n readonly min: number;\n readonly max: number;\n}\n\nexport const clip =\n (handler: WebGLInferenceHandler, inputs: Tensor[], attributes: ClipAttributes): Tensor[] => [handler.run(\n createElementwiseProgramInfoLoader(\n handler, inputs[0], glslClip(attributes.min, attributes.max), attributes.cacheKey),\n inputs)];\n\nexport const parseClipAttributes = (node: Graph.Node): ClipAttributes => createAttributeWithCacheKey(\n {min: node.attributes.getFloat('min', MIN_CLIP), max: node.attributes.getFloat('max', MAX_CLIP)});\n\nexport const clipV11 = (handler: WebGLInferenceHandler, inputs: Tensor[]): Tensor[] => {\n const attributes = generateClipAttributesFromInputs(handler, inputs);\n return clip(handler, [inputs[0]], attributes);\n};\n\nconst generateClipAttributesFromInputs = (handler: WebGLInferenceHandler, inputs: Tensor[]): ClipAttributes => {\n if (inputs.length >= 3 &&\n (!handler.session.isInitializer(inputs[1].dataId) || !handler.session.isInitializer(inputs[2].dataId))) {\n throw new Error('dynamic clip attributes are not allowed');\n }\n\n const min = (inputs.length >= 3) ? inputs[1].numberData[0] : MIN_CLIP;\n const max = (inputs.length >= 3) ? inputs[2].numberData[0] : MAX_CLIP;\n return createAttributeWithCacheKey({min, max});\n};\n\nexport const ceil = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createElementwiseProgramInfoLoader(handler, inputs[0], glslCeil()), inputs)];\n\nexport const cos = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createElementwiseProgramInfoLoader(handler, inputs[0], glslCos()), inputs)];\n\nexport interface EluAttributes extends AttributeWithCacheKey {\n readonly alpha: number;\n}\n\nexport const elu =\n (handler: WebGLInferenceHandler, inputs: Tensor[], attributes: EluAttributes): Tensor[] => [handler.run(\n createElementwiseProgramInfoLoader(handler, inputs[0], glslElu(attributes.alpha), attributes.cacheKey),\n inputs)];\n\nexport const parseEluAttributes = (node: Graph.Node): EluAttributes =>\n createAttributeWithCacheKey({alpha: node.attributes.getFloat('alpha', 1.0)});\n\nexport const exp = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createElementwiseProgramInfoLoader(handler, inputs[0], glslExp()), inputs)];\n\nexport const floor = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createElementwiseProgramInfoLoader(handler, inputs[0], glslFloor()), inputs)];\n\nexport const identity = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createElementwiseProgramInfoLoader(handler, inputs[0], glslIdentity()), inputs)];\n\nexport interface LeakyReluAttributes extends AttributeWithCacheKey {\n readonly alpha: number;\n}\n\nexport const leakyRelu =\n (handler: WebGLInferenceHandler, inputs: Tensor[], attributes: LeakyReluAttributes): Tensor[] => [handler.run(\n createElementwiseProgramInfoLoader(handler, inputs[0], glslLeakyRelu(attributes.alpha), attributes.cacheKey),\n inputs)];\n\nexport const parseLeakyReluAttributes = (node: Graph.Node): LeakyReluAttributes =>\n createAttributeWithCacheKey({alpha: node.attributes.getFloat('alpha', 0.01)});\n\nexport const log = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createElementwiseProgramInfoLoader(handler, inputs[0], glslLog()), inputs)];\n\nexport const neg = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createElementwiseProgramInfoLoader(handler, inputs[0], glslNeg()), inputs)];\n\nexport const not = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createElementwiseProgramInfoLoader(handler, inputs[0], glslNot()), inputs)];\n\nexport const relu = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createElementwiseProgramInfoLoader(handler, inputs[0], glslRelu()), inputs)];\n\nexport const sigmoid = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createElementwiseProgramInfoLoader(handler, inputs[0], glslSigmoid()), inputs)];\n\nexport const sin = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createElementwiseProgramInfoLoader(handler, inputs[0], glslSin()), inputs)];\n\nexport const sqrt = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createElementwiseProgramInfoLoader(handler, inputs[0], glslSqrt()), inputs)];\n\nexport const tan = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createElementwiseProgramInfoLoader(handler, inputs[0], glslTan()), inputs)];\n\nexport const tanh = (handler: WebGLInferenceHandler, inputs: Tensor[]):\n Tensor[] => [handler.run(createElementwiseProgramInfoLoader(handler, inputs[0], glslTanh()), inputs)];\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Attribute} from '../../../attribute';\nimport {MAX_CLIP, MIN_CLIP} from '../../../util';\nimport {GlslValueFunction} from '../glsl-definitions';\n\nimport {glslClip, glslRelu, glslSigmoid} from './unary-op';\n\nexport interface InternalActivationAttributes {\n readonly activation: string;\n readonly clipMin?: number;\n readonly clipMax?: number;\n readonly activationCacheKey: string;\n}\n\nexport function getActivationSnippet(attributes: InternalActivationAttributes) {\n let func: GlslValueFunction;\n switch (attributes.activation) {\n case 'Relu':\n func = glslRelu();\n break;\n case 'Sigmoid':\n func = glslSigmoid();\n break;\n case 'Clip':\n func = glslClip(attributes.clipMin!, attributes.clipMax!);\n break;\n // TODO: adding other activations that can be fused.\n default:\n return {activationFunction: '', applyActivation: ''};\n }\n\n const activationName = func.name;\n const activationFunction = func.body;\n const applyActivation = `value = ${activationName}_(value);`;\n return {activationFunction, applyActivation};\n}\n\nexport const parseInternalActivationAttributes = (attributes: Attribute): InternalActivationAttributes => {\n const activation = attributes.getString('activation', '');\n\n if (activation === 'Clip') {\n const [clipMin, clipMax] = attributes.getFloats('activation_params', [MIN_CLIP, MAX_CLIP]);\n return {activation, clipMax, clipMin, activationCacheKey: `${activation}:${clipMin},${clipMax}`};\n }\n return {activation, activationCacheKey: activation};\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Logger} from '../../../instrument';\nimport {Tensor} from '../../../tensor';\nimport {getGlsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, ProgramMetadata, TextureType} from '../types';\n\nimport {calculateOutputShape, ConvAttributes} from './conv';\nimport {getActivationSnippet} from './fuse-utils';\n\nconst createUnpackedGroupedConvProgramMetadata = (hasBias: boolean, cacheHint: string): ProgramMetadata => ({\n name: 'GroupedConv',\n inputNames: hasBias ? ['X', 'W', 'Bias'] : ['X', 'W'],\n inputTypes: hasBias ? [TextureType.unpacked, TextureType.unpacked, TextureType.unpacked] :\n [TextureType.unpacked, TextureType.unpacked],\n cacheHint\n});\n\nconst createUnpackedGroupedConvProgramInfo =\n (inferenceHandler: WebGLInferenceHandler, inputs: readonly Tensor[], metadata: ProgramMetadata,\n attributes: ConvAttributes): ProgramInfo => {\n const hasBias = inputs.length > 2;\n const processBias = hasBias ? 'value += getBias(output_channel);' : '';\n const xShape = inputs[0].dims.slice();\n const wShape = inputs[1].dims.slice();\n const outputChannelsPerGroup = wShape[0] / attributes.group;\n Logger.verbose(\n 'GroupedConv',\n `autpPad:${attributes.autoPad}, dilations:${attributes.dilations}, group:${attributes.group}, kernelShape:${\n attributes.kernelShape}, pads:${attributes.pads}, strides:${attributes.strides}`);\n const outputShape =\n calculateOutputShape(xShape, wShape, attributes.dilations, attributes.pads, attributes.strides);\n const glsl = getGlsl(inferenceHandler.session.backend.glContext.version);\n const {activationFunction, applyActivation} = getActivationSnippet(attributes);\n\n const shaderSource = `\n const ivec2 strides = ivec2(${attributes.strides[0]}, ${attributes.strides[1]});\n const ivec2 pads = ivec2(${attributes.pads[0]}, ${attributes.pads[1]});\n ${activationFunction}\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n int output_channel = coords.y;\n ivec2 xRCCorner = coords.zw * strides - pads;\n int group_id = output_channel / ${outputChannelsPerGroup};\n\n float value = 0.0;\n for (int wInChannel = 0; wInChannel < ${wShape[1]}; wInChannel++) {\n int input_channel = group_id * ${wShape[1]} + wInChannel;\n for (int wHeight = 0; wHeight < ${wShape[2]}; wHeight++) {\n int xHeight = xRCCorner.x + wHeight * ${attributes.dilations[0]};\n\n if (xHeight < 0 || xHeight >= ${xShape[2]}) {\n continue;\n }\n\n for (int wWidth = 0; wWidth < ${wShape[3]}; wWidth++) {\n int xWidth = xRCCorner.y + wWidth * ${attributes.dilations[1]};\n if (xWidth < 0 || xWidth >= ${xShape[3]}) {\n continue;\n }\n\n float xVal = getX(batch, input_channel, xWidth, xHeight);\n float wVal = getW(output_channel, wInChannel, wWidth, wHeight);\n value += xVal*wVal;\n }\n }\n }\n ${processBias}\n ${applyActivation}\n ${glsl.output} = vec4(value, .0, .0, .0);\n }\n`;\n return {\n ...metadata,\n output: {dims: outputShape, type: inputs[0].type, textureType: TextureType.unpacked},\n shaderSource,\n hasMain: true,\n };\n };\n\nexport const createUnpackedGroupedConvProgramInfoLoader =\n (inferenceHandler: WebGLInferenceHandler, inputs: readonly Tensor[], attributes: ConvAttributes):\n ProgramInfoLoader => {\n const metadata = createUnpackedGroupedConvProgramMetadata(inputs.length > 2, attributes.cacheKey);\n return {\n ...metadata,\n get: () => createUnpackedGroupedConvProgramInfo(inferenceHandler, inputs, metadata, attributes)\n };\n };\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Tensor} from '../../../tensor';\nimport {getGlsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, ProgramMetadata, TextureType} from '../types';\n\nimport {ConvAttributes} from './conv';\nimport {unpackFromChannel} from './packing-utils';\n\nconst createPackedIm2ColProgramMetadata = (cacheHint: string) => ({\n name: 'Im2Col (packed)',\n inputNames: ['A'],\n inputTypes: [TextureType.packed],\n cacheHint,\n});\n\nconst createPackedIm2ColProgramInfo =\n (inferenceHandler: WebGLInferenceHandler, metadata: ProgramMetadata, x: Tensor, w: Tensor,\n outputShape: readonly number[], attributes: ConvAttributes): ProgramInfo => {\n const xshape = x.dims;\n const wshape = w.dims;\n const rowDim = 2;\n const colDim = 3;\n const rank = outputShape.length;\n const im2colShape = [wshape[1] * wshape[2] * wshape[3], outputShape[2] * outputShape[3]];\n const kernelSize = wshape[2] * wshape[3];\n const unpackChannel = unpackFromChannel();\n const glsl = getGlsl(inferenceHandler.session.backend.glContext.version);\n let unrolled = '';\n\n for (let row = 0; row <= 1; row++) {\n for (let col = 0; col <= 1; col++) {\n unrolled += `\n blockIndex = rc.x + ${col};\n pos = rc.y + ${row};\n\n if(blockIndex < ${im2colShape[1]} && pos < ${im2colShape[0]}) {\n offsetY = int(blockIndex / (${outputShape[rank - 1]})) * ${attributes.strides[0]} -\n ${attributes.pads[0]};\n d0 = offsetY + ${attributes.dilations[0]} * (imod(pos, ${kernelSize}) / ${wshape[2]});\n\n if(d0 < ${xshape[rowDim]} && d0 >= 0) {\n offsetX = imod(blockIndex, ${outputShape[rank - 1]}) * ${attributes.strides[1]} -\n ${attributes.pads[1]};\n d1 = offsetX + ${attributes.dilations[1]} * imod(imod(pos, ${kernelSize}), ${wshape[2]});\n\n if(d1 < ${xshape[colDim]} && d1 >= 0) {\n\n ch = int(float(pos)/ ${kernelSize}.);\n innerDims = vec2(d0, d1);\n result[${row * 2 + col}] = getChannel(\n getA(0, ch, int(innerDims.x),\n int(innerDims.y)), innerDims);\n }\n }\n }\n\n `;\n }\n }\n\n const shaderSource = `\n ${unpackChannel}\n\n void main() {\n ivec2 rc = getOutputCoords();\n vec4 result = vec4(0.0);\n int blockIndex, pos, offsetY, d0, offsetX, d1, ch;\n vec2 innerDims;\n ${unrolled}\n ${glsl.output} = result;\n }\n `;\n return {\n ...metadata,\n output: {dims: im2colShape, type: x.type, textureType: TextureType.packed},\n shaderSource,\n hasMain: true\n };\n };\n\nexport const createPackedIm2ColProgramInfoLoader =\n (inferenceHandler: WebGLInferenceHandler, x: Tensor, w: Tensor, outputShape: readonly number[],\n attributes: ConvAttributes): ProgramInfoLoader => {\n const metadata = createPackedIm2ColProgramMetadata(attributes.cacheKey);\n return {\n ...metadata,\n get: () => createPackedIm2ColProgramInfo(inferenceHandler, metadata, x, w, outputShape, attributes)\n };\n };\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {BroadcastUtil, ShapeUtil} from '../../../util';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, ProgramMetadata, TextureType} from '../types';\nimport {getCoordsDataType, getGlChannels} from '../utils';\n\nimport {getActivationSnippet, InternalActivationAttributes, parseInternalActivationAttributes} from './fuse-utils';\nimport {createPackedMatmulProgramInfoLoader} from './matmul-pack';\n\nexport const matMul: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: InternalActivationAttributes): Tensor[] => {\n validateInputs(inputs);\n\n if (inferenceHandler.session.pack) {\n return [inferenceHandler.run(\n createPackedMatmulProgramInfoLoader(inferenceHandler, inputs, attributes), inputs)];\n } else {\n return [inferenceHandler.run(createMatmulProgramInfoLoader(inputs, attributes), inputs)];\n }\n };\n\nexport const parseMatMulAttributes: OperatorInitialization =\n (node: Graph.Node): InternalActivationAttributes => parseInternalActivationAttributes(node.attributes);\n\nconst createMatmulProgramMetadata = (hasBias: boolean, cacheHint: string) => ({\n name: 'MatMul',\n inputNames: hasBias ? ['A', 'B', 'Bias'] : ['A', 'B'],\n inputTypes: hasBias ? [TextureType.unpacked, TextureType.unpacked, TextureType.unpacked] :\n [TextureType.unpacked, TextureType.unpacked],\n cacheHint\n});\n\nfunction createMatmulProgramInfo(\n metadata: ProgramMetadata, inputs: Tensor[], activationAttributes: InternalActivationAttributes): ProgramInfo {\n const aShape = inputs[0].dims;\n const bShape = inputs[1].dims;\n const outputShape = BroadcastUtil.calcShape(aShape, bShape, true);\n if (!outputShape) {\n throw new Error('Can\\'t use matmul on the given tensors');\n }\n const coordsDataType = getCoordsDataType(outputShape.length);\n const allGlChannels = getGlChannels();\n const {activationFunction, applyActivation} = getActivationSnippet(activationAttributes);\n\n const hasBias = inputs.length > 2;\n const processBias = hasBias ? 'value += getBiasForMatmul();' : '';\n const getBiasForMatmulSnippet =\n hasBias ? `${getBiasForMatmul(coordsDataType, allGlChannels, inputs[2].dims, outputShape, false)}` : '';\n\n const rank = outputShape.length;\n const arank = aShape.length;\n const brank = bShape.length;\n const sharedDim = aShape[aShape.length - 1];\n const shaderSource = `\n ${activationFunction}\n ${getBiasForMatmulSnippet}\n float process(int indices[${rank}]) {\n int a[${arank}];\n int b[${brank}];\n bcastMatmulIndices_A(indices, a);\n bcastMatmulIndices_B(indices, b);\n\n float value;\n for (int k=0; k<${sharedDim}; ++k) {\n a[${arank - 1}] = k;\n b[${brank - 2}] = k;\n value += _A(a) * _B(b);\n }\n ${processBias}\n ${applyActivation}\n return value;\n }`;\n return {\n ...metadata,\n output: {dims: outputShape, type: inputs[0].type, textureType: TextureType.unpacked},\n shaderSource,\n };\n}\n\nexport function createMatmulProgramInfoLoader(\n inputs: Tensor[], activationAttributes: InternalActivationAttributes): ProgramInfoLoader {\n const metadata = createMatmulProgramMetadata(inputs.length > 2, activationAttributes.activationCacheKey);\n return {...metadata, get: () => createMatmulProgramInfo(metadata, inputs, activationAttributes)};\n}\n\nconst validateInputs = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length !== 2) {\n throw new Error('MatMul requires 2 inputs.');\n }\n\n if (inputs[0].dims[inputs[0].dims.length - 1] !== inputs[1].dims[inputs[1].dims.length - 2]) {\n throw new Error('shared dimension does not match.');\n }\n\n if ((inputs[0].type !== 'float32' && inputs[0].type !== 'float64') ||\n (inputs[1].type !== 'float32' && inputs[1].type !== 'float64')) {\n throw new Error('inputs should be float type');\n }\n\n if (inputs[0].type !== inputs[1].type) {\n throw new Error('inputs types should match');\n }\n};\n\nexport function getBiasForMatmul(\n coordsDataType: string, allGlChannels: readonly string[], inShape: readonly number[], outShape: readonly number[],\n isPacked: boolean): string {\n let unpackedCoordsSnippet = '';\n const inRank = inShape.length;\n const outRank = outShape.length;\n const rankDiff = outRank - inRank;\n if (outRank < 2 && inRank > 0) {\n unpackedCoordsSnippet = 'coords';\n } else {\n unpackedCoordsSnippet = inShape.map((_s, i) => `coords.${allGlChannels[i + rankDiff]}`).join(', ');\n }\n const broadcastDims = BroadcastUtil.getBroadcastDims(inShape, outShape);\n const coordsSnippet = broadcastDims.map(d => `coords.${allGlChannels[d + rankDiff]} = 0;`).join('\\n');\n const inSize = ShapeUtil.size(inShape);\n const isInputScalar = inSize === 1;\n let output = 'vec4(outputValue.xx, outputValue.yy)';\n if (isInputScalar) {\n output = 'vec4(outputValue.x)';\n }\n const getBiasForMatmulSource = isPacked ? `\nvec4 getBiasForMatmul() {\n ${coordsDataType} coords = getOutputCoords();\n ${coordsSnippet}\n vec4 outputValue = getBias(${unpackedCoordsSnippet});\n return ${output};\n}` :\n `\nfloat getBiasForMatmul() {\n ${coordsDataType} coords = getOutputCoords();\n ${coordsSnippet}\n return getBias(coords.x);\n}`;\n\n return getBiasForMatmulSource;\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Tensor} from '../../../tensor';\nimport {BroadcastUtil, ShapeUtil} from '../../../util';\nimport {getGlsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, ProgramMetadata, TextureType} from '../types';\nimport {getCoordsDataType, getGlChannels} from '../utils';\n\nimport {getActivationSnippet, InternalActivationAttributes} from './fuse-utils';\nimport {getBiasForMatmul} from './matmul';\n\nconst createPackedMatmulProgramMetadata = (hasBias: boolean, cacheHint: string) => ({\n name: 'MatMul (packed)',\n inputNames: hasBias ? ['A', 'B', 'Bias'] : ['A', 'B'],\n inputTypes: hasBias ? [TextureType.packed, TextureType.packed, TextureType.packed] :\n [TextureType.packed, TextureType.packed],\n cacheHint\n});\n\nconst createPackedMatmulProgramInfo =\n (inferenceHandler: WebGLInferenceHandler, metadata: ProgramMetadata, inputs: Tensor[],\n activationAttributes: InternalActivationAttributes): ProgramInfo => {\n const hasBias = inputs.length > 2;\n const processBias = hasBias ? 'value += getBiasForMatmul();' : '';\n const aShape = inputs[0].dims;\n const bShape = inputs[1].dims;\n const outputShape = BroadcastUtil.calcShape(aShape, bShape, true);\n const isBroadcast = !ShapeUtil.areEqual(inputs[0].dims, inputs[1].dims);\n\n if (!outputShape) {\n throw new Error('Can\\'t use matmul on the given tensors');\n }\n const sharedDim = aShape[aShape.length - 1];\n const sharedDimIndex = Math.ceil(sharedDim / 2);\n const aRank = aShape.length;\n const bRank = bShape.length;\n\n const glsl = getGlsl(inferenceHandler.session.backend.glContext.version);\n const coordsDataType = getCoordsDataType(outputShape.length);\n const outRank = outputShape.length;\n const allGlChannels = getGlChannels();\n const {activationFunction, applyActivation} = getActivationSnippet(activationAttributes);\n\n const getBiasForMatmulSnippet =\n hasBias ? `${getBiasForMatmul(coordsDataType, allGlChannels, inputs[2].dims, outputShape, true)}` : '';\n\n const getBcastedSamplerForMatmulSnippet =\n isBroadcast ? `${getBcastSamplerForMatmul(coordsDataType, allGlChannels, inputs, outputShape)}` : '';\n\n const getSamplerAInLoopSnippet = isBroadcast ? 'getAAtOutCoordsMatmul(i)' : `getA(${getA(allGlChannels, aRank)})`;\n const getSamplerBInLoopSnippet = isBroadcast ? 'getBAtOutCoordsMatmul(i)' : `getB(${getB(allGlChannels, bRank)})`;\n const getOutputCoordsSnippet = isBroadcast ? '' : `${coordsDataType} rc =\n getOutputCoords(); int lastDim = rc.${allGlChannels[outRank - 1]}; rc.${allGlChannels[outRank - 1]} =\n rc.${allGlChannels[outRank - 2]}; rc.${allGlChannels[outRank - 2]} = lastDim;\n `;\n const shaderSource = `\n ${getBcastedSamplerForMatmulSnippet}\n ${getBiasForMatmulSnippet}\n ${activationFunction}\n void main() {\n ${getOutputCoordsSnippet}\n\n vec4 value = vec4(0);\n for (int i = 0; i < ${sharedDimIndex}; i++) {\n vec4 a = ${getSamplerAInLoopSnippet};\n vec4 b = ${getSamplerBInLoopSnippet};\n\n value += (a.rrbb * b.rgrg);\n value += (a.ggaa * b.baba);\n }\n ${processBias}\n ${applyActivation}\n ${glsl.output} = value;\n }`;\n return {\n ...metadata,\n output: {dims: outputShape, type: inputs[0].type, textureType: TextureType.packed},\n shaderSource,\n hasMain: true\n };\n };\n\nexport const createPackedMatmulProgramInfoLoader =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[],\n activationAttributes: InternalActivationAttributes): ProgramInfoLoader => {\n const metadata = createPackedMatmulProgramMetadata(inputs.length > 2, activationAttributes.activationCacheKey);\n return {\n ...metadata,\n get: () => createPackedMatmulProgramInfo(inferenceHandler, metadata, inputs, activationAttributes)\n };\n };\n\nfunction getBcastSamplerForMatmul(\n coordsDataType: string, allGlChannels: readonly string[], inputs: Tensor[], outShape: readonly number[]): string {\n let unpackedACoordsSnippet = [];\n let unpackedBCoordsSnippet = [];\n\n const inAShape = inputs[0].dims;\n const inBShape = inputs[1].dims;\n\n const inARank = inAShape.length;\n const inBRank = inBShape.length;\n\n const outRank = outShape.length;\n const rankADiff = outRank - inARank;\n const rankBDiff = outRank - inBRank;\n\n unpackedACoordsSnippet = inAShape.map((_s, i) => `coords.${allGlChannels[i + rankADiff]}`);\n unpackedACoordsSnippet[inARank - 1] = 'i*2';\n unpackedACoordsSnippet.join(', ');\n unpackedBCoordsSnippet = inBShape.map((_s, i) => `coords.${allGlChannels[i + rankBDiff]}`);\n unpackedBCoordsSnippet[inBRank - 2] = 'i*2';\n unpackedBCoordsSnippet.join(', ');\n\n const broadcastADims = BroadcastUtil.getBroadcastDims(inAShape, outShape);\n const broadcastBDims = BroadcastUtil.getBroadcastDims(inBShape, outShape);\n\n const coordsASnippet = broadcastADims.map(d => `coords.${allGlChannels[d + rankADiff]} = 0;`).join('\\n');\n const coordsBSnippet = broadcastBDims.map(d => `coords.${allGlChannels[d + rankBDiff]} = 0;`).join('\\n');\n const swapDimSnippet = `int lastDim = coords.${allGlChannels[outRank - 1]};\n coords.${allGlChannels[outRank - 1]} = coords.${allGlChannels[outRank - 2]};\n coords.${allGlChannels[outRank - 2]} = lastDim;`;\n\n const getBcastSamplerMatmulSource = `\nvec4 getAAtOutCoordsMatmul(int i) {\n ${coordsDataType} coords = getOutputCoords();\n ${swapDimSnippet}\n ${coordsASnippet}\n vec4 outputValue = getA(${unpackedACoordsSnippet});\n return outputValue;\n}\n\nvec4 getBAtOutCoordsMatmul(int i) {\n ${coordsDataType} coords = getOutputCoords();\n ${swapDimSnippet}\n ${coordsBSnippet}\n vec4 outputValue = getB(${unpackedBCoordsSnippet});\n return outputValue;\n}`;\n\n return getBcastSamplerMatmulSource;\n}\n\nfunction getA(allGlChannels: string[], rank: number): string {\n let res = '';\n for (let i = 0; i < rank - 2; i++) {\n res += `rc.${allGlChannels[i]}, `;\n }\n res += `rc.${allGlChannels[rank - 2]}, ` +\n 'i*2';\n return res;\n}\n\nfunction getB(allGlChannels: string[], rank: number): string {\n let res = '';\n for (let i = 0; i < rank - 2; i++) {\n res += `rc.${allGlChannels[i]}, `;\n }\n res += 'i*2, ' +\n `rc.${allGlChannels[rank - 1]}`;\n return res;\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Tensor} from '../../../tensor';\nimport {WebGLInferenceHandler} from '../inference-handler';\n\nimport {calculateOutputShape, ConvAttributes} from './conv';\nimport {createPackedIm2ColProgramInfoLoader} from './im2col-pack';\nimport {createPackedMatmulProgramInfoLoader} from './matmul-pack';\n\nexport const conv2DPackedPointwise =\n (inferenceHandler: WebGLInferenceHandler, inputs: readonly Tensor[], attributes: ConvAttributes): Tensor => {\n const xshape = inputs[0].dims;\n const kshape = inputs[1].dims;\n const outputShape =\n calculateOutputShape(xshape, kshape, attributes.dilations, attributes.pads, attributes.strides);\n const reshapedX = inferenceHandler.reshapePacked(inputs[0], [xshape[1], xshape[2] * xshape[3]]);\n const reshapedK = inferenceHandler.reshapePacked(inputs[1], [kshape[0], kshape[1]]);\n\n const matmulInputs = inputs.length > 2 ? [reshapedK, reshapedX, inputs[2]] : [reshapedK, reshapedX];\n const matmulOutput = inferenceHandler.run(\n createPackedMatmulProgramInfoLoader(inferenceHandler, matmulInputs, attributes), matmulInputs);\n return inferenceHandler.reshapePacked(matmulOutput, outputShape);\n };\n\nexport const conv2DPacked =\n (inferenceHandler: WebGLInferenceHandler, inputs: readonly Tensor[], attributes: ConvAttributes): Tensor => {\n const xshape = inputs[0].dims;\n const kshape = inputs[1].dims;\n const outputShape =\n calculateOutputShape(xshape, kshape, attributes.dilations, attributes.pads, attributes.strides);\n\n // run im2col\n const im2colOutput = inferenceHandler.run(\n createPackedIm2ColProgramInfoLoader(inferenceHandler, inputs[0], inputs[1], outputShape, attributes),\n [inputs[0]]);\n\n // reshape kernel\n const kernelReshaped = inferenceHandler.reshapePacked(inputs[1], [kshape[0], kshape[1] * kshape[2] * kshape[3]]);\n\n // run matmul\n const matmulInputs =\n (inputs.length === 3) ? [kernelReshaped, im2colOutput, inputs[2]] : [kernelReshaped, im2colOutput];\n const matmulOutput = inferenceHandler.run(\n createPackedMatmulProgramInfoLoader(inferenceHandler, matmulInputs, attributes), matmulInputs);\n\n // reshape output\n const outputReshaped = inferenceHandler.reshapePacked(matmulOutput, outputShape);\n return outputReshaped;\n };\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Tensor} from '../../../tensor';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, ProgramMetadata, TextureType} from '../types';\n\nimport {ConvAttributes} from './conv';\n\nconst createIm2ColProgramMetadata = (cacheHint: string) => ({\n name: 'Im2Col',\n inputNames: ['X'],\n inputTypes: [TextureType.unpacked],\n cacheHint,\n});\n\nconst createIm2ColProgramInfo =\n (_inferenceHandler: WebGLInferenceHandler, metadata: ProgramMetadata, x: Tensor, w: Tensor,\n outputShape: readonly number[], attributes: ConvAttributes): ProgramInfo => {\n const xshape = x.dims;\n const wshape = w.dims;\n\n const rank = outputShape.length;\n const im2colDims = calculateIm2ColDims(xshape, wshape, outputShape, 4);\n\n const shaderSource = `\n const int XC = ${xshape[1]};\n const int XH = ${xshape[2]};\n const int XW = ${xshape[3]};\n const int KH = ${attributes.kernelShape[0]};\n const int KW = ${attributes.kernelShape[1]};\n const int dilationH = ${attributes.dilations[0]};\n const int dilationW = ${attributes.dilations[1]};\n const int strideH = ${attributes.strides[0]};\n const int strideW = ${attributes.strides[1]};\n const int padH = ${attributes.pads[0]};\n const int padW = ${attributes.pads[1]};\n const int KHKW = KH*KW;\n const int XCKHKW = XC * KHKW;\n const int outputChannels = 4;\n vec4 process(int indices[${rank}]) {\n int b = indices[0]; // batch size\n int oh = indices[1] * strideH - padH; //output height\n int ow = indices[2] * strideW - padW; //output width\n int p = indices[3] * outputChannels; //patch\n vec4 value = vec4(0.0);\n for(int i=0; i < outputChannels; ++i) {\n if(p < XCKHKW) {\n int patchC = p / KHKW;\n int patchH = (p - patchC*KHKW) / KW;\n int patchW = (p - patchC*KHKW) - patchH * KW;\n int xh2 = oh + patchH * dilationH;\n int xw2 = ow + patchW * dilationW;\n int x[${xshape.length}];\n x[0] = b;\n x[1] = patchC;\n x[2] = xh2;\n x[3] = xw2;\n if(xh2 >= 0 &&\n xh2 < XH &&\n xw2 >= 0 &&\n xw2 < XW) {\n value[i] = _X(x);\n }\n }\n ++p;\n }\n return value;\n }\n `;\n return {\n ...metadata,\n output: {dims: im2colDims, type: x.type, textureType: TextureType.packedLastDimension},\n shaderSource\n };\n };\n\nexport const createIm2ColProgramInfoLoader =\n (inferenceHandler: WebGLInferenceHandler, x: Tensor, w: Tensor, outputShape: readonly number[],\n attributes: ConvAttributes): ProgramInfoLoader => {\n const metadata = createIm2ColProgramMetadata(attributes.cacheKey);\n return {\n ...metadata,\n get: () => createIm2ColProgramInfo(inferenceHandler, metadata, x, w, outputShape, attributes)\n };\n };\n\n\nexport const calculateIm2ColDims =\n (inputShape: readonly number[], kernelShape: readonly number[], outputShape: readonly number[], channels = 4):\n number[] =>\n [outputShape[0], outputShape[2], outputShape[3],\n Math.ceil(inputShape[1] * kernelShape[2] * kernelShape[3] / channels)];\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Tensor} from '../../../tensor';\nimport {ShapeUtil} from '../../../util';\nimport {getGlsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, ProgramMetadata, TextureType} from '../types';\n\nimport {getActivationSnippet, InternalActivationAttributes} from './fuse-utils';\nimport {calculateIm2ColDims} from './im2col';\n\nconst createDotProductProgramMetadata = (hasBias: boolean, attributes: InternalActivationAttributes) => ({\n name: 'ConvDotProduct',\n inputNames: hasBias ? ['Im2Col', 'K', 'B'] : ['Im2Col', 'K'],\n inputTypes: hasBias ? [TextureType.unpacked, TextureType.packedLastDimension, TextureType.unpacked] :\n [TextureType.unpacked, TextureType.packedLastDimension],\n cacheKey: attributes.activationCacheKey\n});\n\nconst createDotProductProgramInfo =\n (inferenceHandler: WebGLInferenceHandler, metadata: ProgramMetadata, inputs: readonly Tensor[],\n outputShape: number[], attributes: InternalActivationAttributes): ProgramInfo => {\n const xshape = inputs[0].dims;\n const kshape = inputs[1].dims;\n const adjustedKernelShape = [kshape[0], Math.ceil((xshape[1] * kshape[2] * kshape[3]) / 4)];\n const im2colShape = calculateIm2ColDims(xshape, kshape, outputShape);\n const [kWidth, kHeight] =\n inferenceHandler.calculateTextureWidthAndHeight(adjustedKernelShape, TextureType.packedLastDimension);\n\n const im2colStrides = ShapeUtil.computeStrides(im2colShape);\n const [im2colWidth, im2colHeight] =\n inferenceHandler.calculateTextureWidthAndHeight(im2colShape, TextureType.packedLastDimension);\n const rank = outputShape.length;\n\n const initValue = (inputs.length < 3) ? '0.0' : '_B(b)';\n const sharedDim = Math.ceil(xshape[1] * kshape[2] * kshape[3] / 4);\n const {activationFunction, applyActivation} = getActivationSnippet(attributes);\n const glsl = getGlsl(inferenceHandler.session.backend.glContext.version);\n const shaderSource = `\n${activationFunction}\nfloat process(int indices[${rank}]) {\n int b[1];\n b[0] = indices[1];\n int im2col[4];\n im2col[0] = indices[0];\n im2col[1] = indices[2];\n im2col[2] = indices[3];\n int im2colOffset = im2col[0] * ${im2colStrides[0]} + im2col[1] * ${im2colStrides[1]} + im2col[2] * ${\n im2colStrides[2]};\n int kernelOffset = indices[1] * ${adjustedKernelShape[1]};\n float value = ${initValue};\n for (int i = 0; i < ${sharedDim}; ++i) {\n vec2 im2colCoords = offsetToCoords(im2colOffset, ${im2colWidth}, ${im2colHeight});\n vec2 kernelCoords = offsetToCoords(kernelOffset, ${kWidth}, ${kHeight});\n value += dot(${glsl.texture2D}(Im2Col, im2colCoords), ${glsl.texture2D}(K, kernelCoords));\n ++im2colOffset;\n ++kernelOffset;\n }\n ${applyActivation}\n return value;\n}`;\n return {\n ...metadata,\n output: {dims: outputShape, type: inputs[0].type, textureType: TextureType.unpacked},\n shaderSource\n };\n };\n\nexport const createDotProductProgramInfoLoader =\n (inferenceHandler: WebGLInferenceHandler, inputs: readonly Tensor[], outputShape: number[],\n attributes: InternalActivationAttributes): ProgramInfoLoader => {\n const metadata = createDotProductProgramMetadata(inputs.length > 2, attributes);\n return {\n ...metadata,\n get: () => createDotProductProgramInfo(inferenceHandler, metadata, inputs, outputShape, attributes)\n };\n };\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {AttributeWithCacheKey, createAttributeWithCacheKey} from '../../../attribute-with-cache-key';\nimport {InferenceHandler} from '../../../backend';\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {PoolConvUtil} from '../../../util';\nimport {WebGLInferenceHandler} from '../inference-handler';\n\nimport {createUnpackedGroupedConvProgramInfoLoader} from './conv-grouped';\nimport {conv2DPacked} from './conv-pack';\nimport {createDotProductProgramInfoLoader} from './dot-product';\nimport {InternalActivationAttributes, parseInternalActivationAttributes} from './fuse-utils';\nimport {createIm2ColProgramInfoLoader} from './im2col';\nimport {createMatmulProgramInfoLoader} from './matmul';\n\n\nexport const calculateOutputShape =\n (inputShape: readonly number[], kernelShape: readonly number[], dilations: readonly number[],\n adjustPads: readonly number[], strides: readonly number[]): number[] => {\n const batchSize = inputShape[0];\n const inputSpatialShape = inputShape.slice(2);\n const spatialRank = inputSpatialShape.length;\n const outChannels = kernelShape[0];\n const kernelSpatialShape = kernelShape.slice(2);\n const dilatedKernelShape = kernelSpatialShape.map((v, i) => v + (v - 1) * (dilations[i] - 1));\n const inputSpatialShapeWithPad = inputSpatialShape.map((v, i) => v + adjustPads[i] + adjustPads[i + spatialRank]);\n const outputSpatialShape =\n inputSpatialShapeWithPad.map((v, i) => Math.floor((v - dilatedKernelShape[i] + strides[i]) / strides[i]));\n const outputShape = [batchSize, outChannels].concat(...outputSpatialShape);\n return outputShape;\n };\n\nexport interface ConvAttributes extends InternalActivationAttributes, AttributeWithCacheKey {\n readonly autoPad: string;\n readonly dilations: readonly number[];\n readonly group: number;\n readonly kernelShape: readonly number[];\n readonly pads: readonly number[];\n readonly strides: readonly number[];\n}\n\nexport const conv: OperatorImplementation =\n (inferenceHandler: InferenceHandler, inputs: Tensor[], attributes: ConvAttributes): Tensor[] => {\n validateInputs(inputs, attributes); // currently will fail if not conv2D\n return conv2d(inferenceHandler, inputs, attributes);\n };\n\nconst conv2d: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: ConvAttributes): Tensor[] => {\n const adjustedAttributes = getAdjustedConvAttributes(attributes, inputs);\n const packMode = inferenceHandler.session.pack;\n const isPointwise = adjustedAttributes.kernelShape[0] === 1 && adjustedAttributes.kernelShape[1] === 1;\n if (adjustedAttributes.group > 1) {\n const result = inferenceHandler.run(\n createUnpackedGroupedConvProgramInfoLoader(inferenceHandler, inputs, adjustedAttributes), inputs);\n return [result];\n } else if (isPointwise && packMode) {\n return [conv2DUnpackedPointwise(inferenceHandler, inputs, adjustedAttributes)];\n } else if (packMode && inputs[0].dims.length === 4 && inputs[0].dims[0] === 1 && !isPointwise) {\n return [conv2DPacked(inferenceHandler, inputs, adjustedAttributes)];\n } else {\n return [conv2DUnpacked(inferenceHandler, inputs, adjustedAttributes)];\n }\n };\n\nconst conv2DUnpackedPointwise =\n (inferenceHandler: WebGLInferenceHandler, inputs: readonly Tensor[], attributes: ConvAttributes): Tensor => {\n const xshape = inputs[0].dims;\n const kshape = inputs[1].dims;\n const outputShape =\n calculateOutputShape(xshape, kshape, attributes.dilations, attributes.pads, attributes.strides);\n const reshapedX = inferenceHandler.reshapeUnpacked(inputs[0], [xshape[1], xshape[2] * xshape[3]]);\n const reshapedK = inferenceHandler.reshapeUnpacked(inputs[1], [kshape[0], kshape[1]]);\n\n const matmulInputs = inputs.length > 2 ? [reshapedK, reshapedX, inputs[2]] : [reshapedK, reshapedX];\n const matmulOutput = inferenceHandler.run(createMatmulProgramInfoLoader(matmulInputs, attributes), matmulInputs);\n return inferenceHandler.reshapeUnpacked(matmulOutput, outputShape);\n };\n\nconst conv2DUnpacked =\n (inferenceHandler: WebGLInferenceHandler, inputs: readonly Tensor[], attributes: ConvAttributes): Tensor => {\n const xshape = inputs[0].dims;\n const kshape = inputs[1].dims;\n const outputShape =\n calculateOutputShape(xshape, kshape, attributes.dilations, attributes.pads, attributes.strides);\n const xIm2Col = inferenceHandler.run(\n createIm2ColProgramInfoLoader(inferenceHandler, inputs[0], inputs[1], outputShape, attributes), [inputs[0]]);\n\n const dotProductInputs = inputs.length === 3 ? [xIm2Col, inputs[1], inputs[2]] : [xIm2Col, inputs[1]];\n const output = inferenceHandler.run(\n createDotProductProgramInfoLoader(inferenceHandler, inputs, outputShape, attributes), dotProductInputs);\n return output;\n };\n\nconst getAdjustedConvAttributes = (attributes: T, inputs: Tensor[]): T => {\n const kernelShape = attributes.kernelShape.slice();\n // if kernelShape is not specified in the attributes of this op, infer it from the weight tensor dims\n if (attributes.kernelShape.length === 0) {\n for (let i = 2; i < inputs[1].dims.length; ++i) {\n kernelShape.push(inputs[1].dims[i]);\n }\n }\n const pads = attributes.pads.slice();\n PoolConvUtil.adjustPadsBasedOnAutoPad(\n inputs[0].dims, attributes.strides, attributes.dilations, kernelShape, pads, attributes.autoPad);\n\n // always return a new object so does not modify the original attributes\n const newAttributes: T = Object.assign({}, attributes);\n Object.assign(newAttributes, {kernelShape, pads, cacheKey: attributes.cacheKey});\n return newAttributes;\n};\n\nexport const parseConvAttributes: OperatorInitialization = (node: Graph.Node): ConvAttributes => {\n const attributes = node.attributes;\n const activationAttributes = parseInternalActivationAttributes(attributes);\n // TODO : Make this generic enough to compute default attributes for multi-dimensional conv\n const autoPad = attributes.getString('auto_pad', 'NOTSET');\n const dilations = attributes.getInts('dilations', [1, 1]);\n const group = attributes.getInt('group', 1);\n const kernelShape = attributes.getInts('kernel_shape', []);\n const pads = attributes.getInts('pads', [0, 0, 0, 0]);\n const strides = attributes.getInts('strides', [1, 1]);\n\n return createAttributeWithCacheKey({autoPad, dilations, group, kernelShape, pads, strides, ...activationAttributes});\n};\n\nconst validateInputs = (inputs: Tensor[], attributes: ConvAttributes): void => {\n // Refer to the below link for all input checks\n // https://github.com/onnx/onnx/blob/main/docs/Operators.md#Conv\n if (!inputs || (inputs.length !== 2 && inputs.length !== 3)) {\n throw new Error('Conv requires 2 or 3 inputs');\n }\n\n // TODO : Need to add support for multi-dimensional conv\n if (inputs[0].dims.length !== 4 || inputs[1].dims.length !== 4) {\n throw new Error('currently only support 2-dimensional conv');\n }\n\n // FILTER_IN_CHANNEL should be equal to DATA_CHANNEL\n const dataChannel = inputs[0].dims[1];\n const filterInChannel = inputs[1].dims[1] * attributes.group;\n if (dataChannel !== filterInChannel) {\n throw new Error('FILTER_IN_CHANNEL should be equal to DATA_CHANNEL');\n }\n\n // if bias is provided it should be 1D and the number of elements should be equal to the number of feature maps\n if (inputs.length === 3 && (inputs[2].dims.length !== 1 || inputs[1].dims[0] !== inputs[2].dims[0])) {\n throw new Error('invalid bias');\n }\n\n const spatialRank = inputs[0].dims.length - 2;\n // wrong dilations dimension\n if (attributes.dilations.length !== spatialRank) {\n throw new Error(`dilations should be ${spatialRank}D`);\n }\n\n // Wrong strides dimension\n if (attributes.strides.length !== spatialRank) {\n throw new Error(`strides should be ${spatialRank}D`);\n }\n\n // Wrong pads dimension\n if (attributes.pads.length !== spatialRank * 2) {\n throw new Error(`pads should be ${spatialRank * 2}D`);\n }\n\n // if kernelShape is specified, it's data length must be 2 less than dims length of the weights tensor\n // (the first 2 dims are batch_size and channels)\n if (attributes.kernelShape.length !== 0 && attributes.kernelShape.length !== inputs[1].dims.length - 2) {\n throw new Error('invalid kernel shape');\n }\n\n // TODO : Need to add support for float64\n if (inputs[0].type !== 'float32' || inputs[1].type !== 'float32') {\n throw new Error('Conv input(X,W) should be float tensor');\n }\n\n if (inputs.length === 3 && inputs[2].type !== 'float32') {\n throw new Error('Conv input(bias) should be float tensor');\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {createAttributeWithCacheKey} from '../../../attribute-with-cache-key';\nimport {InferenceHandler} from '../../../backend';\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {getGlsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, ProgramMetadata, TextureType} from '../types';\n\nimport {ConvAttributes} from './conv';\nimport {getActivationSnippet, parseInternalActivationAttributes} from './fuse-utils';\n\nconst computeTotalPad =\n (inDim: number, stride: number, adj: number, kernel: number, dilation: number, outSize: number) =>\n (inDim - 1) * stride + adj + (kernel - 1) * dilation + 1 - outSize;\n\nconst distributePadding = (totalPad: number, autoPad: string, pads: number[], head: number, tail: number) => {\n const smallPad = Math.floor(totalPad / 2);\n if (autoPad === 'SAME_UPPER') {\n pads[head] = smallPad;\n pads[tail] = totalPad - smallPad;\n } else if (autoPad === 'SAME_LOWER') {\n pads[head] = totalPad - smallPad;\n pads[tail] = smallPad;\n }\n};\n\nconst calculateOutputShapeAndPads =\n (inputShape: readonly number[], kernelShape: readonly number[], dilations: readonly number[], autoPad: string,\n pads: number[], strides: readonly number[], outputPadding: readonly number[], outputShape: number[]) => {\n const spatialRank = inputShape.length - 2;\n const updateShape = outputShape.length === 0;\n for (let i = 0; i < spatialRank; ++i) {\n const outSize = updateShape ? inputShape[i + 2] * strides[i] : outputShape[i];\n const totalPad = computeTotalPad(inputShape[i + 2], strides[i], pads[i], kernelShape[i], dilations[i], outSize);\n distributePadding(totalPad, autoPad, pads, i, i + spatialRank);\n if (updateShape) {\n outputShape.push(\n strides[i] * (inputShape[i + 2] - 1) + outputPadding[i] + (kernelShape[i] - 1) * dilations[i] + 1 -\n pads[i] - pads[i + spatialRank]);\n }\n }\n };\n\nexport interface ConvTransposeAttributes extends ConvAttributes {\n readonly outputPadding: readonly number[];\n readonly outputShape: readonly number[];\n}\n\nexport const convTranspose: OperatorImplementation =\n (inferenceHandler: InferenceHandler, inputs: Tensor[], attributes: ConvTransposeAttributes): Tensor[] => {\n validateInputs(inputs, attributes); // currently will fail if not convTranspose2D\n return convTranspose2d(inferenceHandler, inputs, attributes);\n };\n\nconst convTranspose2d: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: ConvTransposeAttributes): Tensor[] => {\n const adjustedAttributes = getAdjustedConvTransposeAttributes(attributes, inputs);\n return [convTranspose2DUnpacked(inferenceHandler, inputs, adjustedAttributes)];\n };\n\nconst createConvTransposeProgramMetadata = (hasBias: boolean, cacheHint: string) => ({\n name: 'ConvTranspose',\n inputNames: hasBias ? ['X', 'W', 'B'] : ['X', 'W'],\n inputTypes: hasBias ? [TextureType.unpacked, TextureType.unpacked, TextureType.unpacked] :\n [TextureType.unpacked, TextureType.unpacked],\n cacheHint\n});\n\nconst createUnpackedConvTransposeProgramInfo =\n (inferenceHandler: WebGLInferenceHandler, inputs: readonly Tensor[], metadata: ProgramMetadata,\n attributes: ConvTransposeAttributes): ProgramInfo => {\n const hasBias = inputs.length > 2;\n const valueInit = hasBias ? 'getB(output_channel)' : '0.0';\n const xShape = inputs[0].dims;\n const wShape = inputs[1].dims;\n const outputChannelsPerGroup = wShape[1];\n const inputChannelsPerGroup = wShape[0] / attributes.group;\n const outputShape = [inputs[0].dims[0], inputs[1].dims[1] * attributes.group, ...attributes.outputShape];\n const glsl = getGlsl(inferenceHandler.session.backend.glContext.version);\n const {activationFunction, applyActivation} = getActivationSnippet(attributes);\n\n const shaderSource = `\n const ivec2 strides = ivec2(${attributes.strides[0]}, ${attributes.strides[1]});\n const ivec2 pads = ivec2(${attributes.pads[0]}, ${attributes.pads[1]});\n ${activationFunction}\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n int output_channel = coords.y;\n\n ivec2 loc = coords.zw + pads;\n\n int group_id = output_channel / ${outputChannelsPerGroup};\n int wOutChannel = output_channel - group_id * ${outputChannelsPerGroup};\n\n float value = ${valueInit};\n for (int inChannelOffset = 0; inChannelOffset < ${inputChannelsPerGroup}; inChannelOffset++) {\n int input_channel = group_id * ${inputChannelsPerGroup} + inChannelOffset;\n for (int wWOff = 0; wWOff < ${wShape[2]}; wWOff++) {\n for (int wHOff = 0; wHOff < ${wShape[3]}; wHOff++) {\n ivec2 wOff = ivec2(wWOff * ${attributes.dilations[0]}, wHOff * ${attributes.dilations[1]});\n ivec2 wLoc = loc - wOff;\n ivec2 wLocIn = wLoc / strides;\n if (\n wLocIn * strides == wLoc &&\n wLocIn.x >= 0 && wLocIn.x < ${xShape[2]} &&\n wLocIn.y >= 0 && wLocIn.y < ${xShape[3]}\n ) {\n float xVal = getX(batch, input_channel, wLocIn.y, wLocIn.x);\n float wVal = getW(input_channel, wOutChannel, wHOff, wWOff);\n value += xVal * wVal;\n }\n }\n }\n }\n ${applyActivation}\n ${glsl.output} = vec4(value, .0, .0, .0);\n }\n`;\n return {\n ...metadata,\n output: {dims: outputShape, type: inputs[0].type, textureType: TextureType.unpacked},\n shaderSource,\n hasMain: true,\n };\n };\n\nconst createUnpackedConvTransposeProgramInfoLoader =\n (inferenceHandler: WebGLInferenceHandler, inputs: readonly Tensor[], attributes: ConvTransposeAttributes):\n ProgramInfoLoader => {\n const metadata = createConvTransposeProgramMetadata(inputs.length > 2, attributes.cacheKey);\n return {\n ...metadata,\n get: () => createUnpackedConvTransposeProgramInfo(inferenceHandler, inputs, metadata, attributes)\n };\n };\n\n\nconst convTranspose2DUnpacked =\n (inferenceHandler: WebGLInferenceHandler, inputs: readonly Tensor[], attributes: ConvTransposeAttributes):\n Tensor => {\n const result = inferenceHandler.run(\n createUnpackedConvTransposeProgramInfoLoader(inferenceHandler, inputs, attributes), inputs);\n return result;\n };\n\nconst getAdjustedConvTransposeAttributes = (attributes: T, inputs: Tensor[]): T => {\n const kernelShape = attributes.kernelShape.slice();\n // if kernelShape is not specified in the attributes of this op, infer it from the weight tensor dims\n if (attributes.kernelShape.length === 0) {\n for (let i = 2; i < inputs[1].dims.length; ++i) {\n kernelShape.push(inputs[1].dims[i]);\n }\n }\n\n const pads = attributes.pads.slice();\n const outputShape = attributes.outputShape.slice();\n const inputShape = inputs[0].dims;\n // If outputShape is not specified in the attributes of this op, infer it from the parameters\n // Similarly, automatically infer pads if not specified\n calculateOutputShapeAndPads(\n inputShape, kernelShape, attributes.dilations, attributes.autoPad, pads, attributes.strides,\n attributes.outputPadding, outputShape);\n\n // always return a new object so does not modify the original attributes\n const newAttributes: T = Object.assign({}, attributes);\n Object.assign(newAttributes, {kernelShape, pads, outputShape, cacheKey: attributes.cacheKey});\n return newAttributes;\n};\n\nexport const parseConvTransposeAttributes: OperatorInitialization =\n (node: Graph.Node): ConvTransposeAttributes => {\n const attributes = node.attributes;\n const activationAttributes = parseInternalActivationAttributes(attributes);\n // TODO : Make this generic enough to compute default attributes for multi-dimensional conv\n const autoPad = attributes.getString('auto_pad', 'NOTSET');\n const dilations = attributes.getInts('dilations', [1, 1]);\n const group = attributes.getInt('group', 1);\n const kernelShape = attributes.getInts('kernel_shape', []);\n const outputPadding = attributes.getInts('output_padding', [0, 0]);\n const outputShape = attributes.getInts('output_shape', []);\n const pads = attributes.getInts('pads', [0, 0, 0, 0]);\n const strides = attributes.getInts('strides', [1, 1]);\n\n return createAttributeWithCacheKey(\n {autoPad, dilations, group, kernelShape, outputPadding, outputShape, pads, strides, ...activationAttributes});\n };\n\nconst validateInputs = (inputs: Tensor[], attributes: ConvTransposeAttributes): void => {\n // Refer to the below link for all input checks\n // https://github.com/onnx/onnx/blob/main/docs/Operators.md#Conv\n if (!inputs || (inputs.length !== 2 && inputs.length !== 3)) {\n throw new Error('Conv requires 2 or 3 inputs');\n }\n\n // TODO : Need to add support for multi-dimensional conv\n if (inputs[0].dims.length !== 4 || inputs[1].dims.length !== 4) {\n throw new Error('currently only support 2-dimensional conv');\n }\n\n // FILTER_IN_CHANNEL should be equal to DATA_CHANNEL\n const dataChannel = inputs[0].dims[1];\n const filterInChannel = inputs[1].dims[0];\n if (dataChannel !== filterInChannel) {\n throw new Error('FILTER_IN_CHANNEL should be equal to DATA_CHANNEL');\n }\n\n const featureMaps = inputs[1].dims[1] * attributes.group;\n\n // if bias is provided it should be 1D and the number of elements should be equal to the number of feature maps\n if (inputs.length === 3 && (inputs[2].dims.length !== 1 || inputs[2].dims[0] !== featureMaps)) {\n throw new Error('invalid bias');\n }\n\n const spatialRank = inputs[0].dims.length - 2;\n // wrong dilations dimension\n if (attributes.dilations.length !== spatialRank) {\n throw new Error(`dilations should be ${spatialRank}D`);\n }\n\n // Wrong strides dimension\n if (attributes.strides.length !== spatialRank) {\n throw new Error(`strides should be ${spatialRank}D`);\n }\n\n // Wrong pads dimension\n if (attributes.pads.length !== spatialRank * 2) {\n throw new Error(`pads should be ${spatialRank * 2}D`);\n }\n\n // Wrong output padding dimension\n if (attributes.outputPadding.length !== spatialRank) {\n throw new Error(`output_padding should be ${spatialRank}D`);\n }\n\n // if kernelShape is specified, it's data length must be 2 less than dims length of the weights tensor\n // (the first 2 dims are batch_size and channels)\n if (attributes.kernelShape.length !== 0 && attributes.kernelShape.length !== inputs[1].dims.length - 2) {\n throw new Error('invalid kernel shape');\n }\n\n // as with kernelShape, must have same number of spatial dims as input\n if (attributes.outputShape.length !== 0 && attributes.outputShape.length !== inputs[0].dims.length - 2) {\n throw new Error('invalid output shape');\n }\n\n // TODO : Need to add support for float64\n if (inputs[0].type !== 'float32' || inputs[1].type !== 'float32') {\n throw new Error('ConvTranspose input(X,W) should be float tensor');\n }\n\n if (inputs.length === 3 && inputs[2].type !== 'float32') {\n throw new Error('ConvTranspose input(bias) should be float tensor');\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {AttributeWithCacheKey, createAttributeWithCacheKey} from '../../../attribute-with-cache-key';\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {ShapeUtil} from '../../../util';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, TextureType} from '../types';\n\nexport interface TransposeAttributes extends AttributeWithCacheKey {\n readonly perm: number[];\n}\n\nconst transposeProgramMetadata = {\n name: 'Transpose',\n inputNames: ['A'],\n inputTypes: [TextureType.unpacked]\n};\n\nexport const transpose: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: TransposeAttributes): Tensor[] => {\n validateInputs(inputs);\n const output = inferenceHandler.run(\n {\n ...transposeProgramMetadata,\n cacheHint: attributes.cacheKey,\n get: () => createTransposeProgramInfo(inferenceHandler, inputs[0], attributes.perm)\n },\n inputs);\n return [output];\n };\n\nexport const parseTransposeAttributes: OperatorInitialization =\n (node: Graph.Node): TransposeAttributes => createAttributeWithCacheKey({perm: node.attributes.getInts('perm', [])});\n\nconst createTransposeProgramInfo =\n (_inferenceHandler: WebGLInferenceHandler, input: Tensor, perm: number[]): ProgramInfo => {\n const inputShape = input.dims;\n perm = getAdjustedPerm(inputShape, perm);\n const unpackedOutputShape = getOutputShape(inputShape, perm);\n const rank = inputShape.length;\n // A dims=[${inputs[0].dims.toString()}]\n // out Dims=[${unpackedOutputShape.toString()}]\n // based on perm=[${perm.toString()}]\n const shaderSource = `\n ${getPermFunctionBody('perm', perm, rank)}\n float process(int indices[${rank}]) {\n int a[${rank}];\n perm(a, indices);\n return _A(a);\n }`;\n return {\n ...transposeProgramMetadata,\n output: {dims: unpackedOutputShape, type: input.type, textureType: TextureType.unpacked},\n shaderSource\n };\n };\n\nconst getAdjustedPerm = (inputShape: readonly number[], perm: number[]): number[] => {\n if (perm && perm.length !== inputShape.length) {\n perm = [...(inputShape.keys())].reverse();\n }\n return perm;\n};\n\nconst getOutputShape = (inputShape: readonly number[], perm: number[]): readonly number[] => {\n perm = getAdjustedPerm(inputShape, perm);\n return ShapeUtil.sortBasedOnPerm(inputShape, perm);\n};\n\nconst getPermFunctionBody = (name: string, perm: number[], rank: number): string => {\n const reverseFunc = [];\n reverseFunc.push(`void ${name}(out int a[${rank}], int src[${rank}]) {`);\n for (let i = 0; i < rank; ++i) {\n reverseFunc.push(`\\ta[${perm[i]}]=src[${i}];`);\n }\n reverseFunc.push('\\t}');\n return reverseFunc.join('\\n');\n};\n\nconst validateInputs = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length !== 1) {\n throw new Error('Transpose requires 1 input.');\n }\n\n if (inputs[0].type !== 'float32' && inputs[0].type !== 'float64') {\n throw new Error('input should be float tensor');\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {WebGLInferenceHandler} from '../inference-handler';\n\nimport {transpose, TransposeAttributes} from './transpose';\n\nexport interface DepthToSpaceAttributes {\n mode: 'DCR'|'CRD';\n blocksize: number;\n}\n\nexport const depthToSpace: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: DepthToSpaceAttributes): Tensor[] => {\n validateInputs(inputs);\n const blocksize = attributes.blocksize;\n const blocksizeSqr = blocksize * blocksize;\n const transposePerm = attributes.mode === 'DCR' ? [0, 3, 4, 1, 5, 2] : [0, 1, 4, 2, 5, 3];\n const firstReshapeShape = attributes.mode === 'DCR' ?\n [\n inputs[0].dims[0], blocksize, blocksize, inputs[0].dims[1] / blocksizeSqr, inputs[0].dims[2],\n inputs[0].dims[3]\n ] :\n [\n inputs[0].dims[0], inputs[0].dims[1] / blocksizeSqr, blocksize, blocksize, inputs[0].dims[2],\n inputs[0].dims[3]\n ];\n\n // const transpose = new WebGLTranspose();\n // const attributes = new Attribute(undefined);\n // attributes.set('perm', 'ints', transposePerm);\n // transpose.initialize(attributes);\n\n // First reshape\n const firstReshapedTensor = inferenceHandler.reshapeUnpacked(inputs[0], firstReshapeShape);\n\n // transpose\n const transposeAttributes: TransposeAttributes = {perm: transposePerm, cacheKey: `${transposePerm}`};\n const [transposeOutput] = transpose(inferenceHandler, [firstReshapedTensor], transposeAttributes);\n\n // Second reshape\n const secondReshapeShape = [\n inputs[0].dims[0], inputs[0].dims[1] / blocksizeSqr, inputs[0].dims[2] * blocksize,\n inputs[0].dims[3] * blocksize\n ];\n const result = inferenceHandler.reshapeUnpacked(transposeOutput, secondReshapeShape);\n return [result];\n };\n\nexport const parseDepthToSpaceAttributes: OperatorInitialization =\n (node: Graph.Node): DepthToSpaceAttributes => {\n // processing node attributes\n const blocksize = node.attributes.getInt('blocksize');\n if (blocksize < 1) {\n throw new Error(`blocksize must be >= 1, but got : ${blocksize} for DepthToSpace`);\n }\n const mode = node.attributes.getString('mode', 'DCR');\n if (mode !== 'DCR' && mode !== 'CRD') {\n throw new Error(`unrecognized mode: ${mode} for DepthToSpace`);\n }\n return {mode, blocksize};\n };\n\nconst validateInputs = (inputs: Tensor[]): void => {\n if (inputs.length !== 1) {\n throw new Error(`DepthToSpace expect 1 inputs, but got ${inputs.length}`);\n }\n\n // Input has to be a 4-D tensor\n // TODO: Support string depth-to-space.\n if (inputs[0].type === 'string' || inputs[0].dims.length !== 4) {\n throw new TypeError('DepthToSpace input should be a 4-D numeric tensor');\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {ShapeUtil} from '../../../util';\nimport {WebGLInferenceHandler} from '../inference-handler';\n\nexport const flatten: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], axis: number): Tensor[] => {\n validateInputs(inputs, axis);\n\n const outputDims = ShapeUtil.flattenShape(inputs[0].dims, axis);\n return [inferenceHandler.reshapeUnpacked(inputs[0], outputDims)];\n };\n\nexport const parseFlattenAttributes: OperatorInitialization = (node: Graph.Node): number =>\n node.attributes.getInt('axis', 1); // default axis is 1\n\nconst validateInputs = (inputs: Tensor[], axis: number): void => {\n if (!inputs || inputs.length !== 1) {\n throw new Error('Flatten requires 1 input.');\n }\n\n const r = inputs[0].dims.length;\n if (r === 0) {\n throw new Error('scalar tensor is not supported.');\n }\n\n if (axis < -r || axis > r) {\n throw new Error('Invalid axis');\n }\n\n // TODO: Support string type\n if (inputs[0].type === 'string') {\n throw new Error('string tensor is not supported.');\n }\n};","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {InferenceHandler} from './backend';\nimport {Graph} from './graph';\nimport {Tensor} from './tensor';\n\nexport type OperatorImplementation = (inferenceHandler: InferenceHandler, inputs: Tensor[], context: T) => Tensor[];\nexport type OperatorInitialization = (node: Graph.Node, graph: Graph) => T;\n\nexport interface Operator {\n readonly impl: OperatorImplementation;\n readonly context: Graph.Node|unknown;\n}\n\nexport const NUMBER_TYPES: readonly Tensor.DataType[] =\n ['float32', 'float64', 'int32', 'int16', 'int8', 'uint16', 'uint32', 'uint8'];\nexport const INT_TYPES: readonly Tensor.DataType[] = ['int32', 'int16', 'int8', 'uint16', 'uint32', 'uint8'];\nexport const FLOAT_TYPES: readonly Tensor.DataType[] = ['float32', 'float64'];\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {AttributeWithCacheKey, createAttributeWithCacheKey} from '../../../attribute-with-cache-key';\nimport {Graph} from '../../../graph';\nimport {NUMBER_TYPES, OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {ShapeUtil} from '../../../util';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, ProgramMetadata, TextureType} from '../types';\n\ninterface GatherAttributes extends AttributeWithCacheKey {\n readonly axis: number;\n}\n\nexport const gather: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: GatherAttributes): Tensor[] => {\n validateInputs(inputs, attributes.axis);\n const output = inferenceHandler.run(createGatherProgramInfoLoader(inferenceHandler, inputs, attributes), inputs);\n return [output];\n };\n\nexport const parseGatherAttributes: OperatorInitialization = (node: Graph.Node): GatherAttributes =>\n createAttributeWithCacheKey({axis: node.attributes.getInt('axis', 0)});\n\nconst gatherProgramMetadata = {\n name: 'Gather',\n inputNames: ['A', 'B'],\n inputTypes: [TextureType.unpacked, TextureType.unpacked],\n};\n\nconst createGatherProgramInfo =\n (_handler: WebGLInferenceHandler, metadata: ProgramMetadata, inputs: Tensor[], axis: number): ProgramInfo => {\n const inputShape = inputs[0].dims.slice();\n const indexDataShape = inputs[1].dims.slice();\n const outputShape = new Array(inputShape.length + indexDataShape.length - 1);\n\n axis = ShapeUtil.normalizeAxis(axis, inputShape.length);\n const indexCopyOps: string[] = [];\n for (let i = 0; i < outputShape.length; i++) {\n // outputShape is divided into three parts: A, B, C\n // |0 axis| axis + indexDataShape.length | end|\n // | A | B | C |\n //\n // inputIdx: [A, inputs[1][B], C]\n if (i < axis) { // A\n outputShape[i] = inputShape[i];\n indexCopyOps.push(`inputIdx[${i}] = outputIdx[${i}];`);\n } else {\n if (i < axis + indexDataShape.length) { // B\n outputShape[i] = indexDataShape[i - axis];\n indexCopyOps.push(`indexDataIdx[${i - axis}] = outputIdx[${i}];`);\n } else { // C\n outputShape[i] = inputShape[i - indexDataShape.length + 1]; // skip 1 for axis\n indexCopyOps.push(`inputIdx[${i - indexDataShape.length + 1}] = outputIdx[${i}];`);\n }\n }\n }\n\n const orank = outputShape.length || 1;\n const irank = inputShape.length;\n const iDrank = indexDataShape.length || 1;\n const shaderSource = `\n float process(int outputIdx[${orank}]) {\n int inputIdx[${irank}];\n int indexDataIdx[${iDrank}];\n indexDataIdx[0] = 0;\n ${indexCopyOps.join('\\n ')}\n int idx = int(_B(indexDataIdx));\n inputIdx[${axis}] = idx < 0 ? idx + ${inputShape[axis]} : idx;\n return _A(inputIdx);\n }`;\n return {\n ...metadata,\n output: {dims: outputShape, type: inputs[0].type, textureType: TextureType.unpacked},\n shaderSource\n };\n };\n\nconst createGatherProgramInfoLoader =\n (handler: WebGLInferenceHandler, inputs: Tensor[], attributes: GatherAttributes): ProgramInfoLoader => {\n const metadata = {...gatherProgramMetadata, cacheHint: attributes.cacheKey};\n return {...metadata, get: () => createGatherProgramInfo(handler, metadata, inputs, attributes.axis)};\n };\n\nconst validateInputs = (inputs: Tensor[], axis: number): void => {\n if (!inputs || inputs.length !== 2) {\n throw new Error('Gather requires 2 inputs.');\n }\n const tensorRank = inputs[0].dims.length;\n if (tensorRank < 1) {\n throw new Error('Invalid input shape.');\n }\n if (axis < -tensorRank || axis > tensorRank - 1) {\n throw new Error('Invalid axis.');\n }\n if (NUMBER_TYPES.indexOf(inputs[0].type) === -1) {\n throw new Error('Invaid input type.');\n }\n if (inputs[1].type !== 'int32' && inputs[1].type !== 'int16') {\n throw new Error('Invaid input type.');\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {AttributeWithCacheKey, createAttributeWithCacheKey} from '../../../attribute-with-cache-key';\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {GemmUtil} from '../../../util';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, ProgramMetadata, TextureType} from '../types';\n\nexport interface GemmAttributes extends AttributeWithCacheKey {\n transA: boolean;\n transB: boolean;\n alpha: number;\n beta: number;\n isOptionalC: boolean; // in opset 11, C becomes optional\n}\n\nexport const gemm: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: GemmAttributes): Tensor[] => {\n validateInputs(inputs, attributes);\n const output = inferenceHandler.run(createGemmProgramInfoLoader(inputs, attributes), inputs);\n return [output];\n };\n\nconst parseGemmAttributes = (node: Graph.Node, isOptionalC: boolean): GemmAttributes => {\n const transA = node.attributes.getInt('transA', 0) !== 0;\n const transB = node.attributes.getInt('transB', 0) !== 0;\n const alpha = node.attributes.getFloat('alpha', 1.0);\n const beta = node.attributes.getFloat('beta', 1.0);\n return createAttributeWithCacheKey({transA, transB, alpha, beta, isOptionalC});\n};\n\nexport const parseGemmAttributesV7: OperatorInitialization = (node: Graph.Node): GemmAttributes =>\n parseGemmAttributes(node, false);\n\nexport const parseGemmAttributesV11: OperatorInitialization = (node: Graph.Node): GemmAttributes =>\n parseGemmAttributes(node, true);\n\nconst createGemmProgramInfoLoader = (inputs: Tensor[], attributes: GemmAttributes): ProgramInfoLoader => {\n const metadata = {\n name: 'Gemm',\n inputNames: inputs.length === 3 ? ['A', 'B', 'C'] : ['A', 'B'],\n inputTypes: inputs.length === 3 ? [TextureType.unpacked, TextureType.unpacked, TextureType.unpacked] :\n [TextureType.unpacked, TextureType.unpacked],\n key: attributes.cacheKey\n };\n\n return {...metadata, get: () => createGemmProgramInfo(metadata, inputs, attributes)};\n};\n\nconst createGemmProgramInfo =\n (metadata: ProgramMetadata, inputs: Tensor[], attributes: GemmAttributes): ProgramInfo => {\n const aShape = inputs[0].dims.slice();\n const bShape = inputs[1].dims.slice();\n const [M, N] = GemmUtil.getShapeOfGemmResult(\n aShape, attributes.transA, bShape, attributes.transB, inputs.length === 3 ? inputs[2].dims : undefined);\n const outputShape = [M, N];\n if (!outputShape) {\n throw new Error('Can\\'t use gemm on the given tensors');\n }\n let sharedDim = aShape[aShape.length - 1];\n let line = '';\n if (attributes.transA) {\n sharedDim = aShape[0];\n }\n if (attributes.transA && attributes.transB) {\n line = 'value += _A_T(a) * _B_T(b);';\n } else if (attributes.transA && !attributes.transB) {\n line = 'value += _A_T(a) * _B(b);';\n } else if (!attributes.transA && attributes.transB) {\n line = 'value += _A(a) * _B_T(b);';\n } else if (!attributes.transA && !attributes.transB) {\n line = 'value += _A(a) * _B(b);';\n }\n const rank = outputShape.length;\n const declareC = inputs.length === 3 ? `int c[${inputs[2].dims.length}];` : '';\n const broadcastC = inputs.length === 3 ? 'bcastIndices_C(indices, c);' : '';\n const calculateC = inputs.length === 3 ? 'value += beta * _C(c);' : '';\n const shaderSource = `\n float process(int indices[${rank}]) {\n int a[${rank}];\n int b[${rank}];\n ${declareC}\n\n copyVec(indices, a);\n copyVec(indices, b);\n ${broadcastC}\n\n float value = 0.0;\n for (int k=0; k<${sharedDim}; ++k) {\n a[${rank - 1}] = k;\n b[${rank - 2}] = k;\n ${line}\n }\n\n value = value * alpha;\n ${calculateC}\n return value;\n }`;\n return {\n ...metadata,\n output: {dims: outputShape, type: inputs[0].type, textureType: TextureType.unpacked},\n variables: [\n {name: 'alpha', type: 'float', data: attributes.alpha}, {name: 'beta', type: 'float', data: attributes.beta}\n ],\n shaderSource\n };\n };\n\nconst validateInputs = (inputs: Tensor[], attributes: GemmAttributes): void => {\n if (!inputs) {\n throw new Error('Input is missing');\n }\n if (attributes.isOptionalC && (inputs.length < 2 || inputs.length > 3)) {\n throw new Error('Invaid input shape.');\n }\n if (!attributes.isOptionalC && inputs.length !== 3) {\n throw new Error('Gemm requires 3 inputs');\n }\n\n // 'C' can be of dimensionality 1 or 2 only\n if (inputs.length === 3 && inputs[2].dims.length !== 1 && inputs[2].dims.length !== 2) {\n throw new Error('Invalid input shape of C');\n }\n\n if ((inputs[0].type !== 'float32' && inputs[0].type !== 'float64') ||\n (inputs[1].type !== 'float32' && inputs[1].type !== 'float64') ||\n (inputs.length === 3 && inputs[2].type !== 'float32' && inputs[2].type !== 'float64')) {\n throw new Error('Invalid input type.');\n }\n\n if ((inputs[0].type !== inputs[1].type) || (inputs.length === 3 && inputs[0].type !== inputs[2].type)) {\n throw new Error('Input types are mismatched');\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {AttributeWithCacheKey, createAttributeWithCacheKey} from '../../../attribute-with-cache-key';\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, ProgramMetadata, TextureType} from '../types';\n\nexport interface ImageScalerAttributes extends AttributeWithCacheKey {\n scale: number;\n bias: number[];\n}\n\nexport const imageScaler: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: ImageScalerAttributes): Tensor[] => {\n validateInputs(inputs);\n const output =\n inferenceHandler.run(createImageScalerProgramInfoLoader(inferenceHandler, inputs, attributes), inputs);\n return [output];\n };\n\nexport const parseImageScalerAttributes: OperatorInitialization =\n (node: Graph.Node): ImageScalerAttributes => {\n const scale = node.attributes.getFloat('scale');\n const bias = node.attributes.getFloats('bias');\n return createAttributeWithCacheKey({scale, bias});\n };\n\nconst imageScalerProgramMetadata = {\n name: 'ImageScaler',\n inputNames: ['X'],\n inputTypes: [TextureType.unpacked],\n};\n\nconst createImageScalerProgramInfo =\n (_handler: WebGLInferenceHandler, metadata: ProgramMetadata, inputs: Tensor[], attributes: ImageScalerAttributes):\n ProgramInfo => {\n const outputShape = inputs[0].dims.slice();\n const rank = outputShape.length;\n const getBiasMethod = createGetBiasMethod(attributes.bias.length);\n const shaderSource = `\n ${getBiasMethod}\n float process(int indices[${rank}]) {\n return _X(indices) * scale + getBias(bias, indices[1]);\n }`;\n return {\n ...metadata,\n output: {dims: outputShape, type: inputs[0].type, textureType: TextureType.unpacked},\n variables: [\n {name: 'bias', type: 'float', arrayLength: attributes.bias.length, data: attributes.bias},\n {name: 'scale', type: 'float', data: attributes.scale}\n ],\n shaderSource\n };\n };\n\nconst createImageScalerProgramInfoLoader =\n (handler: WebGLInferenceHandler, inputs: Tensor[], attributes: ImageScalerAttributes): ProgramInfoLoader => {\n const metadata = {...imageScalerProgramMetadata, cacheHint: attributes.cacheKey};\n return {...metadata, get: () => createImageScalerProgramInfo(handler, metadata, inputs, attributes)};\n };\n\nconst createGetBiasMethod = (numChannels: number): string => {\n const codeLines: string[] = [`float getBias(float bias[${numChannels}], int channel) {`];\n for (let i = 0; i < numChannels; ++i) {\n if (i === 0) {\n codeLines.push(\n '\\t' +\n `if (channel == ${i}) { return bias[${i}]; }`);\n } else if (i === numChannels - 1) {\n codeLines.push(\n '\\t' +\n `else { return bias[${i}]; }`);\n } else {\n codeLines.push(\n '\\t' +\n `else if (channel == ${i}) { return bias[${i}]; }`);\n }\n }\n codeLines.push(\n '\\t' +\n '}');\n return codeLines.join('\\n');\n};\n\nconst validateInputs = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length !== 1) {\n throw new Error('ImageScaler requires 1 input.');\n }\n if (inputs[0].dims.length !== 4) {\n throw new Error('Invalid input shape.');\n }\n if (inputs[0].type !== 'float32' && inputs[0].type !== 'float64') {\n throw new Error('Invalid input type.');\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {getGlsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, ProgramMetadata, TextureType} from '../types';\n\nexport const instanceNormalization: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], epsilon: number): Tensor[] => {\n validateInputs(inputs);\n\n const meanAndVariance = inferenceHandler.run(createMeanAndVarianceProgramInfoLoader(inputs[0]), inputs);\n const output = inferenceHandler.run(\n createComputeOutputProgramInfoLoader(inferenceHandler, inputs[0], epsilon, meanAndVariance.dims),\n [inputs[0], meanAndVariance, inputs[1], inputs[2]]);\n return [output];\n };\n\nexport const parseInstanceNormalizationAttributes: OperatorInitialization = (node: Graph.Node): number =>\n node.attributes.getFloat('epsilon', 1e-5);\n\nconst meanAndVarianceProgramMetadata = {\n name: 'InstanceNormalization_MeanAndVariance',\n inputNames: ['X'],\n inputTypes: [TextureType.unpacked],\n};\n\nconst createMeanAndVarianceProgramInfo = (metadata: ProgramMetadata, input: Tensor): ProgramInfo => {\n const xDims = input.dims.slice();\n const channel = xDims[1];\n const channelSize = xDims[2] * xDims[3];\n const outputShape = [xDims[0], channel];\n\n const shaderSource = `\n vec4 process(int[2] indices) {\n vec4 v = vec4(0.0);\n int a[4];\n a[0] = indices[0];\n a[1] = indices[1];\n float temp = 0.0;\n for(int a2=0; a2<${xDims[2]}; a2++) {\n a[2] = a2;\n for(int a3=0; a3<${xDims[3]}; a3++) {\n a[3] = a3;\n float x = _X(a);\n temp += x;\n }\n }\n float mean = temp / float(${channelSize});\n temp = 0.0;\n for(int a2=0; a2<${xDims[2]}; a2++) {\n a[2] = a2;\n for(int a3=0; a3<${xDims[3]}; a3++) {\n a[3] = a3;\n float x = _X(a);\n temp += (x - mean) * (x - mean);\n }\n }\n v.r = mean;\n v.g = temp / float(${channelSize});\n\n return v;\n }`;\n return {\n ...metadata,\n output: {dims: outputShape, type: input.type, textureType: TextureType.packedLastDimension},\n shaderSource\n };\n};\n\nconst createMeanAndVarianceProgramInfoLoader = (input: Tensor): ProgramInfoLoader => ({\n ...meanAndVarianceProgramMetadata,\n get: () => createMeanAndVarianceProgramInfo(meanAndVarianceProgramMetadata, input)\n});\n\nconst computeOutputProgramMetadata = {\n name: 'InstanceNormalization_ComputeOutput',\n inputNames: ['X', 'MeanAndVariance', 'Scale', 'B'],\n inputTypes: [TextureType.unpacked, TextureType.packedLastDimension, TextureType.unpacked, TextureType.unpacked],\n};\n\nconst createComputeOutputProgramInfo =\n (inferenceHandler: WebGLInferenceHandler, metadata: ProgramMetadata, input: Tensor, epsilon: number,\n meanAndVarianceShape: readonly number[]): ProgramInfo => {\n const glsl = getGlsl(inferenceHandler.session.backend.glContext.version);\n const [textureWidth, textureHeight] =\n inferenceHandler.calculateTextureWidthAndHeight(meanAndVarianceShape, TextureType.packedLastDimension);\n const [meanAndVarianceWidth, meanAndVarianceHeight] = [textureWidth / 4, textureHeight];\n const shaderSource = `\n vec4 get_MeanAndVariance(int[2] mv) {\n int offset = indicesToOffset_MeanAndVariance(mv);\n vec2 coords = offsetToCoords(offset, ${meanAndVarianceWidth}, ${meanAndVarianceHeight});\n return ${glsl.texture2D}(MeanAndVariance, coords);\n }\n\n float process(int[4] indices) {\n int mv[2];\n mv[0] = indices[0];\n mv[1] = indices[1];\n vec4 mean_and_variance = get_MeanAndVariance(mv);\n float mean = mean_and_variance.r;\n float variance = mean_and_variance.g;\n\n int sb[1];\n sb[0] = indices[1];\n float scale = _Scale(sb);\n float b = _B(sb);\n\n return scale * (_X(indices) - mean) / sqrt(variance + epsilon) + b;\n }`;\n return {\n ...metadata,\n output: {dims: input.dims, type: input.type, textureType: TextureType.unpacked},\n variables: [{name: 'epsilon', type: 'float', data: epsilon}],\n shaderSource\n };\n };\n\nconst createComputeOutputProgramInfoLoader =\n (inferenceHandler: WebGLInferenceHandler, input: Tensor, epsilon: number, meanAndVarianceShape: readonly number[]):\n ProgramInfoLoader => {\n const metadata = {...computeOutputProgramMetadata, cacheHint: `${epsilon}`};\n return {\n ...metadata,\n get: () => createComputeOutputProgramInfo(inferenceHandler, metadata, input, epsilon, meanAndVarianceShape)\n };\n };\n\nconst validateInputs = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length !== 3) {\n throw new Error('InstanceNormalization requires 3 inputs.');\n }\n\n const X = inputs[0];\n const scale = inputs[1];\n const B = inputs[2];\n\n // input should at least have three dimensions - N,C,dim1,...,dimn\n // other inputs can have only one dimensions\n if (X.dims.length < 3 || scale.dims.length !== 1 || B.dims.length !== 1) {\n throw new Error('Invalid input shape.');\n }\n if (scale.dims[0] !== X.dims[1] || B.dims[0] !== X.dims[1]) {\n throw new Error('Input shapes are mismatched.');\n }\n if ((X.type !== 'float32' && X.type !== 'float64') || (scale.type !== 'float32' && scale.type !== 'float64') ||\n (B.type !== 'float32' && B.type !== 'float64')) {\n throw new Error('Invalid input type.');\n }\n if (inputs[0].dims.length !== 4) {\n throw new Error('Only support 4-D input shape.');\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {AttributeWithCacheKey, createAttributeWithCacheKey} from '../../../attribute-with-cache-key';\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramInfoLoader, TextureType} from '../types';\n\nexport interface LrnAttributes extends AttributeWithCacheKey {\n alpha: number;\n beta: number;\n bias: number;\n size: number;\n}\n\nexport const lrn: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: LrnAttributes): Tensor[] => {\n validateInputs(inputs);\n\n // if (inferenceHandler.session.pack) {\n // return [inferenceHandler.run(createPackedLrnProgramInfoLoader(inferenceHandler, inputs, attributes),\n // inputs)];\n // } else {\n return [inferenceHandler.run(createLrnProgramInfoLoader(inputs, attributes), inputs)];\n //}\n };\n\nexport const parseLrnAttributes: OperatorInitialization = (node: Graph.Node): LrnAttributes => {\n const alpha = node.attributes.getFloat('alpha', 0.0001);\n const beta = node.attributes.getFloat('beta', 0.75);\n const bias = node.attributes.getFloat('bias', 1.0);\n const size = node.attributes.getInt('size');\n\n return createAttributeWithCacheKey({alpha, beta, bias, size});\n};\n\nconst lrnProgramMetadata = {\n name: 'LRN',\n inputNames: ['X'],\n inputTypes: [TextureType.unpacked]\n};\n\nfunction createLrnProgramInfo(inputs: Tensor[], attributes: LrnAttributes): ProgramInfo {\n const C = inputs[0].dims[1];\n const rank = inputs[0].dims.length;\n const from = -Math.floor((attributes.size - 1) / 2);\n const to = Math.ceil((attributes.size - 1) / 2);\n const alpha = `float(${attributes.alpha}) / float(${attributes.size})`;\n const bias = `float(${attributes.bias})`;\n const beta = `float(${attributes.beta})`;\n\n const shaderSource = `\n float process(int indices[${rank}]) {\n int c = indices[1];\n float x = _X(indices);\n float square_sum = 0.0;\n\n for (int i = ${from}; i <= ${to}; i++) {\n int idx = c + i;\n if (c >= 0 && c < ${C}) {\n indices[1] = idx;\n float j = _X(indices);\n square_sum += j * j;\n }\n }\n return x / pow(${bias} + ${alpha} * square_sum, ${beta});\n }`;\n return {\n ...lrnProgramMetadata,\n cacheHint: attributes.cacheKey,\n output: {dims: inputs[0].dims, type: inputs[0].type, textureType: TextureType.unpacked},\n shaderSource,\n };\n}\n\nexport function createLrnProgramInfoLoader(inputs: Tensor[], attributes: LrnAttributes): ProgramInfoLoader {\n return {...lrnProgramMetadata, cacheHint: attributes.cacheKey, get: () => createLrnProgramInfo(inputs, attributes)};\n}\n\nconst validateInputs = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length !== 1) {\n throw new Error('LRN requires 1 input.');\n }\n if (inputs[0].dims.length !== 4) {\n throw new Error('currently only support LRN for input with \"NCHW\" format');\n }\n if (inputs[0].type !== 'float32') {\n throw new Error('input should be float type');\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {AttributeWithCacheKey, createAttributeWithCacheKey} from '../../../attribute-with-cache-key';\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {ShapeUtil} from '../../../util';\nimport {getGlsl, Glsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, TextureType} from '../types';\n\nexport interface PadAttributes extends AttributeWithCacheKey {\n readonly mode: string;\n readonly pads: number[];\n readonly value: number;\n}\n\nconst padProgramMetadata = {\n name: 'Pad',\n inputNames: ['A'],\n inputTypes: [TextureType.unpacked],\n};\n\nexport const padV2: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: PadAttributes): Tensor[] => {\n validateInputsV2(inputs);\n const output = inferenceHandler.run(\n {\n ...padProgramMetadata,\n cacheHint: attributes.cacheKey,\n get: () => createPadProgramInfo(inferenceHandler, inputs[0], attributes)\n },\n inputs);\n return [output];\n };\n\nexport const parsePadAttributesV2: OperatorInitialization = (node: Graph.Node): PadAttributes => {\n const mode = node.attributes.getString('mode', 'constant');\n const value = node.attributes.getFloat('value', 0.0);\n const pads = node.attributes.getInts('pads');\n return createAttributeWithCacheKey({mode, value, pads});\n};\n\nexport const padV11: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], mode: string): Tensor[] => {\n validateInputsV11(inputs);\n const attrubutes = generatePadAttributesFromInputs(inferenceHandler, inputs, mode);\n return padV2(inferenceHandler, [inputs[0]], attrubutes);\n };\n\nexport const parsePadAttributesV11: OperatorInitialization = (node: Graph.Node): string =>\n node.attributes.getString('mode', 'constant');\n\nconst generatePadAttributesFromInputs =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], mode: string): PadAttributes => {\n if (!inferenceHandler.session.isInitializer(inputs[1].dataId) ||\n (inputs.length >= 3 && !inferenceHandler.session.isInitializer(inputs[2].dataId))) {\n throw new Error('dynamic pad attributes are not allowed');\n }\n\n const pads = Array.from(inputs[1].integerData);\n const value = (inputs.length >= 3) ? inputs[2].floatData[0] : 0.0;\n\n return createAttributeWithCacheKey({mode, pads, value});\n };\n\nconst createPadProgramInfo =\n (inferenceHandler: WebGLInferenceHandler, input: Tensor, attributes: PadAttributes): ProgramInfo => {\n const outputShape = ShapeUtil.padShape(input.dims.slice(), attributes.pads);\n const rank = outputShape.length;\n const padFunction = getPadFunction(inferenceHandler, input, attributes);\n const shaderSource = `\n ${padFunction}\n float process(int[${rank}] indices) {\n return padA(indices);\n }`;\n return {\n name: 'Pad',\n inputNames: ['A'],\n inputTypes: [TextureType.unpacked],\n output: {dims: outputShape, type: input.type, textureType: TextureType.unpacked},\n shaderSource\n };\n };\n\nconst validateInputsV2 = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length !== 1) {\n throw new Error('Pad requires 1 input');\n }\n if (inputs[0].type !== 'float32' && inputs[0].type !== 'float64') {\n throw new Error('Invalid input type.');\n }\n};\n\nconst validateInputsV11 = (inputs: Tensor[]): void => {\n if (!inputs || (inputs.length !== 2 && inputs.length !== 3)) {\n throw new Error('Pad requires 2 or 3 inputs');\n }\n if (inputs[1].type !== 'int32') {\n throw new Error('Invalid input type.');\n }\n if (inputs.length >= 3 && inputs[2].type === 'string') {\n throw new Error('Invalid input type.');\n }\n};\n\nconst getPadFunction = (inferenceHandler: WebGLInferenceHandler, input: Tensor, attributes: PadAttributes): string => {\n const glsl = getGlsl(inferenceHandler.session.backend.glContext.version);\n const [width, height] = inferenceHandler.calculateTextureWidthAndHeight(input.dims, TextureType.unpacked);\n const strides = ShapeUtil.computeStrides(input.dims);\n\n switch (attributes.mode) {\n case 'constant':\n return getPadConstant(glsl, input.dims, strides, width, height, attributes.pads, attributes.value);\n case 'reflect':\n return getPadReflect(glsl, input.dims, strides, width, height, attributes.pads);\n case 'edge':\n return getPadEdge(glsl, input.dims, strides, width, height, attributes.pads);\n default:\n throw new Error('Invalid mode');\n }\n};\n\nconst getPadConstant =\n (glsl: Glsl, shape: readonly number[], strides: readonly number[], width: number, height: number, pads: number[],\n value: number): string => {\n const rank = shape.length;\n let block = '';\n for (let i = rank - 1; i >= 0; --i) {\n block += `\n k = m[${i}] - ${pads[i]};\n if (k < 0) return constant;\n if (k >= ${shape[i]}) return constant;\n offset += k * ${strides[i]};\n `;\n }\n return `\n float padA(int m[${rank}]) {\n const float constant = float(${value});\n int offset = 0;\n int k = 0;\n ${block}\n vec2 coords = offsetToCoords(offset, ${width}, ${height});\n float value = getColorAsFloat(${glsl.texture2D}(A, coords));\n return value;\n }\n `;\n };\n\nconst getPadReflect =\n (glsl: Glsl, shape: readonly number[], strides: readonly number[], width: number, height: number, pads: number[]):\n string => {\n const rank = shape.length;\n\n let block = '';\n for (let i = rank - 1; i >= 0; --i) {\n block += `\n k = m[${i}] - ${pads[i]};\n if (k < 0) { k = -k; }\n {\n const int _2n_1 = ${2 * (shape[i] - 1)};\n k = int( mod( float(k), float(_2n_1) ) ) ;\n if(k >= ${shape[i]}) { k = _2n_1 - k; }\n }\n offset += k * ${strides[i]};\n `;\n }\n return `\n float padA(int m[${rank}]) {\n int offset = 0;\n int k = 0;\n ${block}\n vec2 coords = offsetToCoords(offset, ${width}, ${height});\n float value = getColorAsFloat(${glsl.texture2D}(A, coords));\n return value;\n }\n `;\n };\n\nconst getPadEdge =\n (glsl: Glsl, shape: readonly number[], strides: readonly number[], width: number, height: number, pads: number[]):\n string => {\n const rank = shape.length;\n\n let block = '';\n for (let i = rank - 1; i >= 0; --i) {\n block += `\n k = m[${i}] - ${pads[i]};\n if (k < 0) k = 0;\n if (k >= ${shape[i]}) k = ${shape[i] - 1};\n offset += k * ${strides[i]};\n `;\n }\n return `\n float padA(int m[${rank}]) {\n int offset = 0;\n int k = 0;\n ${block}\n vec2 coords = offsetToCoords(offset, ${width}, ${height});\n float value = getColorAsFloat(${glsl.texture2D}(A, coords));\n return value;\n }\n `;\n };\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {AttributeWithCacheKey, createAttributeWithCacheKey} from '../../../attribute-with-cache-key';\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {PoolConvUtil, ShapeUtil} from '../../../util';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramMetadata, TextureType} from '../types';\n\nexport interface AveragePoolAttributes extends AttributeWithCacheKey {\n readonly autoPad: string;\n readonly ceilMode: number;\n readonly countIncludePad: boolean;\n readonly kernelShape: readonly number[];\n readonly strides: readonly number[];\n readonly pads: readonly number[];\n}\n\nexport const averagePool: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: AveragePoolAttributes): Tensor[] => {\n validateInputs(inputs);\n const metadata =\n {name: 'AveragePool', inputNames: ['X'], inputTypes: [TextureType.unpacked], cacheHint: attributes.cacheKey};\n const output = inferenceHandler.run(\n {...metadata, get: () => createAveragePoolProgramInfo(inputs, metadata, false, attributes)}, inputs);\n return [output];\n };\n\nexport const parseAveragePoolAttributes: OperatorInitialization =\n (node: Graph.Node): AveragePoolAttributes => {\n const autoPad = node.attributes.getString('auto_pad', 'NOTSET');\n const ceilMode = node.attributes.getInt('ceil_mode', 0);\n const countIncludePad = (node.attributes.getInt('count_include_pad', 0) === 0 ? false : true);\n const kernelShape = node.attributes.getInts('kernel_shape');\n const strides = node.attributes.getInts('strides', []);\n const pads = node.attributes.getInts('pads', []);\n\n // TODO: support attribute 'ceil_mode'\n if (ceilMode !== 0) {\n throw new Error('using ceil() in shape computation is not yet supported for AveragePool');\n }\n\n return createAttributeWithCacheKey({autoPad, ceilMode, countIncludePad, kernelShape, strides, pads});\n };\n\nconst createAveragePoolProgramInfo =\n (inputs: Tensor[], metadata: ProgramMetadata, isGlobalOperator: boolean, attributes: AveragePoolAttributes):\n ProgramInfo => {\n const [adjustedAttributes, outputShape] =\n getAdjustedPoolAttributesAndOutputShape(inputs, attributes, isGlobalOperator);\n const kernelSize = ShapeUtil.size(adjustedAttributes.kernelShape);\n const op1 = 'value += _X(x);';\n let op2 = '';\n if (adjustedAttributes.countIncludePad) {\n op2 += `value /= float(${kernelSize});`;\n } else {\n op2 += `value /= float(${kernelSize} - pad);`;\n }\n const poolingCode = generatePoolingCode(inputs[0].dims, adjustedAttributes, op1, op2, '0.0');\n const shaderSource = `\n ${poolingCode}\n `;\n return {\n ...metadata,\n output: {dims: outputShape, type: inputs[0].type, textureType: TextureType.unpacked},\n shaderSource\n };\n };\n\nexport const globalAveragePool: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: AveragePoolAttributes): Tensor[] => {\n validateInputs(inputs);\n const metadata = {\n name: 'GlobalAveragePool',\n inputNames: ['X'],\n inputTypes: [TextureType.unpacked],\n cacheHint: `${attributes.countIncludePad}`\n };\n const output = inferenceHandler.run(\n {...metadata, get: () => createAveragePoolProgramInfo(inputs, metadata, true, attributes)}, inputs);\n return [output];\n };\n\nexport const parseGlobalAveragePoolAttributes: OperatorInitialization =\n (node: Graph.Node): AveragePoolAttributes => {\n const countIncludePad = (node.attributes.getInt('count_include_pad', 0) === 0 ? false : true);\n return createAttributeWithCacheKey(\n {autoPad: '', ceilMode: 0, countIncludePad, kernelShape: [], strides: [], pads: []});\n };\n\nexport interface MaxPoolAttributes extends AveragePoolAttributes {\n readonly storageOrder: number;\n readonly dilations: number[];\n}\n\nexport const maxPool: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: MaxPoolAttributes): Tensor[] => {\n validateInputs(inputs);\n const metadata =\n {name: 'MaxPool', inputNames: ['X'], inputTypes: [TextureType.unpacked], cacheHint: attributes.cacheKey};\n const output = inferenceHandler.run(\n {...metadata, get: () => createMaxPoolProgramInfo(inputs, metadata, false, attributes)}, inputs);\n return [output];\n };\n\nexport const parseMaxPoolAttributes: OperatorInitialization =\n (node: Graph.Node): MaxPoolAttributes => {\n const autoPad = node.attributes.getString('auto_pad', 'NOTSET');\n const ceilMode = node.attributes.getInt('ceil_mode', 0);\n const kernelShape = node.attributes.getInts('kernel_shape');\n const strides = node.attributes.getInts('strides', []);\n const pads = node.attributes.getInts('pads', []);\n const storageOrder = node.attributes.getInt('storage_order', 0);\n const dilations = node.attributes.getInts('dilations', []);\n\n // TODO: support attribute 'ceil_mode' and 'storage_order'\n if (storageOrder !== 0) {\n throw new Error('column major storage order is not yet supported for MaxPool');\n }\n if (ceilMode !== 0) {\n throw new Error('using ceil() in shape computation is not yet supported for MaxPool');\n }\n\n return createAttributeWithCacheKey(\n {autoPad, ceilMode, countIncludePad: false, kernelShape, strides, pads, storageOrder, dilations});\n };\n\nconst createMaxPoolProgramInfo =\n (inputs: Tensor[], metadata: ProgramMetadata, isGlobalOperator: boolean, attributes: MaxPoolAttributes):\n ProgramInfo => {\n const [adjustedAttributes, outputShape] =\n getAdjustedPoolAttributesAndOutputShape(inputs, attributes, isGlobalOperator);\n const op1 = `\n value = max(_X(x), value);\n `;\n const op2 = '';\n const poolingCode = generatePoolingCode(inputs[0].dims, adjustedAttributes, op1, op2, '-1e5');\n const shaderSource = `\n ${poolingCode}\n `;\n return {\n ...metadata,\n output: {dims: outputShape, type: inputs[0].type, textureType: TextureType.unpacked},\n shaderSource\n };\n };\n\nconst getAdjustedPoolAttributesAndOutputShape =\n (inputs: Tensor[], attributes: AveragePoolAttributes|MaxPoolAttributes, isGlobalOperator: boolean):\n [AveragePoolAttributes|MaxPoolAttributes, number[]] => {\n const inputShape = inputs[0].dims.slice();\n const hasDilations = Object.hasOwnProperty.call(attributes, 'dilations');\n const kernelShape = attributes.kernelShape.slice();\n const strides = attributes.strides.slice();\n const dilations: number[] = hasDilations ? (attributes as MaxPoolAttributes).dilations.slice() : [];\n const pads = attributes.pads.slice();\n PoolConvUtil.adjustPoolAttributes(isGlobalOperator, inputShape, kernelShape, strides, dilations, pads);\n\n const outputShape = PoolConvUtil.computePoolOutputShape(\n isGlobalOperator, inputShape, strides, dilations, kernelShape, pads, attributes.autoPad);\n\n const newAttributes = Object.assign({}, attributes);\n if (hasDilations) {\n Object.assign(newAttributes, {kernelShape, strides, pads, dilations, cacheKey: attributes.cacheKey});\n } else {\n Object.assign(newAttributes, {kernelShape, strides, pads, cacheKey: attributes.cacheKey});\n }\n return [newAttributes, outputShape];\n };\n\nconst globalMaxPoolAttributes = {\n autoPad: '',\n ceilMode: 0,\n countIncludePad: false,\n kernelShape: [],\n strides: [],\n pads: [],\n storageOrder: 0,\n dilations: [],\n cacheKey: ''\n};\n\nconst globalMaxPoolMetadata = {\n name: 'GlobalMaxPool',\n inputNames: ['X'],\n inputTypes: [TextureType.unpacked]\n};\n\nexport const globalMaxPool = (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[]): Tensor[] => {\n validateInputs(inputs);\n const output = inferenceHandler.run(\n {\n ...globalMaxPoolMetadata,\n get: () => createMaxPoolProgramInfo(inputs, globalMaxPoolMetadata, true, globalMaxPoolAttributes)\n },\n inputs);\n return [output];\n};\n\nconst validateInputs = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length !== 1) {\n throw new Error('Pool ops requires 1 input.');\n }\n if (inputs[0].type !== 'float32' && inputs[0].type !== 'float64') {\n throw new Error('Invalid input type.');\n }\n};\n\nconst generatePoolingCode =\n (inputDims: readonly number[], attributes: AveragePoolAttributes, op1: string, op2: string, start: string):\n string => {\n const rank = inputDims.length;\n if (attributes.kernelShape.length <= 2) {\n const kw = attributes.kernelShape[attributes.kernelShape.length - 1];\n const sw = attributes.strides[attributes.strides.length - 1];\n const pwStart = attributes.pads[attributes.pads.length / 2 - 1];\n const pwEnd = attributes.pads[attributes.pads.length - 1];\n const dimW = inputDims[rank - 1];\n let codeW = '';\n let codeH = '';\n let codeHEnd = '';\n if (pwStart + pwEnd !== 0) {\n codeW = `\n for (int i = 0; i < ${kw}; i++) {\n x[${rank} - 1] = indices[${rank} - 1] * ${sw} - ${pwStart} + i;\n if (x[${rank} - 1] < 0 || x[${rank} - 1] >= ${dimW}) {\n pad++;\n continue;\n }\n ${op1}\n }`;\n } else {\n codeW = `\n for (int i = 0; i < ${kw}; i++) {\n x[${rank} - 1] = indices[${rank} - 1] * ${sw} - ${pwStart} + i;\n ${op1}\n }`;\n }\n\n if (attributes.kernelShape.length === 2) {\n const kh = attributes.kernelShape[attributes.kernelShape.length - 2];\n const sh = attributes.strides[attributes.strides.length - 2];\n const phStart = attributes.pads[attributes.pads.length / 2 - 2];\n const phEnd = attributes.pads[attributes.pads.length - 2];\n const dimH = inputDims[rank - 2];\n if (phStart + phEnd !== 0) {\n codeH = `\n for (int j = 0; j < ${kh}; j++) {\n x[${rank} - 2] = indices[${rank} - 2] * ${sh} - ${phStart} + j;\n if (x[${rank} - 2] < 0 || x[${rank} - 2] >= ${dimH}) {\n pad+= ${kw};\n continue;\n }\n `;\n } else {\n codeH = `\n for (int j = 0; j < ${kh}; j++) {\n x[${rank} - 2] = indices[${rank} - 2] * ${sh} - ${phStart} + j;\n `;\n }\n codeHEnd = `\n }\n `;\n }\n\n const poolingCode = `\n float process(int indices[${rank}]) {\n int x[${rank}];\n copyVec(indices, x);\n\n float value = ${start};\n int pad = 0;\n ${codeH}\n ${codeW}\n ${codeHEnd}\n ${op2}\n return value;\n }\n `;\n return poolingCode;\n } else {\n const kernelSize = ShapeUtil.size(attributes.kernelShape);\n const kernelStrides = ShapeUtil.computeStrides(attributes.kernelShape);\n const stridesRank = kernelStrides.length;\n const padsRank = attributes.pads.length;\n const offsetToIndicesFunction = offsetToIndices(stridesRank);\n const copyInputDims = copyArray(inputDims, 'inputDims');\n const copyPads = copyArray(attributes.pads, 'pads');\n const copyKernelStrides = copyArray(kernelStrides, 'kernelStrides');\n const copyStrides = copyArray(attributes.strides, 'strides');\n const hasPads = attributes.pads.reduce((sum, cur) => sum + cur);\n let padCode = '';\n if (hasPads) {\n padCode = `\n if (x[j] >= inputDims[j] || x[j] < 0) {\n pad++;\n isPad = true;\n break;\n }\n }\n if (!isPad) {\n ${op1}\n }`;\n } else {\n padCode = `\n }\n ${op1}\n `;\n }\n const poolingCode = `\n ${offsetToIndicesFunction}\n float process(int indices[${rank}]) {\n int x[${rank}];\n copyVec(indices, x);\n int offset[${stridesRank}];\n int pads[${padsRank}];\n int inputDims[${rank}];\n int kernelStrides[${stridesRank}];\n int strides[${stridesRank}];\n ${copyPads}\n ${copyInputDims}\n ${copyStrides}\n ${copyKernelStrides}\n\n float value = ${start};\n int pad = 0;\n bool isPad = false;\n for (int i = 0; i < ${kernelSize}; i++) {\n offsetToIndices(i, kernelStrides, offset);\n isPad = false;\n for (int j = ${rank} - ${stridesRank}; j < ${rank}; j++) {\n x[j] = indices[j] * strides[j - ${rank} + ${stridesRank}]\n + offset[j - ${rank} + ${stridesRank}] - pads[j - 2];\n ${padCode}\n }\n ${op2}\n\n return value;\n }\n `;\n return poolingCode;\n }\n };\n\nconst copyArray = (array: readonly number[], arrayName: string): string => {\n let block = '';\n for (let i = 0; i < array.length; i++) {\n block += `\n ${arrayName}[${i}] = ${array[i]};\n `;\n }\n return block;\n};\n\nconst offsetToIndices = (rank: number): string => `\n void offsetToIndices(int offset, int[${rank}] strides, out int[${rank}] indices) {\n if (${rank} == 0) {\n return;\n }\n for (int i = 0; i < ${rank} - 1; ++i) {\n indices[i] = offset / strides[i];\n offset -= indices[i] * strides[i];\n }\n indices[${rank} - 1] = offset;\n }`;\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {AttributeWithCacheKey, createAttributeWithCacheKey} from '../../../attribute-with-cache-key';\nimport {Graph} from '../../../graph';\nimport {NUMBER_TYPES, OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {ShapeUtil} from '../../../util';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramMetadata, TextureType} from '../types';\n\nexport interface ReduceAttributes extends AttributeWithCacheKey {\n readonly axes: number[];\n readonly keepDims: boolean;\n}\n\n// return [init ops, reduce ops, final ops]\ntype ReduceOp = (inputs: Tensor[], axes: number[]) => string[];\n\nconst reduce =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: ReduceAttributes, name: string,\n reduceOp: ReduceOp): Tensor[] => {\n validateInputs(inputs);\n\n const reduceProgramMetadata = {\n name,\n inputNames: ['A'],\n inputTypes: [TextureType.unpacked],\n };\n\n const output = inferenceHandler.run(\n {\n ...reduceProgramMetadata,\n cacheHint: attributes.cacheKey,\n get: () =>\n createReduceProgramInfo(inferenceHandler, inputs, attributes, name, reduceOp, reduceProgramMetadata)\n },\n inputs);\n return [output];\n };\n\nexport const parseReduceAttributes: OperatorInitialization = (node: Graph.Node): ReduceAttributes => {\n const axes = node.attributes.getInts('axes', []);\n const keepDims = node.attributes.getInt('keepdims', 1) === 1;\n return createAttributeWithCacheKey({axes, keepDims});\n};\n\nconst createReduceProgramInfo =\n (_handler: WebGLInferenceHandler, inputs: Tensor[], attributes: ReduceAttributes, _name: string, reduceOp: ReduceOp,\n reduceProgramMetadata: ProgramMetadata): ProgramInfo => {\n const outputShape: number[] = [];\n const iRank = inputs[0].dims.length || 1;\n\n const idxCopy = []; // copy output indexes to input indexes\n\n const axes = ShapeUtil.normalizeAxes(attributes.axes, inputs[0].dims.length);\n const ops = reduceOp(inputs, axes);\n let reduceOps = ops[1];\n\n for (let k = 0; k < inputs[0].dims.length; k++) {\n // if this axis is reduced\n if (axes.indexOf(k) >= 0 || axes.length === 0) {\n if (attributes.keepDims) {\n outputShape.push(1);\n } // else { remove the axis from outputShape; }\n\n // loop over the d-th axis\n reduceOps = `\n for(int j${k} = 0; j${k} < ${inputs[0].dims[k]}; j${k}++) {\n inputIdx[${k}] = j${k};\n ${reduceOps}\n }`;\n } else {\n idxCopy.push(`inputIdx[${k}] = outputIdx[${outputShape.length}];`);\n\n outputShape.push(inputs[0].dims[k]);\n }\n }\n\n const oRank = outputShape.length || 1;\n\n const shaderSource = `\n float process(int outputIdx[${oRank}]) {\n float value; // final result\n int inputIdx[${iRank}]; // addressing input data\n ${idxCopy.join('\\n')}\n ${ops[0]} // init ops for reduce max/min\n ${reduceOps}\n ${ops[2]} // final computation for reduce mean\n return value;\n }`;\n\n return {\n ...reduceProgramMetadata,\n output: {dims: outputShape, type: inputs[0].type, textureType: TextureType.unpacked},\n shaderSource\n };\n };\n\nconst validateInputs = (inputs: Tensor[]): void => {\n // TODO: support Reduce* operators with 2 inputs.\n if (!inputs || inputs.length !== 1) {\n throw new Error('Reduce op requires 1 input.');\n }\n\n if (NUMBER_TYPES.indexOf(inputs[0].type) === -1) {\n throw new Error('Invalid input type.');\n }\n};\n\nexport const reduceSum: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: ReduceAttributes): Tensor[] => {\n const reduceOp: ReduceOp = (): string[] => ['value = 0.0;', 'value += _A(inputIdx);', ''];\n return reduce(inferenceHandler, inputs, attributes, 'ReduceSum', reduceOp);\n };\n\nexport const reduceMean: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: ReduceAttributes): Tensor[] => {\n const reduceOp: ReduceOp = (inputs: Tensor[], axes: number[]): string[] => {\n let size = 1.0;\n for (let k = 0; k < inputs[0].dims.length; k++) {\n if (axes.indexOf(k) >= 0 || axes.length === 0) {\n size *= inputs[0].dims[k];\n }\n }\n\n return ['value = 0.0;', 'value += _A(inputIdx);', `value /= ${size}.;`]; // ensure real number with `.`\n };\n return reduce(inferenceHandler, inputs, attributes, 'ReduceMean', reduceOp);\n };\n\nexport const reduceMax: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: ReduceAttributes): Tensor[] => {\n const reduceOp: ReduceOp = (inputs: Tensor[], axes: number[]): string[] => {\n const idxZero = [];\n for (let k = 0; k < inputs[0].dims.length; k++) {\n if (axes.indexOf(k) >= 0 || axes.length === 0) {\n idxZero.push(`inputIdx[${k}] = 0;`); // first element\n }\n }\n\n return [`${idxZero.join('\\n')}\\nvalue = _A(inputIdx);`, 'value = max(value, _A(inputIdx));', ''];\n };\n return reduce(inferenceHandler, inputs, attributes, 'ReduceMax', reduceOp);\n };\n\nexport const reduceMin: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: ReduceAttributes): Tensor[] => {\n const reduceOp: ReduceOp = (inputs: Tensor[], axes: number[]): string[] => {\n const idxZero = [];\n for (let k = 0; k < inputs[0].dims.length; k++) {\n if (axes.indexOf(k) >= 0 || axes.length === 0) {\n idxZero.push(`inputIdx[${k}] = 0;`); // first element\n }\n }\n\n return [`${idxZero.join('\\n')}\\nvalue = _A(inputIdx);`, 'value = min(value, _A(inputIdx));', ''];\n };\n return reduce(inferenceHandler, inputs, attributes, 'ReduceMin', reduceOp);\n };\n\nexport const reduceProd: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: ReduceAttributes): Tensor[] => {\n const reduceOp: ReduceOp = (): string[] => ['value = 1.0;', 'value *= _A(inputIdx);', ''];\n return reduce(inferenceHandler, inputs, attributes, 'ReduceProd', reduceOp);\n };\n\nexport const reduceLogSum: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: ReduceAttributes): Tensor[] => {\n const reduceOp: ReduceOp = (): string[] => ['value = 0.0;', 'value += _A(inputIdx);', 'value = log(value);'];\n return reduce(inferenceHandler, inputs, attributes, 'ReduceLogSum', reduceOp);\n };\n\nexport const reduceLogSumSquare: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: ReduceAttributes): Tensor[] => {\n const reduceOp: ReduceOp = (): string[] => ['float t; value = 0.0;', 't = _A(inputIdx); value += t * t;', ''];\n return reduce(inferenceHandler, inputs, attributes, 'ReduceLogSumSquare', reduceOp);\n };\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Tensor} from '../../../tensor';\nimport {ShapeUtil} from '../../../util';\nimport {WebGLInferenceHandler} from '../inference-handler';\n\nexport const reshape = (handler: WebGLInferenceHandler, inputs: Tensor[]): Tensor[] => {\n const reshapedDims = ShapeUtil.calculateReshapedDims(inputs[0].dims, inputs[1].integerData);\n if (handler.session.pack) {\n return [handler.reshapePacked(inputs[0], reshapedDims)];\n } else {\n return [handler.reshapeUnpacked(inputs[0], reshapedDims)];\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {AttributeWithCacheKey, createAttributeWithCacheKey} from '../../../attribute-with-cache-key';\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {getGlsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, TextureType} from '../types';\n\nexport interface UpsampleAttributes extends AttributeWithCacheKey {\n readonly opset: number;\n readonly isResize: boolean;\n readonly mode: string;\n readonly scales: number[];\n readonly extrapolationValue: number;\n readonly coordinateTransformMode: string;\n readonly useExtrapolation: boolean;\n readonly needRoiInput: boolean;\n readonly nearestMode: string;\n readonly cubicCoefficientA: number;\n readonly excludeOutside: boolean;\n readonly useNearest2xOptimization: boolean;\n readonly roiInputIdx: number;\n readonly scalesInputIdx: number;\n readonly sizesInputIdx: number;\n}\n\nconst upsampleProgramMetadata = {\n name: 'Upsample',\n inputNames: ['X'],\n inputTypes: [TextureType.unpacked],\n};\n\nexport const upsample: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: UpsampleAttributes): Tensor[] => {\n validateInputs(inputs, attributes);\n const output = inferenceHandler.run(\n {\n ...upsampleProgramMetadata,\n cacheHint: attributes.cacheKey,\n get: () => createUpsampleProgramInfo(inferenceHandler, inputs, attributes)\n },\n inputs);\n return [output];\n };\n\nexport const parseUpsampleAttributesV7: OperatorInitialization =\n (node: Graph.Node): UpsampleAttributes => parseUpsampleAttributes(node, 7);\n\nexport const parseUpsampleAttributesV9: OperatorInitialization =\n (node: Graph.Node): UpsampleAttributes => parseUpsampleAttributes(node, 9);\n\nexport const parseUpsampleAttributes = (node: Graph.Node, opset: number): UpsampleAttributes => {\n const isResize = (opset >= 10);\n\n // processing node attributes\n const mode = node.attributes.getString('mode', 'nearest');\n if (mode !== 'nearest' && mode !== 'linear' && (opset < 11 || mode !== 'cubic')) {\n throw new Error(`unrecognized mode: ${mode}`);\n }\n\n let scales: number[] = [];\n if (opset < 9) {\n scales = node.attributes.getFloats('scales');\n scalesValidation(scales, mode, isResize);\n }\n\n const extrapolationValue = node.attributes.getFloat('extrapolation_value', 0.0);\n\n const coordinateTransformMode =\n opset > 10 ? node.attributes.getString('coordinate_transformation_mode', 'half_pixel') : 'asymmetric';\n if ([\n 'asymmetric', 'pytorch_half_pixel', 'tf_half_pixel_for_nn', 'align_corners', 'tf_crop_and_resize', 'half_pixel'\n ].indexOf(coordinateTransformMode) === -1) {\n throw new Error(`coordinate_transform_mode '${coordinateTransformMode}' is not supported`);\n }\n const needRoiInput = (coordinateTransformMode === 'tf_crop_and_resize');\n const useExtrapolation = needRoiInput;\n\n const nearestMode =\n (mode === 'nearest' && opset >= 11) ? node.attributes.getString('nearest_mode', 'round_prefer_floor') : '';\n if (['round_prefer_floor', 'round_prefer_ceil', 'floor', 'ceil', ''].indexOf(nearestMode) === -1) {\n throw new Error(`nearest_mode '${nearestMode}' is not supported`);\n }\n\n const cubicCoefficientA = node.attributes.getFloat('cubic_coeff_a', -0.75);\n const excludeOutside = node.attributes.getInt('exclude_outside', 0) !== 0;\n if (excludeOutside && mode !== 'cubic') {\n throw new Error('exclude_outside can be set to 1 only when mode is CUBIC.');\n }\n\n const useNearest2xOptimization =\n (opset < 11) ? true : (mode === 'nearest' && coordinateTransformMode === 'asymmetric' && nearestMode === 'floor');\n\n let roiInputIdx = 0;\n let scalesInputIdx = 0;\n let sizesInputIdx = 0;\n\n if (opset > 10) {\n // handle when roiInput is not given\n if (node.inputs.length > 2) {\n roiInputIdx = 1;\n scalesInputIdx = 2;\n sizesInputIdx = 3;\n } else {\n scalesInputIdx = 1;\n sizesInputIdx = 2;\n }\n } else if (opset === 9) {\n scalesInputIdx = 1;\n }\n\n return createAttributeWithCacheKey({\n opset,\n isResize,\n mode,\n scales,\n extrapolationValue,\n coordinateTransformMode,\n useExtrapolation,\n needRoiInput,\n nearestMode,\n cubicCoefficientA,\n excludeOutside,\n useNearest2xOptimization,\n roiInputIdx,\n scalesInputIdx,\n sizesInputIdx\n });\n};\n\nconst createUpsampleProgramInfo =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: UpsampleAttributes): ProgramInfo => {\n const glsl = getGlsl(inferenceHandler.session.backend.glContext.version);\n const [inputWidth, inputHeight] =\n inferenceHandler.calculateTextureWidthAndHeight(inputs[0].dims, TextureType.unpacked);\n\n const outputShape = inputs[0].dims.map((dim, i) => Math.floor(dim * attributes.scales[i]));\n const [outputWidth, outputHeight] =\n inferenceHandler.calculateTextureWidthAndHeight(outputShape, TextureType.unpacked);\n const dim = outputShape.length;\n\n const outputPitches = new Array(dim);\n const inputPitches = new Array(dim);\n let precalculatedPitches = `\n int output_pitches[${dim}];\n int input_pitches[${dim}];\n `;\n for (let d = dim - 1; d >= 0; d--) {\n outputPitches[d] = (d === dim - 1) ? 1 : outputPitches[d + 1] * outputShape[d + 1];\n inputPitches[d] = (d === dim - 1) ? 1 : inputPitches[d + 1] * inputs[0].dims[d + 1];\n\n precalculatedPitches += `\n output_pitches[${d}] = ${outputPitches[d]};\n input_pitches[${d}] = ${inputPitches[d]};\n `;\n }\n const getInputFloatFunction = `\n float getInputFloat(int index) {\n vec2 coords = offsetToCoords(index, ${inputWidth}, ${inputHeight});\n float value = getColorAsFloat(${glsl.texture2D}(X, coords));\n return value;\n }\n `;\n\n const shaderSource = attributes.mode === 'nearest' ?\n // nearest\n `\n ${getInputFloatFunction}\n float process(int indices[${dim}]) {\n int input_index = 0;\n int output_index = coordsToOffset(TexCoords, ${outputWidth}, ${outputHeight});\n\n ${precalculatedPitches}\n\n int d, m;\n for (int dim = 0; dim < ${dim}; ++dim) {\n d = output_index / output_pitches[dim];\n m = output_index - d * output_pitches[dim];\n output_index = m;\n\n if (scales[dim] != 1 && d > 0) {\n int d2 = d / scales[dim];\n m = d - d2 * scales[dim];\n d = d2;\n }\n input_index += input_pitches[dim] * d;\n }\n\n return getInputFloat(input_index);\n }` :\n dim === 4 ?\n // bilinear 4D\n `\n ${getInputFloatFunction}\n float process(int indices[4]) {\n int input_index = 0;\n int output_index = coordsToOffset(TexCoords, ${outputWidth}, ${outputHeight});\n\n ${precalculatedPitches}\n\n int m;\n int index_of_dim0, index_of_dim1, index_of_dim2, index_of_dim3;\n index_of_dim0 = output_index / output_pitches[0];\n m = output_index - index_of_dim0 * output_pitches[0];\n index_of_dim1 = m / output_pitches[1];\n m = m - index_of_dim1 * output_pitches[1];\n index_of_dim2 = m / output_pitches[2];\n m = m - index_of_dim2 * output_pitches[2];\n index_of_dim3 = m;\n\n int index_of_input_dim2, index_of_input_dim3, x_offset, y_offset;\n index_of_input_dim2 = index_of_dim2 / scales[2];\n y_offset = index_of_dim2 - index_of_input_dim2 * scales[2];\n index_of_input_dim3 = index_of_dim3 / scales[3];\n x_offset = index_of_dim3 - index_of_input_dim3 * scales[3];\n\n input_index = index_of_dim0 * input_pitches[0] +\n index_of_dim1 * input_pitches[1] +\n index_of_input_dim2 * input_pitches[2] +\n index_of_input_dim3;\n\n float x00 = getInputFloat(input_index);\n float x10, x01, x11;\n\n bool end_of_dim2 = false;\n if (index_of_input_dim2 == (${inputs[0].dims[2]} - 1)) {\n // It's the end in dimension 2\n x01 = x00;\n end_of_dim2 = true;\n } else {\n x01 = getInputFloat(input_index + input_pitches[2]);\n }\n\n if (index_of_input_dim3 == (input_pitches[2] - 1)) {\n // It's the end in dimension 3\n x10 = x00;\n x11 = x01;\n }\n else {\n x10 = getInputFloat(input_index + 1);\n x11 = end_of_dim2 ? x10 : getInputFloat(input_index + input_pitches[2] + 1);\n }\n\n float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[2]);\n float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[2]);\n return y0 + float(x_offset) * (y1 - y0) / float(scales[3]);\n }` :\n // bilinear 2D\n `\n ${getInputFloatFunction}\n float process(int indices[2]) {\n int input_index = 0;\n int output_index = coordsToOffset(TexCoords, ${outputWidth}, ${outputHeight});\n\n ${precalculatedPitches}\n\n int m;\n int index_of_dim0, index_of_dim1;\n index_of_dim0 = output_index / output_pitches[0];\n m = output_index - index_of_dim0 * output_pitches[0];\n index_of_dim1 = m;\n\n int index_of_input_dim0, index_of_input_dim1, x_offset, y_offset;\n index_of_input_dim0 = index_of_dim0 / scales[0];\n y_offset = index_of_dim0 - index_of_input_dim0 * scales[0];\n index_of_input_dim1 = index_of_dim1 / scales[1];\n x_offset = index_of_dim1 - index_of_input_dim1 * scales[1];\n\n input_index = index_of_input_dim0 * input_pitches[0] + index_of_input_dim1;\n\n float x00 = getInputFloat(input_index);\n float x10, x01, x11;\n\n bool end_of_dim0 = false;\n if (index_of_input_dim0 == (${inputs[0].dims[0]} - 1)) {\n // It's the end in dimension 0\n x01 = x00;\n end_of_dim0 = true;\n } else {\n x01 = getInputFloat(input_index + input_pitches[0]);\n }\n\n if (index_of_input_dim1 == (input_pitches[0] - 1)) {\n // It's the end in dimension 1\n x10 = x00;\n x11 = x01;\n }\n else {\n x10 = getInputFloat(input_index + 1);\n x11 = end_of_dim0 ? x10 : getInputFloat(input_index + input_pitches[0] + 1);\n }\n\n float y0 = x00 + float(y_offset) * (x01 - x00) / float(scales[0]);\n float y1 = x10 + float(y_offset) * (x11 - x10) / float(scales[0]);\n return y0 + float(x_offset) * (y1 - y0) / float(scales[1]);\n }`;\n return {\n ...upsampleProgramMetadata,\n output: {dims: outputShape, type: inputs[0].type, textureType: TextureType.unpacked},\n shaderSource,\n variables: [{\n name: 'scales',\n type: 'int',\n arrayLength: attributes.scales.length,\n data: attributes.scales.map(x => Math.ceil(x))\n }]\n };\n };\n\nexport const validateInputs = (inputs: Tensor[], attribute: UpsampleAttributes): void => {\n if (!inputs || (attribute.opset < 9 && inputs.length !== 1) ||\n (attribute.opset >= 9 && attribute.opset < 11 && inputs.length !== 2) ||\n (attribute.opset >= 11 && inputs.length < 2)) {\n throw new Error('invalid inputs.');\n }\n\n if (attribute.scales.length > 0 && inputs[0].dims.length !== attribute.scales.length) {\n throw new Error('Invalid input shape.');\n }\n\n if (inputs[0].type === 'string') {\n throw new Error('Invalid input tensor types.');\n }\n};\n\nexport const scalesValidation = (scales: number[], mode: string, isResize: boolean): void => {\n if (!isResize) {\n for (const scale of scales) {\n if (scale < 1) {\n throw new Error('Scale value should be greater than or equal to 1.');\n }\n }\n } else {\n for (const scale of scales) {\n if (scale <= 0) {\n throw new Error('Scale value should be greater than 0.');\n }\n }\n }\n if (mode === 'linear' || mode === 'cubic') {\n if (scales.length !== 2 && (scales.length !== 4 || scales[0] !== 1 || scales[1] !== 1)) {\n throw new Error(`'Linear' mode and 'Cubic' mode only support 2-D inputs ('Bilinear', 'Bicubic') \\\n or 4-D inputs with the corresponding outermost 2 scale values being 1 \\\n in the ${isResize ? 'Resize' : 'Upsample'} opeartor.`);\n }\n }\n};","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {getGlsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, TextureType} from '../types';\nimport {getCoordsDataType} from '../utils';\n\nimport {unpackFromChannel} from './packing-utils';\nimport {parseUpsampleAttributes, scalesValidation, UpsampleAttributes, validateInputs} from './upsample';\n\nconst resizeProgramMetadata = {\n name: 'Resize',\n inputNames: ['A'],\n inputTypes: [TextureType.packed]\n};\n\nexport const resize: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: UpsampleAttributes): Tensor[] => {\n validateInputs(inputs, attributes);\n const output = inferenceHandler.run(\n {\n ...resizeProgramMetadata,\n cacheHint: attributes.cacheKey,\n get: () => createPackedResizeProgramInfo(inferenceHandler, inputs, attributes)\n },\n inputs);\n return [output];\n };\n\nexport const parseResizeAttributesV10: OperatorInitialization =\n (node: Graph.Node): UpsampleAttributes => parseUpsampleAttributes(node, 10);\n\nexport const parseResizeAttributesV11: OperatorInitialization =\n (node: Graph.Node): UpsampleAttributes => parseUpsampleAttributes(node, 11);\n\nconst createPackedResizeProgramInfo =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: UpsampleAttributes): ProgramInfo => {\n const glsl = getGlsl(inferenceHandler.session.backend.glContext.version);\n const [scales, outputShape] = prepareInputs(inputs, attributes);\n\n const isSame =\n scales.every((s: number) => s === 1) && attributes.coordinateTransformMode !== 'tf_crop_and_resize';\n if (isSame) {\n return {\n ...resizeProgramMetadata,\n output: {dims: outputShape, type: inputs[0].type, textureType: TextureType.packed},\n hasMain: true,\n shaderSource: `void main() {\n vec4 v = ${glsl.texture2D}(X, TexCoords);\n ${glsl.output} = v;\n }`\n };\n }\n\n const dim = outputShape.length;\n if (dim < 2) {\n throw new Error(`output dimension should be at least 2, but got ${dim}`);\n }\n\n const outputHeight = outputShape[dim - 2];\n const outputWidth = outputShape[dim - 1];\n\n const inputShape = inputs[0].dims;\n if (dim !== inputShape.length) {\n throw new Error(`output dimension should match input ${inputShape.length}, but got ${dim}`);\n }\n const inputHeight = inputShape[dim - 2];\n const inputWidth = inputShape[dim - 1];\n\n const scalesHeight = scales[dim - 2];\n const scalesWidth = scales[dim - 1];\n\n let getSourceFracIndex = '';\n\n if (attributes.mode !== 'linear') {\n // TODO: support other modes\n throw new Error(`resize (packed) does not support mode: '${attributes.mode}'`);\n }\n switch (attributes.coordinateTransformMode) {\n case 'asymmetric':\n getSourceFracIndex = `\n vec4 getSourceFracIndex(ivec4 coords) {\n return vec4(coords) / scaleWHWH;\n }\n `;\n break;\n case 'half_pixel':\n getSourceFracIndex = `\n vec4 getSourceFracIndex(ivec4 coords) {\n return (vec4(coords) + 0.5) / scaleWHWH - 0.5;\n }\n `;\n break;\n case 'pytorch_half_pixel':\n getSourceFracIndex = `\n vec4 getSourceFracIndex(ivec4 coords) {\n vec4 fcoords = vec4(coords);\n return vec4(\n ${outputWidth}.0 > 1.0 ? (fcoords.x + 0.5) / scaleWHWH.x - 0.5 : 0.0,\n ${outputHeight}.0 > 1.0 ? (fcoords.y + 0.5) / scaleWHWH.y - 0.5 : 0.0,\n ${outputWidth}.0 > 1.0 ? (fcoords.z + 0.5) / scaleWHWH.z - 0.5 : 0.0,\n ${outputHeight}.0 > 1.0 ? (fcoords.w + 0.5) / scaleWHWH.w - 0.5 : 0.0\n );\n }\n `;\n break;\n case 'align_corners':\n getSourceFracIndex = `\n vec4 getSourceFracIndex(ivec4 coords) {\n vec4 resized = vec4(${outputWidth}.0 - 1.0, ${outputHeight}.0 - 1.0, ${outputWidth}.0 - 1.0,\n ${outputHeight}.0 - 1.0);\n vec4 original = vec4(${inputWidth}.0 - 1.0, ${inputHeight}.0 - 1.0, ${inputWidth}.0 - 1.0,\n ${inputHeight}.0 - 1.0);\n vec4 new_scale = original / resized;\n return vec4(coords) * new_scale;\n }\n `;\n break;\n default:\n // TODO:supporting other coordinateTransformModes\n throw new Error(`resize (packed) does not support coordinateTransformMode: \\\n '${attributes.coordinateTransformMode}'`);\n }\n\n const coordsDataType = getCoordsDataType(dim);\n const unpackChannel = unpackFromChannel();\n const shaderSource = `\n const vec2 inputWH = vec2(${inputHeight}.0, ${inputWidth}.0);\n const vec4 scaleWHWH = vec4(float(${scalesHeight}), float(${scalesWidth}), float(${scalesHeight}), float(${\n scalesWidth}));\n ${unpackChannel}\n ${getSourceFracIndex}\n float getAValue(int x10, int r, int c, int d) {\n return getChannel(getA(x10, r, c, d), vec2(c, d));\n }\n void main() {\n ${coordsDataType} rc = getOutputCoords();\n\n int batch = rc[0];\n int depth = rc[1];\n\n // retrieve the 4 coordinates that is used in the 4 packed output values.\n ivec4 coords = ivec4(rc.wz, rc.w + 1, rc.z + 1);\n\n // calculate the source index in fraction\n vec4 sourceFrac = getSourceFracIndex(coords);\n\n // get the lower and upper bound of the 4 values that will be packed into one texel.\n ivec4 x00 = ivec4(max(sourceFrac.xy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xy)));\n ivec4 x01 = ivec4(max(sourceFrac.xw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.xw)));\n ivec4 x10 = ivec4(max(sourceFrac.zy, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zy)));\n ivec4 x11 = ivec4(max(sourceFrac.zw, vec2(0.0)), min(inputWH - 1.0, ceil(sourceFrac.zw)));\n\n bool hasNextRow = rc.w < ${outputHeight - 1};\n bool hasNextCol = rc.z < ${outputWidth - 1};\n\n // pack x00, x01, x10, x11's top-left corner into one vec4 structure\n vec4 topLeft = vec4(\n getAValue(batch, depth, x00.x, x00.y),\n hasNextCol ? getAValue(batch, depth, x01.x, x01.y) : 0.0,\n hasNextRow ? getAValue(batch, depth, x10.x, x10.y) : 0.0,\n (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.y) : 0.0);\n\n // pack x00, x01, x10, x11's top-right corner into one vec4 structure\n vec4 topRight = vec4(\n getAValue(batch, depth, x00.x, x00.w),\n hasNextCol ? getAValue(batch, depth, x01.x, x01.w) : 0.0,\n hasNextRow ? getAValue(batch, depth, x10.x, x10.w) : 0.0,\n (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.x, x11.w) : 0.0);\n\n // pack x00, x01, x10, x11's bottom-left corner into one vec4 structure\n vec4 bottomLeft = vec4(\n getAValue(batch, depth, x00.z, x00.y),\n hasNextCol ? getAValue(batch, depth, x01.z, x01.y) : 0.0,\n hasNextRow ? getAValue(batch, depth, x10.z, x10.y) : 0.0,\n (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.y) : 0.0);\n\n // pack x00, x01, x10, x11's bottom-right corner into one vec4 structure\n vec4 bottomRight = vec4(\n getAValue(batch, depth, x00.z, x00.w),\n hasNextCol ? getAValue(batch, depth, x01.z, x01.w) : 0.0,\n hasNextRow ? getAValue(batch, depth, x10.z, x10.w) : 0.0,\n (hasNextRow && hasNextCol) ? getAValue(batch, depth, x11.z, x11.w) : 0.0);\n\n // calculate the interpolation fraction on u and v direction\n vec4 frac = vec4(sourceFrac) - floor(sourceFrac);\n vec4 clampFrac = clamp(frac, vec4(0.0), vec4(1.0));\n\n vec4 top = mix(topLeft, topRight, clampFrac.ywyw);\n vec4 bottom = mix(bottomLeft, bottomRight, clampFrac.ywyw);\n vec4 newValue = mix(top, bottom, clampFrac.xxzz);\n\n ${glsl.output} = vec4(newValue);\n }\n `;\n return {\n ...resizeProgramMetadata,\n output: {dims: outputShape, type: inputs[0].type, textureType: TextureType.packed},\n hasMain: true,\n shaderSource\n };\n };\n\n\nconst prepareInputs = (inputs: Tensor[], attributes: UpsampleAttributes): [readonly number[], readonly number[]] => {\n const x = inputs[0];\n const xDims = x.dims;\n\n let scales = attributes.scales;\n let outputSizes: number[]|undefined;\n if (scales.length === 0) {\n const scalesTensor = inputs[attributes.scalesInputIdx];\n if (scalesTensor && scalesTensor.size !== 0) {\n if (inputs[attributes.sizesInputIdx]) {\n throw new Error('Only one of scales or sizes must be provided as input.');\n }\n scales = parseScalesData(scalesTensor, attributes.mode, attributes.isResize);\n } else {\n const sizesTensor = inputs[attributes.sizesInputIdx];\n if (!sizesTensor || sizesTensor.size === 0) {\n throw new Error('Either scales or sizes MUST be provided as input.');\n }\n\n outputSizes = Array.from(sizesTensor.integerData);\n scales = parseScalesDataFromOutputSize(outputSizes, xDims, attributes.mode, attributes.isResize);\n }\n } else {\n if (inputs[attributes.sizesInputIdx]) {\n throw new Error('Only one of scales or sizes must be provided as input.');\n }\n }\n\n const yDims = outputSizes || (xDims.map((dim, i) => Math.floor(dim * scales[i])));\n\n return [scales, yDims];\n};\n\nconst parseScalesData = (scale: Tensor, mode: string, isResize: boolean): number[] => {\n const scales = Array.from(scale.floatData);\n scalesValidation(scales, mode, isResize);\n return scales;\n};\n\nconst parseScalesDataFromOutputSize =\n (yDims: readonly number[], xDims: readonly number[], mode: string, isResize: boolean): number[] => {\n const length = xDims.length;\n const scales = new Array(length);\n\n for (let i = 0, end = length; i < end; i++) {\n if (xDims[i] === 0) {\n if (yDims[i] !== 0) {\n throw new Error('Input dim is zero but required output dim is non-zero.');\n }\n scales[i] = 1;\n } else {\n scales[i] = yDims[i] / xDims[i];\n }\n }\n scalesValidation(scales, mode, isResize);\n return scales;\n };\n\n// roi data is not used yet. but leave here for future usage.\n// const getRoi = (inputs: Tensor[], attributes: UpsampleAttributes) : number[] => {\n// let roi: number[] = [];\n// if (attributes.needRoiInput) {\n// if (attributes.roiInputIdx <= 0) {\n// throw new Error('Invalid roi input index.');\n// }\n// const roiTensor = inputs[attributes.roiInputIdx];\n// roi = roiTensor.size > 0 ? Array.from(roiTensor.floatData) : [];\n// } else {\n// roi = new Array(inputs[0].dims.length * 2).fill(0);\n// }\n// return roi;\n// };\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Tensor} from '../../../tensor';\nimport {WebGLInferenceHandler} from '../inference-handler';\n\nexport const shape = (_inferenceHandler: WebGLInferenceHandler, inputs: Tensor[]): Tensor[] => {\n validateInputs(inputs);\n return [new Tensor([inputs[0].dims.length], 'int32', undefined, undefined, new Int32Array(inputs[0].dims))];\n};\n\nconst validateInputs = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length !== 1) {\n throw new Error('Shape requires 1 input.');\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {AttributeWithCacheKey, createAttributeWithCacheKey} from '../../../attribute-with-cache-key';\nimport {Graph} from '../../../graph';\nimport {NUMBER_TYPES, OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {ShapeUtil} from '../../../util';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, TextureType} from '../types';\n\nexport interface SliceAttributes extends AttributeWithCacheKey {\n readonly axes: number[];\n readonly ends: number[];\n readonly starts: number[];\n}\n\nconst sliceProgramMetadata = {\n name: 'Slice',\n inputNames: ['A'],\n inputTypes: [TextureType.unpacked]\n};\n\nexport const slice: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: SliceAttributes): Tensor[] => {\n validateInputs(inputs);\n const output = inferenceHandler.run(\n {\n ...sliceProgramMetadata,\n cacheHint: attributes.cacheKey,\n get: () => createSliceProgramInfo(inferenceHandler, inputs[0], attributes)\n },\n inputs);\n return [output];\n };\n\nexport const parseSliceAttributes: OperatorInitialization = (node: Graph.Node): SliceAttributes => {\n const starts = node.attributes.getInts('starts');\n const ends = node.attributes.getInts('ends');\n const axes = node.attributes.getInts('axes', []);\n return createAttributeWithCacheKey({starts, ends, axes});\n};\n\nconst createSliceProgramInfo =\n (_inferenceHandler: WebGLInferenceHandler, input: Tensor, attributes: SliceAttributes): ProgramInfo => {\n const axes = (attributes.axes.length === 0) ? input.dims.slice(0).map((_val, i) => i) : attributes.axes;\n const normalizedAxes = ShapeUtil.normalizeAxes(axes, input.dims.length);\n const starts = attributes.starts.map((start, i) => {\n if (start > input.dims[normalizedAxes[i]] - 1) {\n return input.dims[normalizedAxes[i]];\n }\n return ShapeUtil.normalizeAxis(start, input.dims[normalizedAxes[i]]);\n });\n const ends = attributes.ends.map((end, i) => {\n if (end > input.dims[normalizedAxes[i]] - 1) {\n return input.dims[normalizedAxes[i]];\n }\n return ShapeUtil.normalizeAxis(end, input.dims[normalizedAxes[i]]);\n });\n\n const outputShape = input.dims.slice();\n\n const sliceOps: string[] = [];\n for (let i = 0; i < normalizedAxes.length; i++) {\n outputShape[normalizedAxes[i]] = ends[i] - starts[i];\n if (starts[i] > 0) {\n sliceOps.push(`outputIdx[${normalizedAxes[i]}] += ${starts[i]};`);\n } // else { sliceOps.push(`outputIdx[${normalizedAxes[i]}] += 0;`); }\n }\n\n const rank = outputShape.length;\n const shaderSource = `\n float process(int outputIdx[${rank}]) {\n ${sliceOps.join('\\n ')}\n return _A(outputIdx);\n }`;\n return {\n ...sliceProgramMetadata,\n output: {dims: outputShape, type: input.type, textureType: TextureType.unpacked},\n shaderSource\n };\n };\n\nconst validateInputs = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length !== 1) {\n throw new Error('Slice requires 1 input.');\n }\n if (NUMBER_TYPES.indexOf(inputs[0].type) === -1) {\n throw new Error('Invalid input type.');\n }\n};\n\nexport const sliceV10 = (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[]): Tensor[] => {\n validateInputsV10(inputs);\n const attributes = generateSliceAttributesFromInputs(inferenceHandler, inputs);\n const output = inferenceHandler.run(\n {\n ...sliceProgramMetadata,\n cacheHint: attributes.cacheKey,\n get: () => createSliceProgramInfo(inferenceHandler, inputs[0], attributes)\n },\n [inputs[0]]);\n return [output];\n};\n\nconst generateSliceAttributesFromInputs =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[]): SliceAttributes => {\n if (!inferenceHandler.session.isInitializer(inputs[1].dataId) ||\n !inferenceHandler.session.isInitializer(inputs[2].dataId) ||\n (inputs.length >= 4 && !inferenceHandler.session.isInitializer(inputs[3].dataId)) ||\n (inputs.length >= 5 && !inferenceHandler.session.isInitializer(inputs[4].dataId))) {\n throw new Error('dynamic slice attributes are not allowed');\n }\n\n if (inputs.length >= 5 && inputs[4].integerData.some((i: number) => i !== 1)) {\n throw new Error('currently non-1 steps is not supported for Slice');\n }\n\n const starts = Array.from(inputs[1].integerData);\n const ends = Array.from(inputs[2].integerData);\n const axes = inputs.length >= 4 ? Array.from(inputs[3].integerData) : [];\n const cacheKey = `${axes};${starts};${ends}`;\n return {starts, ends, axes, cacheKey};\n };\n\nconst validateInputsV10 = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length < 3 || inputs.length > 5) {\n throw new Error('Invalid input number.');\n }\n if (inputs[1].type !== 'int32' || inputs[1].dims.length !== 1) {\n throw new Error('Invalid input type.');\n }\n if (inputs[2].type !== 'int32' || inputs[2].dims.length !== 1) {\n throw new Error('Invalid input type.');\n }\n if (inputs.length >= 4 && (inputs[3].type !== 'int32' || inputs[3].dims.length !== 1)) {\n throw new Error('Invalid input type.');\n }\n if (inputs.length >= 5 && (inputs[4].type !== 'int32' || inputs[4].dims.length !== 1)) {\n throw new Error('Invalid input type.');\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {AttributeWithCacheKey, createAttributeWithCacheKey} from '../../../attribute-with-cache-key';\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {ShapeUtil} from '../../../util';\nimport {getGlsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, TextureType} from '../types';\n\nimport {transpose, TransposeAttributes} from './transpose';\n\nexport interface SoftmaxAttributes extends AttributeWithCacheKey {\n readonly axis: number;\n}\n\nconst softmaxComputeMaxProgramMetadata = {\n name: 'SoftmaxComputeMax',\n inputNames: ['A'],\n inputTypes: [TextureType.unpacked],\n};\n\nconst softmaxComputeScaleProgramMetadata = {\n name: 'SoftmaxComputeScale',\n inputNames: ['A', 'Max'],\n inputTypes: [TextureType.unpacked, TextureType.unpacked],\n};\n\nconst softmaxProgramMetadata = {\n name: 'SoftMax',\n inputNames: ['A', 'Max', 'Norm'],\n inputTypes: [TextureType.unpacked, TextureType.unpacked, TextureType.unpacked],\n};\n\nexport const softmax: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: SoftmaxAttributes): Tensor[] => {\n validateInputs(inputs);\n\n const inputShape = inputs[0].dims.slice();\n const axis = ShapeUtil.normalizeAxis(attributes.axis, inputShape.length);\n const logicalRowCount = ShapeUtil.sizeToDimension(inputShape, axis);\n const featureCount = ShapeUtil.sizeFromDimension(inputShape, axis);\n\n const output = computeSoftmax(inferenceHandler, inputs, attributes, logicalRowCount, featureCount);\n return output;\n };\n\nexport const parseSoftmaxAttributes: OperatorInitialization =\n (node: Graph.Node): SoftmaxAttributes => createAttributeWithCacheKey({axis: node.attributes.getInt('axis', 1)});\n\nexport const parseSoftmaxAttributesV13: OperatorInitialization =\n (node: Graph.Node): SoftmaxAttributes => createAttributeWithCacheKey({axis: node.attributes.getInt('axis', -1)});\n\n// The \"semantic\" meaning of axis has changed in opset-13.\n// Please compare: https://github.com/onnx/onnx/blob/main/docs/Operators.md#Softmax\n// with https://github.com/onnx/onnx/blob/main/docs/Changelog.md#Softmax-11 for detailed explanations\n// To account for the opset-13 behavior, our plan will be to transpose the \"axis\" dim to the innermost dim\n// and perform softmax and then reverse the transpose. We can skip the transposing aspect if the axis is already\n// the innermost dim\nexport const softmaxV13: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: SoftmaxAttributes): Tensor[] => {\n validateInputs(inputs);\n\n const inputShape = inputs[0].dims.slice();\n const axis = ShapeUtil.normalizeAxis(attributes.axis, inputShape.length);\n const rank = inputShape.length;\n\n const isTransposeRequired = (axis !== rank - 1) ? true : false;\n const transposedInputShape: number[] = [];\n let perm: number[] = [];\n let transposedInputs: Tensor[] = [];\n let transposeAttribute: TransposeAttributes;\n\n if (isTransposeRequired) {\n perm = Array.from({length: rank}).map((_, i) => i);\n\n // swap the innermost dim with the dim corresponding to axis\n perm[axis] = rank - 1;\n perm[rank - 1] = axis;\n\n perm.map(p => transposedInputShape.push(inputShape[p]));\n\n transposeAttribute = createAttributeWithCacheKey({perm});\n transposedInputs = transpose(inferenceHandler, inputs, transposeAttribute);\n }\n\n const logicalRowCount = isTransposeRequired ? ShapeUtil.sizeToDimension(transposedInputShape, rank - 1) :\n ShapeUtil.sizeToDimension(inputShape, rank - 1);\n const featureCount = isTransposeRequired ? ShapeUtil.sizeFromDimension(transposedInputShape, rank - 1) :\n ShapeUtil.sizeFromDimension(inputShape, rank - 1);\n\n const output = computeSoftmax(\n inferenceHandler, isTransposeRequired ? transposedInputs : inputs, attributes, logicalRowCount, featureCount);\n\n if (isTransposeRequired) {\n const reversedOutput = transpose(inferenceHandler, output, transposeAttribute!);\n return reversedOutput;\n } else {\n return output;\n }\n };\n\nconst computeSoftmax =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: SoftmaxAttributes, logicalRowCount: number,\n featureCount: number): Tensor[] => {\n const computeMaxProgramInfo =\n createComputeMaxProgramInfo(inferenceHandler, inputs[0], logicalRowCount, featureCount, [logicalRowCount]);\n const max = inferenceHandler.run(\n {...softmaxComputeMaxProgramMetadata, cacheHint: attributes.cacheKey, get: () => computeMaxProgramInfo},\n inputs);\n\n const computeScaleProgramInfo = createComputScaleProgramInfo(\n inferenceHandler, inputs[0], logicalRowCount, featureCount, computeMaxProgramInfo.output.dims,\n [logicalRowCount]);\n const scale = inferenceHandler.run(\n {...softmaxComputeScaleProgramMetadata, cacheHint: attributes.cacheKey, get: () => computeScaleProgramInfo},\n [inputs[0], max]);\n\n const softMaxProgramInfo = createSoftMaxProgramInfo(\n inferenceHandler, inputs[0], logicalRowCount, featureCount, computeMaxProgramInfo.output.dims,\n computeScaleProgramInfo.output.dims);\n const output = inferenceHandler.run(\n {...softmaxProgramMetadata, cacheHint: attributes.cacheKey, get: () => softMaxProgramInfo},\n [inputs[0], max, scale]);\n return [output];\n };\n\n/**\n * Create a texture that contains the maximum value of each of the 'N' rows\n */\nconst createComputeMaxProgramInfo =\n (inferenceHandler: WebGLInferenceHandler, input: Tensor, logicalRowCount: number, featureCount: number,\n outputShape: number[]): ProgramInfo => {\n const [textureWidth, textureHeight] =\n inferenceHandler.calculateTextureWidthAndHeight(input.dims, TextureType.unpacked);\n const rank = outputShape.length;\n\n if (logicalRowCount < 1 || featureCount < 1) {\n throw new Error('Logical row count N and feature count D must be greater than or equal to 1');\n }\n\n if (outputShape.length !== 1) {\n throw new Error('Dimensionality of the output should be 1');\n }\n\n if (outputShape[0] !== logicalRowCount) {\n throw new Error('Shape of the output should be equal to logical row count');\n }\n\n const glsl = getGlsl(inferenceHandler.session.backend.glContext.version);\n const shaderSource = `\n float process(int[${rank}] indices) {\n int logical_row_start_offset = indices[0] * ${featureCount};\n\n float max = getColorAsFloat(${glsl.texture2D}(A, offsetToCoords(logical_row_start_offset, ${textureWidth},\n ${textureHeight} )));\n for(int i=1; i<${featureCount}; ++i)\n {\n float current = getColorAsFloat(${glsl.texture2D}(A, offsetToCoords(logical_row_start_offset + i,\n ${textureWidth}, ${textureHeight})));\n if(current > max)\n max = current;\n }\n\n return max;\n }`;\n return {\n ...softmaxComputeMaxProgramMetadata,\n output: {dims: outputShape, type: input.type, textureType: TextureType.unpacked},\n shaderSource\n };\n };\n\n/**\n * Create a texture that contains the normalization factor for each of the 'N' rows\n */\nconst createComputScaleProgramInfo =\n (inferenceHandler: WebGLInferenceHandler, input: Tensor, logicalRowCount: number, featureCount: number,\n maxElementPerLogicalRow: readonly number[], outputShape: number[]): ProgramInfo => {\n const [textureWidth, textureHeight] =\n inferenceHandler.calculateTextureWidthAndHeight(input.dims, TextureType.unpacked);\n const rank = outputShape.length;\n\n if (logicalRowCount < 1 || featureCount < 1) {\n throw new Error('Logical row count N and feature count D must be greater than or equal to 1');\n }\n\n if (outputShape.length !== 1) {\n throw new Error('Dimensionality of the output should be 1');\n }\n\n if (outputShape[0] !== logicalRowCount) {\n throw new Error('Shape of the output should be equal to logical row count');\n }\n\n if (maxElementPerLogicalRow.length !== 1) {\n throw new Error('Dimensionality of the intermediate results should be 1');\n }\n\n if (maxElementPerLogicalRow[0] !== logicalRowCount) {\n throw new Error('Shape of the intermediate results should be equal to logical row count');\n }\n\n const glsl = getGlsl(inferenceHandler.session.backend.glContext.version);\n const shaderSource = `\n float process(int[${rank}] indices) {\n int logical_row_start_offset = indices[0] * ${featureCount};\n\n float norm_factor = 0.0;\n float max = _Max(indices);\n for(int i=0; i<${featureCount}; ++i)\n {\n norm_factor += exp(getColorAsFloat(${glsl.texture2D}(A, offsetToCoords(logical_row_start_offset + i,\n ${textureWidth}, ${textureHeight}))) - max);\n }\n\n return norm_factor;\n }`;\n return {\n ...softmaxComputeScaleProgramMetadata,\n output: {dims: outputShape, type: input.type, textureType: TextureType.unpacked},\n shaderSource\n };\n };\n\nconst createSoftMaxProgramInfo =\n (inferenceHandler: WebGLInferenceHandler, input: Tensor, logicalRowCount: number, featureCount: number,\n maxElementPerLogicalRow: readonly number[], normalizationPerLogicalRow: readonly number[]): ProgramInfo => {\n const [textureWidth, textureHeight] =\n inferenceHandler.calculateTextureWidthAndHeight(input.dims, TextureType.unpacked);\n const rank = input.dims.length;\n\n if (logicalRowCount < 1 || featureCount < 1) {\n throw new Error('Logical row count N and feature count D must be greater than or equal to 1');\n }\n\n if (maxElementPerLogicalRow.length !== 1 || normalizationPerLogicalRow.length !== 1) {\n throw new Error('Dimensionality of the intermediate results should be 1');\n }\n\n if (maxElementPerLogicalRow[0] !== logicalRowCount || normalizationPerLogicalRow[0] !== logicalRowCount) {\n throw new Error('Shape of the intermediate results should be equal to logical row count');\n }\n\n const shaderSource = `\n float process(int[${rank}] indices) {\n\n // get offset of current logical tensor index from the 2-D texture coordinates (TexCoords)\n int offset = coordsToOffset(TexCoords, ${textureWidth}, ${textureHeight});\n\n //determine the logical row for this index\n int logical_row_index[1];\n logical_row_index[0] = offset / ${featureCount};\n\n float norm_factor = _Norm(logical_row_index);\n\n // avoid possible division by 0\n // if norm_facor is 0, all elements are zero\n // if so, return 0\n if(norm_factor == 0.0)\n return 0.0;\n\n return exp(_A(indices) - _Max(logical_row_index)) / norm_factor;\n }`;\n return {\n ...softmaxProgramMetadata,\n output: {dims: input.dims, type: input.type, textureType: TextureType.unpacked},\n shaderSource\n };\n };\n\nconst validateInputs = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length !== 1) {\n throw new Error('Softmax requires 1 input.');\n }\n\n if (inputs[0].type !== 'float32' && inputs[0].type !== 'float64') {\n throw new Error('Invalid input type');\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {AttributeWithCacheKey, createAttributeWithCacheKey} from '../../../attribute-with-cache-key';\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {ShapeUtil, SplitUtil} from '../../../util';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, TextureType} from '../types';\n\nexport interface SplitAttributes extends AttributeWithCacheKey {\n readonly axis: number;\n readonly split: number[];\n readonly numOutputs: number;\n}\n\nconst splitProgramMetadata = {\n name: 'Split',\n inputNames: ['A'],\n inputTypes: [TextureType.unpacked],\n};\n\nexport const split: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], attributes: SplitAttributes): Tensor[] => {\n validateInputs(inputs);\n\n const axis = ShapeUtil.normalizeAxis(attributes.axis, inputs[0].dims.length);\n const count = getProgramCount(inferenceHandler, inputs, axis, attributes);\n const output: Tensor[] = [];\n for (let i = 0; i < count; ++i) {\n output.push(inferenceHandler.run(\n {\n ...splitProgramMetadata,\n cacheHint: `${attributes.cacheKey};${i}`,\n get: () => createSplitProgramInfo(inferenceHandler, inputs[0], attributes, axis, i)\n },\n inputs));\n }\n\n return output;\n };\n\nexport const parseSplitAttributes: OperatorInitialization = (node: Graph.Node): SplitAttributes => {\n const axis = node.attributes.getInt('axis', 0);\n const split = node.attributes.getInts('split', []);\n const numOutputs = node.outputs.length;\n return createAttributeWithCacheKey({axis, split, numOutputs});\n};\n\nconst getProgramCount =\n (_inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], axis: number, attributes: SplitAttributes): number => {\n const [, offsets] = SplitUtil.splitShape(inputs[0].dims, axis, attributes.split, attributes.numOutputs);\n return offsets.length;\n };\n\nconst createSplitProgramInfo =\n (_inferenceHandler: WebGLInferenceHandler, input: Tensor, attributes: SplitAttributes, axis: number, index: number):\n ProgramInfo => {\n const [shapes, offsets] = SplitUtil.splitShape(input.dims, axis, attributes.split, attributes.numOutputs);\n const offset = offsets[index];\n const outputShape = shapes[index];\n const rank = outputShape.length;\n const shaderSource = `\n float process(int indices[${rank}]) {\n indices[${axis}] += ${offset};\n return _A(indices);\n }\n `;\n return {\n ...splitProgramMetadata,\n cacheHint: `${attributes.cacheKey}:${index}`,\n output: {dims: outputShape, type: input.type, textureType: TextureType.unpacked},\n shaderSource\n };\n };\n\nconst validateInputs = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length !== 1) {\n throw new Error('Split requires one input.');\n }\n\n if (inputs[0].type !== 'int8' && inputs[0].type !== 'uint8' && inputs[0].type !== 'int16' &&\n inputs[0].type !== 'uint16' && inputs[0].type !== 'int32' && inputs[0].type !== 'uint32' &&\n inputs[0].type !== 'float32' && inputs[0].type !== 'float64' && inputs[0].type !== 'bool') {\n throw new Error('Invalid input type.');\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {ShapeUtil} from '../../../util';\nimport {WebGLInferenceHandler} from '../inference-handler';\n\nexport const squeeze: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], axes: number[]): Tensor[] => {\n validateInputs(inputs);\n const outputShape = ShapeUtil.squeezeShape(inputs[0].dims, axes);\n const output = inferenceHandler.reshapeUnpacked(inputs[0], outputShape);\n return [output];\n };\n\nexport const squeezeV13 = (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[]): Tensor[] => {\n validateInputsV13(inputs);\n return squeeze(inferenceHandler, [inputs[0]], Array.from(inputs[1].integerData));\n};\n\nexport const parseSqueezeAttributes: OperatorInitialization = (node: Graph.Node): number[] =>\n node.attributes.getInts('axes');\n\nconst validateInputs = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length !== 1) {\n throw new Error('Squeeze requires 1 input.');\n }\n\n if (inputs[0].type === 'string') {\n throw new Error('invalid input tensor types.');\n }\n};\n\nconst validateInputsV13 = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length !== 2) {\n throw new Error('Squeeze requires 2 inputs.');\n }\n\n if (inputs[1].type !== 'int32') {\n throw new Error('Invalid input type.');\n }\n};","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Tensor} from '../../../tensor';\nimport {getGlsl} from '../glsl-source';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramMetadata, TextureType} from '../types';\n\nexport const sum = (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[]): Tensor[] => {\n validateInputs(inputs);\n\n const sumProgramMetadata = {\n name: 'Sum',\n inputNames: inputs.map((_v, i) => `X${i}`),\n inputTypes: new Array(inputs.length).fill(TextureType.unpacked)\n };\n\n const output = inferenceHandler.run(\n {...sumProgramMetadata, get: () => createSumProgramInfo(inferenceHandler, inputs, sumProgramMetadata)}, inputs);\n return [output];\n};\n\nconst createSumProgramInfo =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], sumProgramMetadata: ProgramMetadata): ProgramInfo => {\n const glsl = getGlsl(inferenceHandler.session.backend.glContext.version);\n const outputShape = inputs[0].dims.slice();\n const sumLine = inputs.map((_v, i) => `${glsl.texture2D}(X${i},TexCoords)`).join(' + ');\n const shaderSource = `\n void main() {\n vec4 result = ${sumLine};\n ${glsl.output} = result;\n }\n `;\n return {\n ...sumProgramMetadata,\n output: {dims: outputShape, type: inputs[0].type, textureType: TextureType.unpacked},\n hasMain: true,\n shaderSource\n };\n };\n\nconst validateInputs = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length === 0) {\n throw new Error('Sum requires inputs.');\n }\n\n const length = inputs[0].dims.length;\n for (let i = 1; i < inputs.length; i++) {\n if (length !== inputs[i].dims.length) {\n throw new Error('Input shapes are mismatched.');\n }\n\n for (let j = 0; j < length; j++) {\n if (inputs[0].dims[j] !== inputs[i].dims[j]) {\n throw new Error('Input shapes are not matched.');\n }\n }\n }\n\n if (inputs[0].type !== 'float32' && inputs[0].type !== 'float64') {\n throw new Error('Invalid input type.');\n }\n for (let i = 1; i < inputs.length; i++) {\n if (inputs[0].type !== inputs[i].type) {\n throw new Error('Input types are not matched.');\n }\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {NUMBER_TYPES} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {WebGLInferenceHandler} from '../inference-handler';\nimport {ProgramInfo, ProgramMetadata, TextureType} from '../types';\n\nexport const tile = (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[]): Tensor[] => {\n validateInputs(inputs);\n\n const tileProgramMetadata = {\n name: 'Tile',\n inputNames: ['A'],\n inputTypes: [TextureType.unpacked],\n };\n\n const output = inferenceHandler.run(\n {...tileProgramMetadata, get: () => createTileProgramInfo(inferenceHandler, inputs, tileProgramMetadata)},\n inputs);\n return [output];\n};\n\nconst createTileProgramInfo =\n (_handler: WebGLInferenceHandler, inputs: Tensor[], tileProgramMetadata: ProgramMetadata): ProgramInfo => {\n const inputShape = inputs[0].dims.slice();\n const outputShape = new Array(inputShape.length);\n\n const tileOps: string[] = [];\n for (let i = 0; i < inputShape.length; i++) {\n outputShape[i] = inputShape[i] * inputs[1].numberData[i];\n tileOps.push(`inputIdx[${i}] = int(mod(float(outputIdx[${i}]), ${inputShape[i]}.));`);\n }\n\n const rank = outputShape.length;\n const shaderSource = `\n float process(int outputIdx[${rank}]) {\n int inputIdx[${rank}];\n ${tileOps.join('\\n')}\n return _A(inputIdx);\n }\n `;\n return {\n ...tileProgramMetadata,\n output: {dims: outputShape, type: inputs[0].type, textureType: TextureType.unpacked},\n shaderSource\n };\n };\n\nconst validateInputs = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length !== 2) {\n throw new Error('Tile requires 2 input.');\n }\n if (inputs[1].dims.length !== 1) {\n throw new Error('The second input shape must 1 dimension.');\n }\n if (inputs[1].dims[0] !== inputs[0].dims.length) {\n throw new Error('Invalid input shape.');\n }\n if (NUMBER_TYPES.indexOf(inputs[0].type) === -1) {\n throw new Error('Invalid input type.');\n }\n if (inputs[1].type !== 'int32' && inputs[1].type !== 'int16') {\n throw new Error('Invalid repeat type.');\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Graph} from '../../../graph';\nimport {OperatorImplementation, OperatorInitialization} from '../../../operators';\nimport {Tensor} from '../../../tensor';\nimport {ShapeUtil} from '../../../util';\nimport {WebGLInferenceHandler} from '../inference-handler';\n\nexport const unsqueeze: OperatorImplementation =\n (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[], axes: number[]): Tensor[] => {\n validateInputs(inputs);\n const outputShape = ShapeUtil.unsqueezeShape(inputs[0].dims, axes);\n const output = inferenceHandler.reshapeUnpacked(inputs[0], outputShape);\n return [output];\n };\n\nexport const unsqueezeV13 = (inferenceHandler: WebGLInferenceHandler, inputs: Tensor[]): Tensor[] => {\n validateInputsV13(inputs);\n return unsqueeze(inferenceHandler, [inputs[0]], Array.from(inputs[1].integerData));\n};\n\nexport const parseUnsqueezeAttributes: OperatorInitialization = (node: Graph.Node): number[] =>\n node.attributes.getInts('axes');\n\nconst validateInputs = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length !== 1) {\n throw new Error('Unsqueeze requires 1 input.');\n }\n\n if (inputs[0].type === 'string') {\n throw new Error('invalid input tensor types.');\n }\n};\n\nconst validateInputsV13 = (inputs: Tensor[]): void => {\n if (!inputs || inputs.length !== 2) {\n throw new Error('Unsqueeze requires 2 inputs.');\n }\n\n if (inputs[1].type !== 'int32') {\n throw new Error('Invalid input type.');\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {OpSet} from '../../opset';\n\nimport {batchNormalization, parseBatchNormalizationAttributes} from './ops/batch-normalization';\nimport * as binaryOps from './ops/binary-op';\nimport {cast, parseCastAttributes} from './ops/cast';\nimport {concat, parseConcatAttributes} from './ops/concat';\nimport {conv, parseConvAttributes} from './ops/conv';\nimport {convTranspose, parseConvTransposeAttributes} from './ops/conv-transpose';\nimport {depthToSpace, parseDepthToSpaceAttributes} from './ops/depth-to-space';\nimport {flatten, parseFlattenAttributes} from './ops/flatten';\nimport {gather, parseGatherAttributes} from './ops/gather';\nimport {gemm, parseGemmAttributesV11, parseGemmAttributesV7} from './ops/gemm';\nimport {imageScaler, parseImageScalerAttributes} from './ops/image-scaler';\nimport {instanceNormalization, parseInstanceNormalizationAttributes} from './ops/instance-normalization';\nimport {lrn, parseLrnAttributes} from './ops/lrn';\nimport {matMul, parseMatMulAttributes} from './ops/matmul';\nimport {padV11, padV2, parsePadAttributesV11, parsePadAttributesV2} from './ops/pad';\nimport {averagePool, globalAveragePool, globalMaxPool, maxPool, parseAveragePoolAttributes, parseGlobalAveragePoolAttributes, parseMaxPoolAttributes} from './ops/pool';\nimport {parseReduceAttributes, reduceLogSum, reduceLogSumSquare, reduceMax, reduceMean, reduceMin, reduceProd, reduceSum} from './ops/reduce';\nimport {reshape} from './ops/reshape';\nimport {parseResizeAttributesV10, parseResizeAttributesV11, resize} from './ops/resize-packed';\nimport {shape} from './ops/shape';\nimport {parseSliceAttributes, slice, sliceV10} from './ops/slice';\nimport {parseSoftmaxAttributes, parseSoftmaxAttributesV13, softmax, softmaxV13} from './ops/softmax';\nimport {parseSplitAttributes, split} from './ops/split';\nimport {parseSqueezeAttributes, squeeze, squeezeV13} from './ops/squeeze';\nimport {sum} from './ops/sum';\nimport {tile} from './ops/tile';\nimport {parseTransposeAttributes, transpose} from './ops/transpose';\nimport * as unaryOps from './ops/unary-op';\nimport {parseUnsqueezeAttributes, unsqueeze, unsqueezeV13} from './ops/unsqueeze';\nimport {parseUpsampleAttributesV7, parseUpsampleAttributesV9, upsample} from './ops/upsample';\n\nexport const WEBGL_OP_RESOLVE_RULES: readonly OpSet.ResolveRule[] = [\n ['Abs', '', '6+', unaryOps.abs],\n ['Acos', '', '7+', unaryOps.acos],\n ['Add', '', '7+', binaryOps.add],\n ['And', '', '7+', binaryOps.and],\n ['Asin', '', '7+', unaryOps.asin],\n ['Atan', '', '7+', unaryOps.atan],\n // TODO: support new attributes for AveragePool-10\n ['AveragePool', '', '7+', averagePool, parseAveragePoolAttributes],\n ['BatchNormalization', '', '7+', batchNormalization, parseBatchNormalizationAttributes],\n ['Cast', '', '6+', cast, parseCastAttributes],\n ['Ceil', '', '6+', unaryOps.ceil],\n ['Clip', '', '6-10', unaryOps.clip, unaryOps.parseClipAttributes],\n ['Clip', '', '11+', unaryOps.clipV11],\n ['Concat', '', '4+', concat, parseConcatAttributes],\n ['Conv', '', '1+', conv, parseConvAttributes],\n ['ConvTranspose', '', '1+', convTranspose, parseConvTransposeAttributes],\n ['Cos', '', '7+', unaryOps.cos],\n ['Div', '', '7+', binaryOps.div],\n ['Dropout', '', '7+', unaryOps.identity],\n ['DepthToSpace', '', '1+', depthToSpace, parseDepthToSpaceAttributes],\n ['Equal', '', '7+', binaryOps.equal],\n ['Elu', '', '6+', unaryOps.elu, unaryOps.parseEluAttributes],\n ['Exp', '', '6+', unaryOps.exp],\n ['Flatten', '', '1+', flatten, parseFlattenAttributes],\n ['Floor', '', '6+', unaryOps.floor],\n ['FusedConv', 'com.microsoft', '1+', conv, parseConvAttributes],\n ['Gather', '', '1+', gather, parseGatherAttributes],\n ['Gemm', '', '7-10', gemm, parseGemmAttributesV7],\n ['Gemm', '', '11+', gemm, parseGemmAttributesV11],\n ['GlobalAveragePool', '', '1+', globalAveragePool, parseGlobalAveragePoolAttributes],\n ['GlobalMaxPool', '', '1+', globalMaxPool],\n ['Greater', '', '7+', binaryOps.greater],\n ['Identity', '', '1+', unaryOps.identity],\n ['ImageScaler', '', '1+', imageScaler, parseImageScalerAttributes],\n ['InstanceNormalization', '', '6+', instanceNormalization, parseInstanceNormalizationAttributes],\n ['LeakyRelu', '', '6+', unaryOps.leakyRelu, unaryOps.parseLeakyReluAttributes],\n ['Less', '', '7+', binaryOps.less],\n ['LRN', '', '1+', lrn, parseLrnAttributes],\n ['Log', '', '6+', unaryOps.log],\n ['MatMul', '', '1+', matMul, parseMatMulAttributes],\n // TODO: support new attributes for MaxPool-8 and MaxPool-10\n ['MaxPool', '', '1+', maxPool, parseMaxPoolAttributes],\n ['Mul', '', '7+', binaryOps.mul],\n ['Neg', '', '6+', unaryOps.neg],\n ['Not', '', '1+', unaryOps.not],\n ['Or', '', '7+', binaryOps.or],\n ['Pad', '', '2-10', padV2, parsePadAttributesV2],\n ['Pad', '', '11+', padV11, parsePadAttributesV11],\n ['Pow', '', '7+', binaryOps.pow],\n ['PRelu', '', '7+', binaryOps.pRelu],\n ['ReduceLogSum', '', '1+', reduceLogSum, parseReduceAttributes],\n ['ReduceMax', '', '1+', reduceMax, parseReduceAttributes],\n ['ReduceMean', '', '1+', reduceMean, parseReduceAttributes],\n ['ReduceMin', '', '1+', reduceMin, parseReduceAttributes],\n ['ReduceProd', '', '1+', reduceProd, parseReduceAttributes],\n ['ReduceSum', '', '1-12', reduceSum, parseReduceAttributes],\n ['ReduceSumSquare', '', '1+', reduceLogSumSquare, parseReduceAttributes],\n ['Relu', '', '6+', unaryOps.relu],\n ['Reshape', '', '5+', reshape],\n ['Resize', '', '10', resize, parseResizeAttributesV10],\n ['Resize', '', '11+', resize, parseResizeAttributesV11],\n ['Shape', '', '1+', shape],\n ['Sigmoid', '', '6+', unaryOps.sigmoid],\n ['Sin', '', '7+', unaryOps.sin],\n ['Slice', '', '10+', sliceV10], // TODO: support 'steps' for Slice-10\n ['Slice', '', '1-9', slice, parseSliceAttributes],\n // The \"semantic\" meaning of axis has changed in opset-13.\n ['Softmax', '', '1-12', softmax, parseSoftmaxAttributes],\n ['Softmax', '', '13+', softmaxV13, parseSoftmaxAttributesV13],\n // 'Split' operator has an optional attribute 'split'\n // this attribute determines how the specified axis of input data is split.\n // When the attribute is missing, we need the count of number of outputs\n // so that we can determine the 'split' attribute from the runtime input to the Operator\n ['Split', '', '2-12', split, parseSplitAttributes],\n ['Sqrt', '', '6+', unaryOps.sqrt],\n ['Squeeze', '', '1-12', squeeze, parseSqueezeAttributes],\n ['Squeeze', '', '13+', squeezeV13],\n ['Sub', '', '7+', binaryOps.sub],\n ['Sum', '', '6+', sum],\n ['Tan', '', '7+', unaryOps.tan],\n ['Tanh', '', '6+', unaryOps.tanh],\n ['Tile', '', '6+', tile],\n ['Transpose', '', '1+', transpose, parseTransposeAttributes],\n ['Upsample', '', '7-8', upsample, parseUpsampleAttributesV7],\n ['Upsample', '', '9', upsample, parseUpsampleAttributesV9],\n ['Unsqueeze', '', '1-12', unsqueeze, parseUnsqueezeAttributes],\n ['Unsqueeze', '', '13+', unsqueezeV13],\n ['Xor', '', '7+', binaryOps.xor],\n];\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nconst INLINE_FUNC_DEF_REGEX = /@inline[\\s\\n\\r]+(\\w+)[\\s\\n\\r]+([0-9a-zA-Z_]+)\\s*\\(([^)]*)\\)\\s*{(([^}]|[\\n\\r])*)}/gm;\nconst FUNC_CALL_REGEX = '(\\\\w+)?\\\\s+([_0-9a-zA-Z]+)\\\\s+=\\\\s+__FUNC__\\\\((.*)\\\\)\\\\s*;';\n/**\n * GLSL preprocessor responsible for resolving @inline directives\n */\nexport function replaceInlines(script: string): string {\n const inlineDefs: {[name: string]: {params: Array<{type: string; name: string}|null>; body: string}} = {};\n let match;\n while ((match = INLINE_FUNC_DEF_REGEX.exec(script)) !== null) {\n const params = match[3]\n .split(',')\n .map(s => {\n const tokens = s.trim().split(' ');\n if (tokens && tokens.length === 2) {\n return {type: tokens[0], name: tokens[1]};\n }\n return null;\n })\n .filter(v => v !== null);\n inlineDefs[match[2]] = {params, body: match[4]};\n }\n for (const name in inlineDefs) {\n const regexString = FUNC_CALL_REGEX.replace('__FUNC__', name);\n const regex = new RegExp(regexString, 'gm');\n while ((match = regex.exec(script)) !== null) {\n const type = match[1];\n const variable = match[2];\n const params = match[3].split(',');\n const declLine = (type) ? `${type} ${variable};` : '';\n let newBody: string = inlineDefs[name].body;\n let paramRedecLine = '';\n inlineDefs[name].params.forEach((v, i) => {\n if (v) {\n paramRedecLine += `${v.type} ${v.name} = ${params[i]};\\n`;\n }\n });\n newBody = `${paramRedecLine}\\n ${newBody}`;\n newBody = newBody.replace('return', `${variable} = `);\n const replacement = `\n ${declLine}\n {\n ${newBody}\n }\n `;\n script = script.replace(match[0], replacement);\n }\n }\n script = script.replace(INLINE_FUNC_DEF_REGEX, '');\n return script;\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Logger} from '../../instrument';\nimport {assert} from '../../util';\n\n/** Layout preferences */\nexport interface WidthHeightPrefs {\n breakAxis?: number;\n isPacked?: boolean;\n reverseWH?: boolean;\n}\n/**\n * TextureLayoutStrategy is an abstraction for different plans\n * for mapping n-dimensional arrays to 2D textures (and back)\n */\nexport interface TextureLayoutStrategy {\n computeTextureWH(shape: readonly number[], prefs?: WidthHeightPrefs): [number, number];\n}\n\n/**\n * This strategy try to find the minimal max(W,H) that fulfills (W * H == totalSize)\n */\nexport class AlwaysKeepOriginalSizeStrategy implements TextureLayoutStrategy {\n constructor(public maxTextureSize: number) {}\n computeTextureWH(shape: readonly number[], prefs?: WidthHeightPrefs): [number, number] {\n // scalar tensor\n if (shape.length === 0) {\n return [1, 1];\n }\n const maxTextureSize = this.maxTextureSize;\n if (prefs && prefs.breakAxis !== undefined) {\n // check to see if dims fit\n const wsize = prefs.breakAxis >= shape.length ? 1 : shape.slice(prefs.breakAxis).reduce((a, b) => a * b);\n const hsize = prefs.breakAxis <= 0 ? 1 : shape.slice(0, prefs.breakAxis).reduce((a, b) => a * b);\n if (wsize > maxTextureSize || hsize > maxTextureSize) {\n // ignore preferences\n // continue with default layout\n Logger.verbose(\n 'TextureLayout',\n `Given width/height preferences were unattainable: shape:${shape}, breakAxis:${prefs.breakAxis}`);\n } else {\n return [wsize, hsize];\n }\n }\n const totalSize = shape.reduce((a, b) => a * b);\n\n let width = Math.floor(Math.sqrt(totalSize));\n\n for (; width < maxTextureSize && width < totalSize; width++) {\n if (totalSize % width === 0) {\n break;\n }\n }\n\n if (width >= maxTextureSize || totalSize % width !== 0) {\n throw new Error(`The given dimensions are outside this GPU's boundaries: ${shape}`);\n }\n return [width, totalSize / width];\n }\n}\n\nexport class PreferLogicalStrategy implements TextureLayoutStrategy {\n constructor(public maxTextureSize: number) {}\n computeTextureWH(shape: readonly number[], prefs?: WidthHeightPrefs): [number, number] {\n const wh = this.computeTexture(shape, prefs);\n if (prefs && prefs.isPacked) {\n wh[0] /= 2;\n wh[1] /= 2;\n }\n if (prefs && prefs.reverseWH) {\n return [wh[1], wh[0]];\n }\n return wh;\n }\n\n computeTexture(shape: readonly number[], prefs?: WidthHeightPrefs): [number, number] {\n const isPacked = prefs && prefs.isPacked;\n // scalar tensor\n if (shape.length === 0) {\n return isPacked ? [2, 2] : [1, 1];\n }\n let maxTextureSize = this.maxTextureSize;\n if (prefs && prefs.breakAxis !== undefined) {\n // check to see if dims fit\n const wsize = prefs.breakAxis >= shape.length ? 1 : shape.slice(prefs.breakAxis).reduce((a, b) => a * b);\n const hsize = prefs.breakAxis <= 0 ? 1 : shape.slice(0, prefs.breakAxis).reduce((a, b) => a * b);\n if (wsize > maxTextureSize || hsize > maxTextureSize) {\n // ignore preferences\n // continue with default layout\n Logger.verbose(\n 'TextureLayout',\n `Given width/height preferences were unattainable: shape:${shape}, breakAxis:${prefs.breakAxis}`);\n } else {\n return [wsize, hsize];\n }\n }\n let logShape = shape.slice(0);\n if (isPacked) {\n maxTextureSize = maxTextureSize * 2;\n\n // This logic ensures we accurately count the number of packed texels needed\n // to accommodate the tensor. We can only pack values in the same texel if\n // they are from adjacent pairs of rows/cols within the same batch. So if a\n // tensor has 3 rows, we pretend it has 4 rows in order to account for the\n // fact that the texels containing the third row are half empty.\n logShape = logShape.map(\n (_d, i) => i >= logShape.length - 2 ? (logShape[i] % 2 === 0 ? logShape[i] : logShape[i] + 1) : logShape[i]);\n\n // Packed texture height is at least 2 (the channel height of a single\n // texel).\n if (logShape.length === 1) {\n logShape = [2, logShape[0]];\n }\n }\n\n // If logical shape is 2, we don't squeeze, since we want to match physical.\n if (logShape.length !== 2) {\n const squeezeResult = squeezeShape(logShape);\n logShape = squeezeResult.newShape;\n }\n\n const size = sizeFromShape(logShape);\n if (logShape.length <= 1 && size <= maxTextureSize) {\n return [1, size];\n } else if (logShape.length === 2 && logShape[0] <= maxTextureSize && logShape[1] <= maxTextureSize) {\n return logShape as [number, number];\n } else if (logShape.length === 3 && logShape[0] * logShape[1] <= maxTextureSize && logShape[2] <= maxTextureSize) {\n return [logShape[0] * logShape[1], logShape[2]];\n } else if (logShape.length === 3 && logShape[0] <= maxTextureSize && logShape[1] * logShape[2] <= maxTextureSize) {\n return [logShape[0], logShape[1] * logShape[2]];\n } else if (\n logShape.length === 4 && logShape[0] * logShape[1] * logShape[2] <= maxTextureSize &&\n logShape[3] <= maxTextureSize) {\n return [logShape[0] * logShape[1] * logShape[2], logShape[3]];\n } else if (\n logShape.length === 4 && logShape[0] <= maxTextureSize &&\n logShape[1] * logShape[2] * logShape[3] <= maxTextureSize) {\n return [logShape[0], logShape[1] * logShape[2] * logShape[3]];\n } else {\n if (isPacked) {\n // For packed textures size equals the number of channels required to\n // accommodate the texture data. However in order to squarify such that\n // inner dimensions stay even, we rewrite size to equal the number of\n // texels. Then in the return statement we rehydrate the squarified\n // dimensions to channel units.\n return sizeToSquarishShape(size / 4).map(d => d * 2) as [number, number];\n }\n return sizeToSquarishShape(size);\n }\n }\n}\n\nexport function squeezeShape(shape: number[], axis?: number[]): {newShape: number[]; keptDims: number[]} {\n const newShape: number[] = [];\n const keptDims: number[] = [];\n const isEmptyArray = axis != null && Array.isArray(axis) && axis.length === 0;\n const axes = (axis == null || isEmptyArray) ? null : parseAxisParam(axis, shape).sort();\n let j = 0;\n for (let i = 0; i < shape.length; ++i) {\n if (axes != null) {\n if (axes[j] === i && shape[i] !== 1) {\n throw new Error(`Can't squeeze axis ${i} since its dim '${shape[i]}' is not 1`);\n }\n if ((axes[j] == null || axes[j] > i) && shape[i] === 1) {\n newShape.push(shape[i]);\n keptDims.push(i);\n }\n if (axes[j] <= i) {\n j++;\n }\n }\n if (shape[i] !== 1) {\n newShape.push(shape[i]);\n keptDims.push(i);\n }\n }\n return {newShape, keptDims};\n}\n\nexport function parseAxisParam(axis: number|number[], shape: number[]): number[] {\n const rank = shape.length;\n\n // Normalize input\n axis = axis == null ? shape.map((_s, i) => i) : ([] as number[]).concat(axis);\n\n // Check for valid range\n assert(\n axis.every(ax => ax >= -rank && ax < rank),\n () => `All values in axis param must be in range [-${rank}, ${rank}) but ` +\n `got axis ${axis}`);\n\n // Check for only integers\n assert(\n axis.every(isInt),\n () => 'All values in axis param must be integers but ' +\n `got axis ${axis}`);\n\n // Handle negative axis.\n return axis.map(a => a < 0 ? rank + a : a);\n}\nexport function isInt(a: number): boolean {\n return a % 1 === 0;\n}\nexport function sizeFromShape(shape: number[]): number {\n if (shape.length === 0) {\n // Scalar.\n return 1;\n }\n let size = shape[0];\n for (let i = 1; i < shape.length; i++) {\n size *= shape[i];\n }\n return size;\n}\nexport function getRowsCols(shape: number[]): [number, number] {\n if (shape.length === 0) {\n throw Error('Cannot get rows and columns of an empty shape array.');\n }\n\n return [shape.length > 1 ? shape[shape.length - 2] : 1, shape[shape.length - 1]];\n}\nexport function sizeToSquarishShape(size: number): [number, number] {\n const width = Math.ceil(Math.sqrt(size));\n return [width, Math.ceil(size / width)];\n}\nexport function getBatchDim(shape: number[], dimsToSkip = 2): number {\n return sizeFromShape(shape.slice(0, shape.length - dimsToSkip));\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {ArrayUtil, BroadcastUtil, ShapeUtil} from '../../util';\n\nimport {GlslContext, GlslLib, GlslLibRoutine} from './glsl-definitions';\nimport {getGlsl} from './glsl-source';\nimport {squeezeShape} from './texture-layout-strategy';\nimport {TextureLayout} from './types';\nimport {generateShaderFuncNameFromInputSamplerName, generateShaderFuncNameFromInputSamplerNameAtOutCoords, getCoordsDataType, getGlChannels, getSqueezedParams, squeezeInputShape} from './utils';\n\n/**\n * GLSL Library responsible for data types and routines for manipulating\n * coordinates and mapping to/from tensor indices\n */\nexport class CoordsGlslLib extends GlslLib {\n returnType: string;\n\n constructor(context: GlslContext) {\n super(context);\n }\n getFunctions(): {[name: string]: GlslLibRoutine} {\n return {\n ...this.offsetToCoords(),\n ...this.coordsToOffset(),\n ...this.toVec(),\n ...this.valueFrom(),\n // TODO return these only when packing is enabled.\n ...this.getCommonUtilFuncs(),\n ...this.getInputsSamplingSnippets(),\n ...this.getOutputSamplingSnippet()\n };\n }\n getCustomTypes() {\n return {};\n }\n /**\n * Produces a function that can map from\n * 2D normalzied coordinates (s,t) to a flat offset\n */\n protected offsetToCoords(): {[name: string]: GlslLibRoutine} {\n const funcName = 'offsetToCoords';\n return {\n offsetToCoords: new GlslLibRoutine(`\n vec2 ${funcName}(int offset, int width, int height) {\n int t = offset / width;\n int s = offset - t*width;\n vec2 coords = (vec2(s,t) + vec2(0.5,0.5)) / vec2(width, height);\n return coords;\n }\n `)\n };\n }\n\n /**\n * Produces a function that can map from\n * 2D normalzied coordinates (s,t) to a flat offset\n */\n protected coordsToOffset(): {[name: string]: GlslLibRoutine} {\n const funcName = 'coordsToOffset';\n return {\n coordsToOffset: new GlslLibRoutine(`\n int ${funcName}(vec2 coords, int width, int height) {\n float s = coords.s * float(width);\n float t = coords.t * float(height);\n int offset = int(t) * width + int(s);\n return offset;\n }\n `)\n };\n }\n\n /**\n * Generates code for output sampler.\n */\n\n protected getOutputSamplingSnippet(): {[name: string]: GlslLibRoutine} {\n const outputLayout = this.context.outputTextureLayout;\n if (outputLayout.isPacked) {\n return this.getPackedOutputSamplingSnippet(outputLayout);\n } else {\n return this.getUnpackedOutputSamplingSnippet(outputLayout);\n }\n }\n\n /**\n * Generates code for packed output sampler.\n */\n protected getPackedOutputSamplingSnippet(outputLayout: TextureLayout): {[name: string]: GlslLibRoutine} {\n const outShape = outputLayout.unpackedShape;\n const outTexShape = [outputLayout.width, outputLayout.height];\n const result: {[name: string]: GlslLibRoutine} = {};\n const funcName = 'getOutputCoords';\n switch (outShape.length) {\n case 0:\n result[funcName] = this.getOutputScalarCoords();\n break;\n case 1:\n result[funcName] = this.getOutputPacked1DCoords(outShape as [number], outTexShape as [number, number]);\n break;\n case 2:\n result[funcName] = this.getOutputPacked2DCoords(outShape as [number, number], outTexShape as [number, number]);\n break;\n case 3:\n result[funcName] =\n this.getOutputPacked3DCoords(outShape as [number, number, number], outTexShape as [number, number]);\n break;\n default:\n result[funcName] = this.getOutputPackedNDCoords(outShape, outTexShape as [number, number]);\n }\n const glsl = getGlsl(this.context.glContext.version);\n // TODO we need this to properly return a packed vec4 from kernels.\n // Replace all '{glsl.output} = result' with 'setOutput(result)' in all kernels.\n const floatTextureSetRGBASource = `\n void setOutput(vec4 val) {\n ${glsl.output} = val;\n }\n `;\n const floatTextureSetRGBAFuncName = 'floatTextureSetRGBA';\n result[floatTextureSetRGBAFuncName] = new GlslLibRoutine(floatTextureSetRGBASource);\n return result;\n }\n\n /**\n * Generates code for unpacked output sampler.\n */\n protected getUnpackedOutputSamplingSnippet(outputLayout: TextureLayout): {[name: string]: GlslLibRoutine} {\n const outShape = outputLayout.unpackedShape;\n const outTexShape = [outputLayout.width, outputLayout.height];\n const result: {[name: string]: GlslLibRoutine} = {};\n const funcName = 'getOutputCoords';\n switch (outShape.length) {\n case 0:\n result[funcName] = this.getOutputScalarCoords();\n break;\n case 1:\n result[funcName] = this.getOutputUnpacked1DCoords(outShape as [number], outTexShape as [number, number]);\n break;\n case 2:\n result[funcName] =\n this.getOutputUnpacked2DCoords(outShape as [number, number], outTexShape as [number, number]);\n break;\n case 3:\n result[funcName] =\n this.getOutputUnpacked3DCoords(outShape as [number, number, number], outTexShape as [number, number]);\n break;\n case 4:\n result[funcName] = this.getOutputUnpacked4DCoords(\n outShape as [number, number, number, number], outTexShape as [number, number]);\n break;\n case 5:\n result[funcName] = this.getOutputUnpacked5DCoords(\n outShape as [number, number, number, number, number], outTexShape as [number, number]);\n break;\n case 6:\n result[funcName] = this.getOutputUnpacked6DCoords(\n outShape as [number, number, number, number, number, number], outTexShape as [number, number]);\n break;\n default:\n throw new Error(`Unsupported output dimensionality: ${outShape.length}`);\n }\n const glsl = getGlsl(this.context.glContext.version);\n // TODO we need this to properly return a packed vec4 from kernels.\n // Replace all '{glsl.output} = result' with 'setOutput(result)' in all kernels.\n const floatTextureSetRSource = `\n void setOutput(float val) {\n ${glsl.output} = vec4(val, 0, 0, 0);\n }\n `;\n const floatTextureSetRFuncName = 'floatTextureSetR';\n result[floatTextureSetRFuncName] = new GlslLibRoutine(floatTextureSetRSource);\n return result;\n }\n\n /**\n * Scalar output coordinates.\n */\n protected getOutputScalarCoords(): GlslLibRoutine {\n return new GlslLibRoutine(`\n int getOutputCoords() {\n return 0;\n }\n `);\n }\n\n /**\n * 1D packed output coordinates.\n */\n protected getOutputPacked1DCoords(_shape: [number], texShape: [number, number]): GlslLibRoutine {\n const packedTexShape = texShape;\n let source = '';\n if (packedTexShape[0] === 1) {\n source = `\n int getOutputCoords() {\n return 2 * int(TexCoords.y * ${packedTexShape[1]}.0);\n }\n `;\n return new GlslLibRoutine(source);\n }\n\n if (packedTexShape[1] === 1) {\n source = `\n int getOutputCoords() {\n return 2 * int(TexCoords.x * ${packedTexShape[0]}.0);\n }\n `;\n return new GlslLibRoutine(source);\n }\n\n source = `\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(TexCoords.xy *\n vec2(${packedTexShape[0]}, ${packedTexShape[1]}));\n return 2 * (resTexRC.y * ${packedTexShape[0]} + resTexRC.x);\n }\n `;\n return new GlslLibRoutine(source);\n }\n\n /**\n * 2D packed output coordinates.\n */\n protected getOutputPacked2DCoords(shape: [number, number], texShape: [number, number]): GlslLibRoutine {\n let source = '';\n if (ArrayUtil.arraysEqual(shape, texShape)) {\n source = `\n ivec2 getOutputCoords() {\n return 2 * ivec2(TexCoords.xy * vec2(${texShape[0]}, ${texShape[1]}));\n }\n `;\n return new GlslLibRoutine(source);\n }\n\n const packedTexShape = texShape;\n // texels needed to accommodate a logical row\n const texelsInLogicalRow = Math.ceil(shape[1] / 2);\n\n /**\n * getOutputCoords\n *\n * resTexRC: The rows and columns of the texels. If you move over one\n * texel to the right in the packed texture, you are moving over one column\n * (not two).\n *\n * index: The texel index\n */\n source = `\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(TexCoords.xy *\n vec2(${packedTexShape[0]}, ${packedTexShape[1]}));\n\n int index = resTexRC.y * ${packedTexShape[0]} + resTexRC.x;\n\n // reverse r and c order for packed texture\n int r = imod(index, ${texelsInLogicalRow}) * 2;\n int c = 2 * (index / ${texelsInLogicalRow});\n\n return ivec2(r, c);\n }\n `;\n return new GlslLibRoutine(source);\n }\n\n /**\n * 3D packed output coordinates.\n */\n protected getOutputPacked3DCoords(shape: [number, number, number], texShape: [number, number]): GlslLibRoutine {\n const packedTexShape = [texShape[0], texShape[1]];\n const texelsInLogicalRow = Math.ceil(shape[2] / 2);\n const texelsInBatch = texelsInLogicalRow * Math.ceil(shape[1] / 2);\n const source = `\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(TexCoords.xy *\n vec2(${packedTexShape[0]}, ${packedTexShape[1]}));\n int index = resTexRC.y * ${packedTexShape[0]} + resTexRC.x;\n\n int b = index / ${texelsInBatch};\n index -= b * ${texelsInBatch};\n\n // reverse r and c order for packed texture\n int r = imod(index, ${texelsInLogicalRow}) * 2;\n int c = 2 * (index / ${texelsInLogicalRow});\n\n return ivec3(b, r, c);\n }\n `;\n return new GlslLibRoutine(source);\n }\n\n /**\n * ND packed output coordinates.\n */\n protected getOutputPackedNDCoords(shape: readonly number[], texShape: [number, number]): GlslLibRoutine {\n const packedTexShape = [texShape[0], texShape[1]];\n\n const texelsInLogicalRow = Math.ceil(shape[shape.length - 1] / 2);\n const texelsInBatch = texelsInLogicalRow * Math.ceil(shape[shape.length - 2] / 2);\n let texelsInBatchN = texelsInBatch;\n let batches = '';\n let coords = 'b, r, c';\n\n for (let b = 2; b < shape.length - 1; b++) {\n texelsInBatchN *= shape[shape.length - b - 1];\n batches = `\n int b${b} = index / ${texelsInBatchN};\n index -= b${b} * ${texelsInBatchN};\n ` + batches;\n coords = `b${b}, ` + coords;\n }\n const source = `\n ivec${shape.length} getOutputCoords() {\n ivec2 resTexRC = ivec2(TexCoords.xy *\n vec2(${packedTexShape[0]}, ${packedTexShape[1]}));\n int index = resTexRC.y * ${packedTexShape[0]} + resTexRC.x;\n\n ${batches}\n\n int b = index / ${texelsInBatch};\n index -= b * ${texelsInBatch};\n\n // reverse r and c order for packed texture\n int r = imod(index, ${texelsInLogicalRow}) * 2;\n int c = 2 * (index / ${texelsInLogicalRow});\n\n return ivec${shape.length}(${coords});\n }\n `;\n return new GlslLibRoutine(source);\n }\n\n /**\n * Unpacked 1D output coordinates.\n */\n protected getOutputUnpacked1DCoords(_shape: [number], texShape: [number, number]): GlslLibRoutine {\n const source = `\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(TexCoords.xy *\n vec2(${texShape[0]}, ${texShape[1]}));\n return resTexRC.y * ${texShape[0]} + resTexRC.x;\n }\n `;\n return new GlslLibRoutine(source);\n }\n\n /**\n * Unpacked 2D output coordinates.\n */\n protected getOutputUnpacked2DCoords(shape: [number, number], texShape: [number, number]): GlslLibRoutine {\n const source = `\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(TexCoords.xy *\n vec2(${texShape[0]}, ${texShape[1]}));\n int index = resTexRC.y * ${texShape[0]} + resTexRC.x;\n int r = index / ${shape[1]};\n int c = index - r * ${shape[1]};\n return ivec2(r, c);\n }\n `;\n return new GlslLibRoutine(source);\n }\n\n /**\n * Unpacked 3D output coordinates.\n */\n protected getOutputUnpacked3DCoords(shape: [number, number, number], texShape: [number, number]): GlslLibRoutine {\n let source = '';\n const rank = shape.length;\n\n let strides = null;\n if (rank < 2) {\n strides = [];\n }\n\n strides = new Array(rank - 1);\n strides[rank - 2] = shape[rank - 1];\n for (let i = rank - 3; i >= 0; --i) {\n strides[i] = strides[i + 1] * shape[i + 1];\n }\n const coordsToCompute = ['r', 'c', 'd'];\n const coordsFromIndexSnippet =\n strides\n .map((stride, i) => {\n const line1 = `int ${coordsToCompute[i]} = index / ${stride}`;\n const line2 = i === strides.length - 1 ?\n `int ${coordsToCompute[i + 1]} = index - ${coordsToCompute[i]} * ${stride}` :\n `index -= ${coordsToCompute[i]} * ${stride}`;\n return `${line1}; ${line2};`;\n })\n .join('');\n\n source = `\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(TexCoords.xy *\n vec2(${texShape[0]}, ${texShape[1]}));\n int index = resTexRC.y * ${texShape[0]} + resTexRC.x;\n ${coordsFromIndexSnippet}\n return ivec3(r, c, d);\n }\n `;\n return new GlslLibRoutine(source);\n }\n\n /**\n * Unpacked 4D output coordinates.\n */\n protected getOutputUnpacked4DCoords(shape: [number, number, number, number], texShape: [number, number]):\n GlslLibRoutine {\n let source = '';\n const rank = shape.length;\n\n let strides = null;\n if (rank < 2) {\n strides = [];\n }\n\n strides = new Array(rank - 1);\n strides[rank - 2] = shape[rank - 1];\n for (let i = rank - 3; i >= 0; --i) {\n strides[i] = strides[i + 1] * shape[i + 1];\n }\n const coordsToCompute = ['r', 'c', 'd', 'd2'];\n const coordsFromIndexSnippet =\n strides\n .map((stride, i) => {\n const line1 = `int ${coordsToCompute[i]} = index / ${stride}`;\n const line2 = i === strides.length - 1 ?\n `int ${coordsToCompute[i + 1]} = index - ${coordsToCompute[i]} * ${stride}` :\n `index -= ${coordsToCompute[i]} * ${stride}`;\n return `${line1}; ${line2};`;\n })\n .join('');\n\n source = `\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(TexCoords.xy *\n vec2(${texShape[0]}, ${texShape[1]}));\n int index = resTexRC.y * ${texShape[0]} + resTexRC.x;\n ${coordsFromIndexSnippet}\n return ivec4(r, c, d, d2);\n }\n `;\n return new GlslLibRoutine(source);\n }\n\n /**\n * Unpacked 5D output coordinates.\n */\n protected getOutputUnpacked5DCoords(shape: [number, number, number, number, number], texShape: [number, number]):\n GlslLibRoutine {\n let source = '';\n const rank = shape.length;\n\n let strides = null;\n if (rank < 2) {\n strides = [];\n }\n\n strides = new Array(rank - 1);\n strides[rank - 2] = shape[rank - 1];\n for (let i = rank - 3; i >= 0; --i) {\n strides[i] = strides[i + 1] * shape[i + 1];\n }\n const coordsToCompute = ['r', 'c', 'd', 'd2', 'd3'];\n const coordsFromIndexSnippet =\n strides\n .map((stride, i) => {\n const line1 = `int ${coordsToCompute[i]} = index / ${stride}`;\n const line2 = i === strides.length - 1 ?\n `int ${coordsToCompute[i + 1]} = index - ${coordsToCompute[i]} * ${stride}` :\n `index -= ${coordsToCompute[i]} * ${stride}`;\n return `${line1}; ${line2};`;\n })\n .join('');\n\n source = `\n ivec5 getOutputCoords() {\n ivec2 resTexRC = ivec2(TexCoords.xy *\n vec2(${texShape[0]}, ${texShape[1]}));\n int index = resTexRC.y * ${texShape[0]} + resTexRC.x;\n ${coordsFromIndexSnippet}\n return ivec5(r, c, d, d2, d3);\n }\n `;\n return new GlslLibRoutine(source);\n }\n\n /**\n * Unpacked 6D output coordinates.\n */\n protected getOutputUnpacked6DCoords(shape: [number, number, number, number, number, number], texShape: [\n number, number\n ]): GlslLibRoutine {\n let source = '';\n const rank = shape.length;\n\n let strides = null;\n if (rank < 2) {\n strides = [];\n }\n\n strides = new Array(rank - 1);\n strides[rank - 2] = shape[rank - 1];\n for (let i = rank - 3; i >= 0; --i) {\n strides[i] = strides[i + 1] * shape[i + 1];\n }\n const coordsToCompute = ['r', 'c', 'd', 'd2', 'd3', 'd4'];\n const coordsFromIndexSnippet =\n strides\n .map((stride, i) => {\n const line1 = `int ${coordsToCompute[i]} = index / ${stride}`;\n const line2 = i === strides.length - 1 ?\n `int ${coordsToCompute[i + 1]} = index - ${coordsToCompute[i]} * ${stride}` :\n `index -= ${coordsToCompute[i]} * ${stride}`;\n return `${line1}; ${line2};`;\n })\n .join('');\n\n source = `\n ivec6 getOutputCoords() {\n ivec2 resTexRC = ivec2(TexCoords.xy *\n vec2(${texShape[0]}, ${texShape[1]}));\n int index = resTexRC.y * ${texShape[0]} + resTexRC.x;\n ${coordsFromIndexSnippet}\n return ivec6(r, c, d, d2, d3, d4);\n }\n `;\n return new GlslLibRoutine(source);\n }\n\n /**\n * Generates code for common UV coords computation utility functions.\n */\n protected getCommonUtilFuncs(): {[name: string]: GlslLibRoutine} {\n const result: {[name: string]: GlslLibRoutine} = {};\n let funcName = 'uvFromFlat';\n result[funcName] = new GlslLibRoutine(`\n vec2 uvFromFlat(int texNumR, int texNumC, int index) {\n int texC = index / texNumR;\n int texR = index - texC * texNumR;\n // TODO: swap texR, texC order in following function so row is corresponding to u and column is corresponding to\n // v.\n return (vec2(texR, texC) + halfCR) / vec2(texNumR, texNumC);\n }\n `);\n funcName = 'packedUVfrom1D';\n result[funcName] = new GlslLibRoutine(`\n vec2 packedUVfrom1D(int texNumR, int texNumC, int index) {\n int texelIndex = index / 2;\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n }\n `);\n funcName = 'packedUVfrom2D';\n result[funcName] = new GlslLibRoutine(`\n vec2 packedUVfrom2D(int texNumR, int texNumC, int texelsInLogicalRow, int row, int col) {\n int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n }\n `);\n funcName = 'packedUVfrom3D';\n result[funcName] = new GlslLibRoutine(`\n vec2 packedUVfrom3D(int texNumR, int texNumC,\n int texelsInBatch, int texelsInLogicalRow, int b,\n int row, int col) {\n int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n }\n `);\n funcName = 'sampleTexture';\n const glsl = getGlsl(this.context.glContext.version);\n result[funcName] = new GlslLibRoutine(`\n float sampleTexture(sampler2D textureSampler, vec2 uv) {\n return ${glsl.texture2D}(textureSampler, uv).r;\n }`);\n return result;\n }\n\n /**\n * Constructing snippets for inputs\n */\n protected getInputsSamplingSnippets(): {[name: string]: GlslLibRoutine} {\n const result: {[name: string]: GlslLibRoutine} = {};\n const outputLayout = this.context.outputTextureLayout;\n this.context.programInfo.inputNames.forEach((samplerName, i) => {\n const inputLayout = this.context.inputTextureLayouts[i];\n const funcName = generateShaderFuncNameFromInputSamplerName(samplerName);\n if (inputLayout.isPacked) {\n result[funcName] = this.getPackedSamplerFromInput(funcName, samplerName, inputLayout);\n } else {\n result[funcName] = this.getUnpackedSamplerFromInput(funcName, samplerName, inputLayout);\n }\n\n const outCoordFuncName = generateShaderFuncNameFromInputSamplerNameAtOutCoords(samplerName);\n if (inputLayout.unpackedShape.length <= outputLayout.unpackedShape.length) {\n if (inputLayout.isPacked) {\n result[outCoordFuncName] =\n this.getPackedSamplerAtOutputCoords(outCoordFuncName, inputLayout, outputLayout, samplerName);\n } else {\n result[outCoordFuncName] =\n this.getUnpackedSamplerAtOutputCoords(outCoordFuncName, inputLayout, outputLayout, samplerName);\n }\n }\n });\n\n return result;\n }\n\n /**\n * Constructing snippets for output coordinates of samplers\n */\n protected getPackedSamplerAtOutputCoords(\n funcName: string, inputLayout: TextureLayout, outputLayout: TextureLayout, name: string): GlslLibRoutine {\n const inShape = inputLayout.unpackedShape;\n const outShape = outputLayout.unpackedShape;\n const texName = name;\n const texFuncSnippet = generateShaderFuncNameFromInputSamplerName(texName);\n\n const inRank = inShape.length;\n const outRank = outShape.length;\n\n const broadcastDims = BroadcastUtil.getBroadcastDims(inShape, outShape);\n\n const type = getCoordsDataType(outRank);\n const rankDiff = outRank - inRank;\n let coordsSnippet: string;\n const fields = getGlChannels();\n\n if (inRank === 0) {\n coordsSnippet = '';\n } else if (outRank < 2 && broadcastDims.length >= 1) {\n coordsSnippet = 'coords = 0;';\n } else {\n coordsSnippet = broadcastDims.map(d => `coords.${fields[d + rankDiff]} = 0;`).join('\\n');\n }\n let unpackedCoordsSnippet = '';\n if (outRank < 2 && inRank > 0) {\n unpackedCoordsSnippet = 'coords';\n } else {\n unpackedCoordsSnippet = inShape.map((_s, i) => `coords.${fields[i + rankDiff]}`).join(', ');\n }\n\n let output = 'return outputValue;';\n const inSize = ShapeUtil.size(inShape);\n const isInputScalar = inSize === 1;\n const outSize = ShapeUtil.size(outShape);\n const isOutputScalar = outSize === 1;\n\n if (inRank === 1 && !isInputScalar && !isOutputScalar) {\n output = `\n return vec4(outputValue.xy, outputValue.xy);\n `;\n } else if (isInputScalar && !isOutputScalar) {\n if (outRank === 1) {\n output = `\n return vec4(outputValue.x, outputValue.x, 0., 0.);\n `;\n } else {\n output = `\n return vec4(outputValue.x);\n `;\n }\n } else if (broadcastDims.length) {\n const rows = inRank - 2;\n const cols = inRank - 1;\n\n if (broadcastDims.indexOf(rows) > -1 && broadcastDims.indexOf(cols) > -1) {\n output = 'return vec4(outputValue.x);';\n } else if (broadcastDims.indexOf(rows) > -1) {\n output = 'return vec4(outputValue.x, outputValue.y, ' +\n 'outputValue.x, outputValue.y);';\n } else if (broadcastDims.indexOf(cols) > -1) {\n output = 'return vec4(outputValue.xx, outputValue.zz);';\n }\n }\n\n const swapLastDimsSnippet = `\n int lastDim = coords.${fields[outRank - 1]};\n coords.${fields[outRank - 1]} = coords.${fields[outRank - 2]};\n coords.${fields[outRank - 2]} = lastDim;\n `;\n const source = `\n vec4 ${funcName}() {\n ${type} coords = getOutputCoords();\n ${swapLastDimsSnippet}\n ${coordsSnippet}\n vec4 outputValue = ${texFuncSnippet}(${unpackedCoordsSnippet});\n ${output}\n }\n `;\n return new GlslLibRoutine(source, ['coordinates.getOutputCoords']);\n }\n\n /**\n * Constructing snippets for unpacked output coordinates of samplers\n */\n protected getUnpackedSamplerAtOutputCoords(\n funcName: string, inputLayout: TextureLayout, outputLayout: TextureLayout, name: string): GlslLibRoutine {\n const outTexShape = [outputLayout.width, outputLayout.height];\n const inTexShape = [inputLayout.width, inputLayout.height];\n const inRank = inputLayout.unpackedShape.length;\n const outRank = outputLayout.unpackedShape.length;\n const inShape = inputLayout.unpackedShape;\n const outShape = outputLayout.unpackedShape;\n const texFuncSnippet = generateShaderFuncNameFromInputSamplerName(name);\n\n if (inRank === outRank && ArrayUtil.arraysEqual(inTexShape, outTexShape)) {\n const source = `\n float ${funcName}() {\n return sampleTexture(${name}, TexCoords);\n }\n `;\n return new GlslLibRoutine(source, ['coordinates.sampleTexture']);\n }\n\n const type = getCoordsDataType(outRank);\n const broadcastDims = BroadcastUtil.getBroadcastDims(inShape, outShape);\n const rankDiff = outRank - inRank;\n let coordsSnippet: string;\n const fields = getGlChannels();\n\n if (inRank === 0) {\n coordsSnippet = '';\n } else if (outRank < 2 && broadcastDims.length >= 1) {\n coordsSnippet = 'coords = 0;';\n } else {\n coordsSnippet = broadcastDims.map(d => `coords.${fields[d + rankDiff]} = 0;`).join('\\n');\n }\n let unpackedCoordsSnippet = '';\n if (outRank < 2 && inRank > 0) {\n unpackedCoordsSnippet = 'coords';\n } else {\n unpackedCoordsSnippet = inputLayout.unpackedShape.map((_s, i) => `coords.${fields[i + rankDiff]}`).join(', ');\n }\n const source = `\n float ${funcName}() {\n ${type} coords = getOutputCoords();\n ${coordsSnippet}\n return ${texFuncSnippet}(${unpackedCoordsSnippet});\n }\n `;\n return new GlslLibRoutine(source, ['coordinates.getOutputCoords']);\n }\n\n /**\n * Constructing snippets for packed operations.\n */\n protected getPackedSamplerFromInput(funcName: string, name: string, inputLayout: TextureLayout): GlslLibRoutine {\n switch (inputLayout.unpackedShape.length) {\n case 0:\n return this.getPackedSamplerScalar(funcName, name);\n case 1:\n return this.getPackedSampler1D(funcName, name, inputLayout);\n case 2:\n return this.getPackedSampler2D(funcName, name, inputLayout);\n case 3:\n return this.getPackedSampler3D(funcName, name, inputLayout);\n default:\n return this.getPackedSamplerND(funcName, name, inputLayout);\n }\n }\n\n /**\n * Constructing snippets for unpacked operations.\n */\n protected getUnpackedSamplerFromInput(funcName: string, name: string, inputLayout: TextureLayout): GlslLibRoutine {\n const shape = inputLayout.unpackedShape;\n switch (shape.length) {\n case 0:\n return this.getUnpackedSamplerScalar(funcName, name, inputLayout);\n case 1:\n return this.getUnpackedSampler1D(funcName, name, inputLayout);\n case 2:\n return this.getUnpackedSampler2D(funcName, name, inputLayout);\n case 3:\n return this.getUnpackedSampler3D(funcName, name, inputLayout);\n case 4:\n return this.getUnpackedSampler4D(funcName, name, inputLayout);\n case 5:\n return this.getUnpackedSampler5D(funcName, name, inputLayout);\n case 6:\n return this.getUnpackedSampler6D(funcName, name, inputLayout);\n default:\n // TODO support more dimensionalities\n throw new Error(`Unsupported dimension ${shape.length}-D`);\n }\n }\n\n /**\n * Packed scalar snippet.\n */\n protected getPackedSamplerScalar(funcName: string, name: string): GlslLibRoutine {\n const glsl = getGlsl(this.context.glContext.version);\n const source = `\n vec4 ${funcName}() {\n return ${glsl.texture2D}(${name}, halfCR);\n }\n `;\n return new GlslLibRoutine(source);\n }\n\n /**\n * Packed 1D snippet.\n */\n protected getPackedSampler1D(funcName: string, name: string, inputLayout: TextureLayout): GlslLibRoutine {\n const texShape = [inputLayout.width, inputLayout.height];\n const packedTexShape = [texShape[1], texShape[0]];\n const glsl = getGlsl(this.context.glContext.version);\n\n const packedSampler = `vec4 ${funcName}(int index) {\n vec2 uv = packedUVfrom1D(\n ${packedTexShape[0]}, ${packedTexShape[1]}, index);\n return ${glsl.texture2D}(${name}, uv);\n }`;\n const source = packedSampler;\n return new GlslLibRoutine(source, ['coordinates.packedUVfrom1D']);\n }\n\n /**\n * Packed 2D snippet.\n */\n protected getPackedSampler2D(funcName: string, name: string, inputLayout: TextureLayout): GlslLibRoutine {\n const shape = inputLayout.unpackedShape;\n const texShape = [inputLayout.width, inputLayout.height];\n const glsl = getGlsl(this.context.glContext.version);\n const texNumR = texShape[0];\n const texNumC = texShape[1];\n\n if (texShape != null && ArrayUtil.arraysEqual(shape, texShape)) {\n const packedSampler = `vec4 ${funcName}(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2(${texNumC}.0, ${texNumR}.0);\n return ${glsl.texture2D}(${name}, uv);\n }`;\n\n return new GlslLibRoutine(packedSampler);\n }\n const packedTexShape = texShape;\n const valuesPerRow = Math.ceil(shape[1] / 2);\n const packedSampler = `vec4 ${funcName}(int row, int col) {\n vec2 uv = packedUVfrom2D(${packedTexShape[1]}, ${packedTexShape[0]}, ${valuesPerRow}, row, col);\n return ${glsl.texture2D}(${name}, uv);\n }`;\n const source = packedSampler;\n return new GlslLibRoutine(source, ['coordinates.packedUVfrom2D']);\n }\n\n /**\n * Packed 3D snippet.\n */\n protected getPackedSampler3D(funcName: string, name: string, inputLayout: TextureLayout): GlslLibRoutine {\n const shape = inputLayout.unpackedShape;\n const texShape = [inputLayout.width, inputLayout.height];\n const packedTexShape = [texShape[0], texShape[1]];\n const glsl = getGlsl(this.context.glContext.version);\n\n if (shape[0] === 1) {\n const squeezedShape = shape.slice(1);\n const keptDims = [1, 2];\n const newInputShape = squeezeInputShape(shape, squeezedShape);\n const params = ['b', 'row', 'col'];\n // Deep copy of input texture layout.\n const newInputLayout: TextureLayout = JSON.parse(JSON.stringify(inputLayout));\n newInputLayout.unpackedShape = newInputShape;\n const samplerRoutine = this.getPackedSamplerFromInput(funcName, name, newInputLayout);\n const packedSampler = `${samplerRoutine.routineBody}\n vec4 ${funcName}(int b, int row, int col) {\n return ${funcName}(${getSqueezedParams(params, keptDims)});\n } `;\n const source = packedSampler;\n return new GlslLibRoutine(source, samplerRoutine.dependencies);\n }\n const texNumR = packedTexShape[0];\n const texNumC = packedTexShape[1];\n\n const valuesPerRow = Math.ceil(shape[2] / 2);\n const texelsInBatch = valuesPerRow * Math.ceil(shape[1] / 2);\n\n const packedSampler = `vec4 ${funcName}(int b, int row, int col) {\n vec2 uv = packedUVfrom3D(\n ${texNumC}, ${texNumR}, ${texelsInBatch}, ${valuesPerRow}, b, row, col);\n return ${glsl.texture2D}(${name}, uv);}`;\n const source = packedSampler;\n return new GlslLibRoutine(source, ['coordinates.packedUVfrom3D']);\n }\n /*\n * Packed ND snippet.\n */\n protected getPackedSamplerND(funcName: string, name: string, inputLayout: TextureLayout): GlslLibRoutine {\n const shape = inputLayout.unpackedShape;\n const rank = shape.length;\n const texShape = [inputLayout.width, inputLayout.height];\n const glsl = getGlsl(this.context.glContext.version);\n\n const packedTexShape = [texShape[0], texShape[1]];\n const texNumR = packedTexShape[1];\n const texNumC = packedTexShape[0];\n const valuesPerRow = Math.ceil(shape[rank - 1] / 2);\n let texelsInBatch = valuesPerRow * Math.ceil(shape[rank - 2] / 2);\n let params = 'int b, int row, int col';\n let index = `b * ${texelsInBatch} + (row / 2) * ${valuesPerRow} + (col / 2)`;\n for (let b = 2; b < rank - 1; b++) {\n params = `int b${b}, ` + params;\n texelsInBatch *= shape[rank - b - 1];\n index = `b${b} * ${texelsInBatch} + ` + index;\n }\n const packedSampler = `vec4 ${funcName}(${params}) {\n int index = ${index};\n int texR = index / ${texNumC};\n int texC = index - texR * ${texNumC};\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2(${texNumC}, ${texNumR});\n return ${glsl.texture2D}(${name}, uv);\n }`;\n const source = packedSampler;\n return new GlslLibRoutine(source);\n }\n\n /**\n * Unpacked scalar snippet.\n */\n protected getUnpackedSamplerScalar(funcName: string, name: string, inputLayout: TextureLayout): GlslLibRoutine {\n const [texNumR, texNumC] = [inputLayout.width, inputLayout.height];\n if (texNumR === 1 && texNumC === 1) {\n const source = `\n float ${funcName}() {\n return sampleTexture(${name}, halfCR);\n }\n `;\n return new GlslLibRoutine(source, ['coordinates.sampleTexture']);\n }\n\n const source = `\n float ${funcName}() {\n int offset_${name} = coordsToOffset(TexCoords, ${texNumR}, ${texNumC});\n vec2 uv = uvFromFlat(${texNumR}, ${texNumC}, offset_${name});\n return sampleTexture(${name}, uv);\n }\n `;\n return new GlslLibRoutine(\n source, ['coordinates.uvFromFlat', 'coordinates.sampleTexture', 'coordinates.coordsToOffset']);\n }\n\n /**\n * Unpacked 1D snippet.\n */\n protected getUnpackedSampler1D(funcName: string, name: string, inputLayout: TextureLayout): GlslLibRoutine {\n const tNumR = inputLayout.width;\n const tNumC = inputLayout.height;\n\n if (tNumC === 1 && tNumR === 1) {\n const source = `\n float ${funcName}(int index) {\n return sampleTexture(${name}, halfCR);\n }\n `;\n return new GlslLibRoutine(source, ['coordinates.sampleTexture']);\n }\n\n if (tNumC === 1) {\n const source = `\n float ${funcName}(int index) {\n vec2 uv = vec2((float(index) + 0.5) / ${tNumR}.0, 0.5);\n return sampleTexture(${name}, uv);\n }\n `;\n return new GlslLibRoutine(source, ['coordinates.sampleTexture']);\n }\n if (tNumR === 1) {\n const source = `\n float ${funcName}(int index) {\n vec2 uv = vec2(0.5, (float(index) + 0.5) / ${tNumC}.0);\n return sampleTexture(${name}, uv);\n }\n `;\n return new GlslLibRoutine(source, ['coordinates.sampleTexture']);\n }\n const source = `\n float ${funcName}(int index) {\n vec2 uv = uvFromFlat(${tNumR}, ${tNumC}, index);\n return sampleTexture(${name}, uv);\n }\n `;\n return new GlslLibRoutine(source, ['coordinates.uvFromFlat', 'coordinates.sampleTexture']);\n }\n\n /**\n * Unpacked 2D snippet.\n */\n\n protected getUnpackedSampler2D(funcName: string, name: string, inputLayout: TextureLayout): GlslLibRoutine {\n const shape = inputLayout.unpackedShape;\n\n // TODO: modify row/col order for other dimensions.\n const texShape = [inputLayout.height, inputLayout.width];\n\n if (texShape != null && ArrayUtil.arraysEqual(shape, texShape)) {\n const texNumR = texShape[1];\n const texNumC = texShape[0];\n const source = `\n float ${funcName}(int row, int col) {\n vec2 uv = (vec2(row, col) + halfCR) / vec2(${texNumR}.0, ${texNumC}.0);\n return sampleTexture(${name}, uv);\n }\n `;\n return new GlslLibRoutine(source, ['coordinates.sampleTexture']);\n }\n\n const {newShape, keptDims} = squeezeShape(shape as number[]);\n const squeezedShape = newShape;\n if (squeezedShape.length < shape.length) {\n const newInputShape = squeezeInputShape(shape, squeezedShape);\n // Deep copy of input texture layout.\n const newInputLayout: TextureLayout = JSON.parse(JSON.stringify(inputLayout));\n newInputLayout.unpackedShape = newInputShape;\n\n const params = ['col', 'row'];\n const source = `\n ${this.getUnpackedSamplerFromInput(funcName, name, newInputLayout).routineBody}\n float ${funcName}(int row, int col) {\n return ${funcName}(${getSqueezedParams(params, keptDims)});\n }\n `;\n return new GlslLibRoutine(source, ['coordinates.sampleTexture']);\n }\n\n const texNumR = texShape[1];\n const texNumC = texShape[0];\n if (texNumC === 1) {\n const source = `\n float ${funcName}(int row, int col) {\n int offset_${name} = coordsToOffset(TexCoords, ${texNumR}, ${texNumC});\n float index = dot(vec3(row, col, offset_${name}), vec3(${shape[1]}, 1, 1));\n vec2 uv = vec2(0.5, (index + 0.5) / ${texNumR}.0);\n return sampleTexture(${name}, uv);\n }\n `;\n return new GlslLibRoutine(source, ['coordinates.sampleTexture', 'coordinates.coordsToOffset']);\n }\n\n if (texNumR === 1) {\n const source = `\n float ${funcName}(int row, int col) {\n int offset_${name} = coordsToOffset(TexCoords, ${texNumR}, ${texNumC});\n float index = dot(vec3(row, col, offset_${name}), vec3(${shape[1]}, 1, 1));\n vec2 uv = vec2((index + 0.5) / ${texNumC}.0, 0.5);\n return sampleTexture(${name}, uv);\n }\n `;\n return new GlslLibRoutine(source, ['coordinates.sampleTexture', 'coordinates.coordsToOffset']);\n }\n\n const source = `\n float ${funcName}(int row, int col) {\n int index = col * ${shape[1]} + row;\n vec2 uv = uvFromFlat(${texNumR}, ${texNumC}, index);\n return sampleTexture(${name}, uv);\n }\n `;\n return new GlslLibRoutine(\n source, ['coordinates.uvFromFlat', 'coordinates.sampleTexture', 'coordinates.coordsToOffset']);\n }\n\n /**\n * Unpacked 3D snippet.\n */\n\n protected getUnpackedSampler3D(funcName: string, name: string, inputLayout: TextureLayout): GlslLibRoutine {\n const shape = inputLayout.unpackedShape;\n const stride0 = shape[1] * shape[2];\n const stride1 = shape[2];\n\n const {newShape, keptDims} = squeezeShape(shape as number[]);\n const squeezedShape = newShape;\n if (squeezedShape.length < shape.length) {\n const newInputShape = squeezeInputShape(shape, squeezedShape);\n const params = ['batch', 'col', 'row'];\n // Deep copy of input texture layout.\n const newInputLayout: TextureLayout = JSON.parse(JSON.stringify(inputLayout));\n newInputLayout.unpackedShape = newInputShape;\n const routine = this.getUnpackedSamplerFromInput(funcName, name, newInputLayout);\n // TODO: revisit the logic here to make it simpler\n const revDims = keptDims.reverse();\n const source = `\n ${routine.routineBody}\n float ${funcName}(int batch, int row, int col) {\n return ${funcName}(${getSqueezedParams(params, revDims)});\n }\n `;\n return new GlslLibRoutine(source, routine.dependencies);\n }\n\n const texNumR = inputLayout.width;\n const texNumC = inputLayout.height;\n const source = `\n float ${funcName}(int depth, int row, int col) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = depth * ${stride0} + col * ${stride1} + row;\n vec2 uv = uvFromFlat(${texNumR}, ${texNumC}, index);\n return sampleTexture(${name}, uv);\n }\n `;\n return new GlslLibRoutine(\n source, ['coordinates.uvFromFlat', 'coordinates.sampleTexture', 'coordinates.coordsToOffset']);\n }\n\n /**\n * Unpacked 4D snippet.\n */\n\n protected getUnpackedSampler4D(funcName: string, name: string, inputLayout: TextureLayout): GlslLibRoutine {\n const shape = inputLayout.unpackedShape;\n const stride2 = shape[3];\n const stride1 = shape[2] * stride2;\n const stride0 = shape[1] * stride1;\n\n //\n // TODO: re-enable this shortcut once the index calculation bug is fixed.\n //\n // const {newShape, keptDims} = squeezeShape(shape as number[]);\n // if (newShape.length < shape.length) {\n // const newInputShape = squeezeInputShape(shape, newShape);\n // const params = ['row', 'col', 'depth', 'depth2'];\n // // Deep copy of input texture layout.\n // const newInputLayout: TextureLayout = JSON.parse(JSON.stringify(inputLayout));\n // newInputLayout.unpackedShape = newInputShape;\n // const source = `\n // ${this.getUnpackedSamplerFromInput(funcName, name, newInputLayout).routineBody}\n // float ${funcName}(int row, int col, int depth, int depth2) {\n // return ${funcName}(${getSqueezedParams(params, keptDims)});\n // }\n // `;\n // return new GlslLibRoutine(\n // source, ['coordinates.uvFromFlat', 'coordinates.sampleTexture', 'coordinates.coordsToOffset']);\n // }\n\n const texNumR = inputLayout.width;\n const texNumC = inputLayout.height;\n const source = `\n float ${funcName}(int row, int col, int depth, int depth2) {\n int index = row * ${stride0} + col * ${stride1} +\n depth2 * ${stride2} + depth;\n vec2 uv = uvFromFlat(${texNumR}, ${texNumC}, index);\n return sampleTexture(${name}, uv);\n }\n `;\n return new GlslLibRoutine(source, ['coordinates.uvFromFlat', 'coordinates.sampleTexture']);\n }\n\n /**\n * Unpacked 5D snippet.\n */\n protected getUnpackedSampler5D(funcName: string, name: string, inputLayout: TextureLayout): GlslLibRoutine {\n const shape = inputLayout.unpackedShape;\n const stride3 = shape[4];\n const stride2 = shape[3] * stride3;\n const stride1 = shape[2] * stride2;\n const stride0 = shape[1] * stride1;\n\n const {newShape, keptDims} = squeezeShape(shape as number[]);\n if (newShape.length < shape.length) {\n const newInputShape = squeezeInputShape(shape, newShape);\n const params = ['row', 'col', 'depth', 'depth2', 'depth3'];\n // Deep copy of input texture layout.\n const newInputLayout: TextureLayout = JSON.parse(JSON.stringify(inputLayout));\n newInputLayout.unpackedShape = newInputShape;\n\n const source = `\n ${this.getUnpackedSamplerFromInput(funcName, name, newInputLayout).routineBody}\n float ${funcName}(int row, int col, int depth, int depth2, int depth3) {\n return ${funcName}(${getSqueezedParams(params, keptDims)});\n }\n `;\n return new GlslLibRoutine(source, ['coordinates.sampleTexture', 'coordinates.uvFromFlat']);\n }\n\n const texNumR = inputLayout.width;\n const texNumC = inputLayout.height;\n const source = `\n float ${funcName}(int row, int col, int depth, int depth2, int depth3) {\n int index = row * ${stride0} + col * ${stride1} + depth * ${stride2} +\n depth3 * ${stride3} + depth2;\n vec2 uv = uvFromFlat(${texNumR}, ${texNumC}, index);\n return sampleTexture(${name}, uv);\n }\n `;\n return new GlslLibRoutine(source, ['coordinates.sampleTexture', 'coordinates.uvFromFlat']);\n }\n\n /**\n * Unpacked 6D snippet.\n */\n protected getUnpackedSampler6D(funcName: string, name: string, inputLayout: TextureLayout): GlslLibRoutine {\n const shape = inputLayout.unpackedShape;\n const stride4 = shape[5];\n const stride3 = shape[4] * stride4;\n const stride2 = shape[3] * stride3;\n const stride1 = shape[2] * stride2;\n const stride0 = shape[1] * stride1;\n\n const {newShape, keptDims} = squeezeShape(shape as number[]);\n if (newShape.length < shape.length) {\n const newInputShape = squeezeInputShape(shape, newShape);\n const params = ['row', 'col', 'depth', 'depth2', 'depth3', 'depth4'];\n // Deep copy of input texture layout.\n const newInputLayout: TextureLayout = JSON.parse(JSON.stringify(inputLayout));\n newInputLayout.unpackedShape = newInputShape;\n\n const source = `\n ${this.getUnpackedSamplerFromInput(funcName, name, newInputLayout).routineBody}\n float ${funcName}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n return ${funcName}(${getSqueezedParams(params, keptDims)});\n }\n `;\n return new GlslLibRoutine(source, ['coordinates.sampleTexture', 'coordinates.uvFromFlat']);\n }\n\n const texNumR = inputLayout.width;\n const texNumC = inputLayout.height;\n const source = `\n float ${funcName}(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n int index = row * ${stride0} + col * ${stride1} + depth * ${stride2} +\n depth2 * ${stride3} + depth3 * ${stride4} + depth4;\n vec2 uv = uvFromFlat(${texNumR}, ${texNumC}, index);\n return sampleTexture(${name}, uv);\n }\n `;\n return new GlslLibRoutine(\n source, ['coordinates.uvFromFlat', 'coordinates.sampleTexture', 'coordinates.coordsToOffset']);\n }\n\n /**\n * This is the main function to map from the given texture coordinates (s,t)\n * to logical indices for the output\n * There will only be one single variation of this\n * Also see coordsToOffset and offsetToIndices for input-specific versions\n */\n protected toVec(): {[name: string]: GlslLibRoutine} {\n const output = this.context.outputTextureLayout;\n const rank = output.shape.length;\n const strides = output.strides;\n const xScale = output.width;\n const yScale = output.height;\n\n const stridesBlock = [];\n for (let i = 0; i < rank - 1; ++i) {\n stridesBlock.push(`\n c[${i}] = offset / ${strides[i]};`);\n stridesBlock.push(`\n offset -= c[${i}] * ${strides[i]};`);\n }\n stridesBlock.push(`\n c[${rank - 1}] = offset;`);\n const body = `\n void toVec(vec2 texCoords, out int c[${rank}]) {\n int offset = coordsToOffset(texCoords, ${xScale}, ${yScale});\n ${stridesBlock.join('')}\n }\n void toVec(int offset, out int c[${rank}]) {\n ${stridesBlock.join('')}\n }\n `;\n return {toVec: new GlslLibRoutine(body, ['coordinates.coordsToOffset'])};\n }\n /**\n * These are value getter functions generated for each input\n * Each function is hardwired to the name and dimensions of the input\n * An '_T' variation is also produced which accesses values as if the\n * input was transposed\n */\n protected valueFrom(): {[name: string]: GlslLibRoutine} {\n const result: {[name: string]: GlslLibRoutine} = {};\n this.context.programInfo.inputNames.forEach((name, i) => {\n const layout = this.context.inputTextureLayouts[i];\n const shape = layout.unpackedShape.length > 0 ? layout.unpackedShape : layout.shape;\n const rank = shape.length;\n let funcName = `_${name}`;\n result[funcName] = new GlslLibRoutine(\n this.getValueFromSingle(name, rank, layout.width, layout.height, false),\n [`shapeUtils.indicesToOffset${funcName}`, 'coordinates.offsetToCoords', 'fragcolor.getColorAsFloat']);\n funcName = funcName + '_T';\n result[funcName] = new GlslLibRoutine(\n this.getValueFromSingle(name, rank, layout.width, layout.height, true),\n [`shapeUtils.indicesToOffset${funcName}`, 'coordinates.offsetToCoords', 'fragcolor.getColorAsFloat']);\n });\n return result;\n }\n /**\n * Produces one value getter function for the name and rank given\n * If a transpose is set proper offsetToCoords mapping will be used\n * @param name name of the function\n * @param rank rank of the input\n * @param transpose whether or not should generate a transpose variation\n */\n protected getValueFromSingle(varName: string, rank: number, width: number, height: number, transpose: boolean):\n string {\n let name = `_${varName}`;\n if (transpose) {\n name = name + '_T';\n }\n const glsl = getGlsl(this.context.glContext.version);\n return `\n float ${name}(int m[${rank}]) {\n int offset = indicesToOffset${name}(m);\n vec2 coords = offsetToCoords(offset, ${width}, ${height});\n float value = getColorAsFloat(${glsl.texture2D}(${varName}, coords));\n return value;\n }\n `;\n }\n\n /**\n * Produces a packed value getter function for the name and rank given\n * If a transpose is set proper offsetToCoords mapping will be used\n * @param name name of the function\n * @param rank rank of the input\n * @param transpose whether or not should generate a transpose variation\n */\n protected getPackedValueFrom(varName: string, rank: number, width: number, height: number, transpose: boolean):\n string {\n let name = `_${varName}_Pack`;\n if (transpose) {\n name = name + '_T';\n }\n const glsl = getGlsl(this.context.glContext.version);\n return `\n vec4 ${name}(int m[${rank}]) {\n int offset = indicesToOffset_${varName}(m);\n vec2 coords = offsetToCoords(offset, ${width}, ${height});\n return ${glsl.texture2D}(${varName}, coords);\n }\n `;\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {GlslContext, GlslLib, GlslLibRoutine} from './glsl-definitions';\n\n/**\n * This GLSL library handles routines converting\n * float32 to/from Unsigned byte or float 16\n */\nexport class EncodingGlslLib extends GlslLib {\n constructor(context: GlslContext) {\n super(context);\n }\n getFunctions(): {[name: string]: GlslLibRoutine} {\n return {...this.encodeFloat32(), ...this.decodeFloat32()};\n }\n getCustomTypes(): {[name: string]: string} {\n return {};\n }\n protected encodeFloat32(): {[name: string]: GlslLibRoutine} {\n return {\n encode: new GlslLibRoutine(`highp vec4 encode(highp float f) {\n return vec4(f, 0.0, 0.0, 0.0);\n }\n `)\n };\n }\n protected decodeFloat32(): {[name: string]: GlslLibRoutine} {\n return {\n decode: new GlslLibRoutine(`highp float decode(highp vec4 rgba) {\n return rgba.r;\n }\n `)\n };\n }\n /**\n * returns the routine to encode encode a 32bit float to a vec4 (of unsigned bytes)\n * @credit: https://stackoverflow.com/questions/7059962/how-do-i-convert-a-vec4-rgba-value-to-a-float\n */\n protected encodeUint8(): {[name: string]: GlslLibRoutine} {\n const endianness = EncodingGlslLib.isLittleEndian() ? 'rgba.rgba=rgba.abgr;' : '';\n return {\n encode: new GlslLibRoutine(`\n highp vec4 encode(highp float f) {\n highp float F = abs(f);\n highp float Sign = step(0.0,-f);\n highp float Exponent = floor(log2(F));\n highp float Mantissa = (exp2(- Exponent) * F);\n Exponent = floor(log2(F) + 127.0) + floor(log2(Mantissa));\n highp vec4 rgba;\n rgba[0] = 128.0 * Sign + floor(Exponent*exp2(-1.0));\n rgba[1] = 128.0 * mod(Exponent,2.0) + mod(floor(Mantissa*128.0),128.0);\n rgba[2] = floor(mod(floor(Mantissa*exp2(23.0 -8.0)),exp2(8.0)));\n rgba[3] = floor(exp2(23.0)*mod(Mantissa,exp2(-15.0)));\n ${endianness}\n rgba = rgba / 255.0; // values need to be normalized to [0,1]\n return rgba;\n }\n `)\n };\n }\n /**\n * returns the routine to encode a vec4 of unsigned bytes to float32\n * @credit: https://stackoverflow.com/questions/7059962/how-do-i-convert-a-vec4-rgba-value-to-a-float\n */\n protected decodeUint8(): {[name: string]: GlslLibRoutine} {\n const endianness = EncodingGlslLib.isLittleEndian() ? 'rgba.rgba=rgba.abgr;' : '';\n return {\n decode: new GlslLibRoutine(`\n highp float decode(highp vec4 rgba) {\n rgba = rgba * 255.0; // values need to be de-normalized from [0,1] to [0,255]\n ${endianness}\n highp float Sign = 1.0 - step(128.0,rgba[0])*2.0;\n highp float Exponent = 2.0 * mod(rgba[0],128.0) + step(128.0,rgba[1]) - 127.0;\n highp float Mantissa = mod(rgba[1],128.0)*65536.0 + rgba[2]*256.0 +rgba[3] + float(0x800000);\n highp float Result = Sign * exp2(Exponent) * (Mantissa * exp2(-23.0 ));\n return Result;\n }\n `)\n };\n }\n /**\n * Determines if the machine is little endian or not\n * @credit: https://gist.github.com/TooTallNate/4750953\n */\n static isLittleEndian(): boolean {\n const b = new ArrayBuffer(4);\n const a = new Uint32Array(b);\n const c = new Uint8Array(b);\n a[0] = 0xdeadbeef;\n if (c[0] === 0xef) {\n return true;\n }\n if (c[0] === 0xde) {\n return false;\n }\n throw new Error('unknown endianness');\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {GlslContext, GlslLib, GlslLibRoutine} from './glsl-definitions';\nimport {getGlsl} from './glsl-source';\n\n/**\n * This GLSL library handles routines around reading a texlet and writing to it\n * Reading and writing could be more than just dealing with one channel\n * It may require encoding/decoding to/from 4 channels into one\n */\nexport class FragColorGlslLib extends GlslLib {\n constructor(context: GlslContext) {\n super(context);\n }\n getFunctions(): {[name: string]: GlslLibRoutine} {\n return {...this.setFragColor(), ...this.getColorAsFloat()};\n }\n getCustomTypes(): {[name: string]: string} {\n return {};\n }\n protected setFragColor(): {[name: string]: GlslLibRoutine} {\n const glsl = getGlsl(this.context.glContext.version);\n return {\n setFragColor: new GlslLibRoutine(\n `\n void setFragColor(float value) {\n ${glsl.output} = encode(value);\n }\n `,\n ['encoding.encode'])\n };\n }\n protected getColorAsFloat(): {[name: string]: GlslLibRoutine} {\n return {\n getColorAsFloat: new GlslLibRoutine(\n `\n float getColorAsFloat(vec4 color) {\n return decode(color);\n }\n `,\n ['encoding.decode'])\n };\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {GlslContext, GlslLib, GlslLibRoutine} from './glsl-definitions';\n\n/**\n * GLSL Library responsible for data types and routines for manipulating\n * coordinates and mapping to/from tensor indices\n */\nexport class ShapeUtilsGlslLib extends GlslLib {\n constructor(context: GlslContext) {\n super(context);\n }\n getFunctions(): {[name: string]: GlslLibRoutine} {\n return {\n ...this.bcastIndex(),\n ...this.bcastMatmulIndex(),\n ...this.offsetToIndices(),\n ...this.indicesToOffset(),\n ...this.incrementIndices()\n };\n }\n getCustomTypes() {\n return {};\n }\n protected bcastIndex(): {[name: string]: GlslLibRoutine} {\n const outputRank = this.context.outputTextureLayout.shape.length;\n const result: {[name: string]: GlslLibRoutine} = {};\n this.context.programInfo.inputNames.forEach((name, i) => {\n const shape = this.context.inputTextureLayouts[i].unpackedShape;\n if (shape.length <= outputRank) {\n const rank = shape.length;\n const dimOffset = outputRank - rank;\n const funcName = `bcastIndices_${name}`;\n let block = '';\n for (let i = 0; i < rank; ++i) {\n block += `\n realIndices[${i}] = int( mod(float(bcastedIndices[${dimOffset + i}]), ${shape[i]}.0) );\n `;\n }\n const body = `\n void ${funcName} (int bcastedIndices[${outputRank}], out int realIndices[${rank}]) {\n ${block}\n }\n `;\n result[funcName] = new GlslLibRoutine(body);\n }\n });\n return result;\n }\n protected bcastMatmulIndex(): {[name: string]: GlslLibRoutine} {\n const outputRank = this.context.outputTextureLayout.shape.length;\n const result: {[name: string]: GlslLibRoutine} = {};\n this.context.programInfo.inputNames.forEach((name, i) => {\n const shape = this.context.inputTextureLayouts[i].shape;\n if (!(shape.length < 2 || shape.length > outputRank)) {\n const rank = shape.length;\n const dimOffset = outputRank - rank;\n const funcName = `bcastMatmulIndices_${name}`;\n let block = '';\n for (let i = 0; i < rank - 2; ++i) {\n block += `\n realIndices[${i}] = int( mod(float(bcastedIndices[${dimOffset + i}]), ${shape[i]}.0) );\n `;\n }\n const body = `\n void ${funcName}(int bcastedIndices[${outputRank}], out int realIndices[${rank}]) {\n ${block}\n realIndices[${rank - 1}] = bcastedIndices[${outputRank - 1}];\n realIndices[${rank - 2}] = bcastedIndices[${outputRank - 2}];\n }\n `;\n result[funcName] = new GlslLibRoutine(body);\n }\n });\n return result;\n }\n protected indicesToOffset(): {[name: string]: GlslLibRoutine} {\n const result: {[name: string]: GlslLibRoutine} = {};\n this.context.programInfo.inputNames.forEach((name, i) => {\n const shape = this.context.inputTextureLayouts[i].shape;\n const strides = this.context.inputTextureLayouts[i].strides;\n const rank = shape.length;\n let funcName = `indicesToOffset_${name}`;\n result[funcName] = new GlslLibRoutine(ShapeUtilsGlslLib.indexToOffsetSingle(funcName, rank, strides));\n funcName = `indicesToOffset_${name}_T`;\n result[funcName] =\n new GlslLibRoutine(ShapeUtilsGlslLib.indexToOffsetSingle(funcName, rank, strides.slice().reverse()));\n });\n return result;\n }\n static indexToOffsetSingle(name: string, rank: number, strides: readonly number[]): string {\n let block = '';\n for (let i = rank - 1; i >= 0; --i) {\n block += `\n offset += indices[${i}] * ${strides[i]};\n `;\n }\n return `\n int ${name}(int indices[${rank}]) {\n int offset = 0;\n ${block}\n return offset;\n }\n `;\n }\n protected offsetToIndices(): {[name: string]: GlslLibRoutine} {\n const result: {[name: string]: GlslLibRoutine} = {};\n this.context.programInfo.inputNames.forEach((name, i) => {\n const shape = this.context.inputTextureLayouts[i].shape;\n const strides = this.context.inputTextureLayouts[i].strides;\n const rank = shape.length;\n let funcName = `offsetToIndices_${name}`;\n result[funcName] = new GlslLibRoutine(ShapeUtilsGlslLib.offsetToIndicesSingle(funcName, rank, strides));\n funcName = `offsetToIndices_${name}_T`;\n result[funcName] =\n new GlslLibRoutine(ShapeUtilsGlslLib.offsetToIndicesSingle(funcName, rank, strides.slice().reverse()));\n });\n return result;\n }\n static offsetToIndicesSingle(name: string, rank: number, strides: readonly number[]): string {\n const stridesBlock = [];\n for (let i = 0; i < rank - 1; ++i) {\n stridesBlock.push(`\n indices[${i}] = offset / ${strides[i]};`);\n stridesBlock.push(`\n offset -= indices[${i}] * ${strides[i]};`);\n }\n stridesBlock.push(`\n indices[${rank - 1}] = offset;`);\n return `\n void ${name}(int offset, out int indices[${rank}]) {\n ${stridesBlock.join('')}\n }\n `;\n }\n protected incrementIndices(): {[name: string]: GlslLibRoutine} {\n const result: {[name: string]: GlslLibRoutine} = {};\n this.context.programInfo.inputNames.forEach((name, i) => {\n const shape = this.context.inputTextureLayouts[i].shape;\n const rank = shape.length;\n const funcName = `incrementIndices_${name}`;\n let shapeInit = '';\n for (let i = 0; i < rank; ++i) {\n shapeInit += `\n shape[${i}] = ${shape[i]};`;\n }\n const body = `\n void ${funcName}(int axis, out int indices[${rank}]) {\n int shape[${rank}];\n ${shapeInit};\n for(int i = ${rank} -1 ; i >= 0; --i) {\n if(i > axis) continue;\n indices[i] += 1;\n if(indices[i] < shape[i]) {\n break;\n }\n indices[i] = 0;\n }\n }\n `;\n result[funcName] = new GlslLibRoutine(body);\n });\n return result;\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {GlslContext, GlslLib, GlslLibRoutine} from './glsl-definitions';\n\n/**\n * GLSL Library responsible for vec routines\n * Vec is an varible length int array. The length is fixed at the time of\n * generating the library functions from the dimensions of the output.\n */\nexport class VecGlslLib extends GlslLib {\n constructor(context: GlslContext) {\n super(context);\n }\n getCustomTypes(): {[name: string]: string} {\n return {};\n }\n getFunctions(): {[name: string]: GlslLibRoutine} {\n return {...this.binaryVecFunctions(), ...this.copyVec(), ...this.setVecItem(), ...this.getVecItem()};\n }\n protected binaryVecFunctions(): {[name: string]: GlslLibRoutine} {\n const outputLayout = this.context.outputTextureLayout;\n const rank = outputLayout.shape.length;\n const nameOp: {[name: string]: string} = {add: '+=', sub: '-=', mul: '*=', div: '/='};\n const result: {[name: string]: GlslLibRoutine} = {};\n for (const name in nameOp) {\n const fname = `${name}Vec`;\n let assignmentBlock = '';\n for (let i = 0; i < rank; ++i) {\n assignmentBlock += `\n dest[${i}] ${nameOp[name]} src[${i}];\n `;\n }\n const body = `\n void ${fname}(int src[${rank}], out int dest[${rank}]) {\n ${assignmentBlock}\n }\n `;\n result[fname] = new GlslLibRoutine(body);\n }\n\n return result;\n }\n protected copyVec(): {[name: string]: GlslLibRoutine} {\n const outputLayout = this.context.outputTextureLayout;\n const rank = outputLayout.shape.length;\n let assignmentBlock = '';\n for (let i = 0; i < rank; ++i) {\n assignmentBlock += `\n dest[${i}] = src[${i}];\n `;\n }\n const body = `\n void copyVec(int src[${rank}], out int dest[${rank}]) {\n ${assignmentBlock}\n }\n `;\n return {copyVec: new GlslLibRoutine(body)};\n }\n\n protected setVecItem(): {[name: string]: GlslLibRoutine} {\n const outputLayout = this.context.outputTextureLayout;\n const rank = outputLayout.shape.length;\n let block = `\n if(index < 0)\n index =${rank} + index;\n if (index == 0)\n m[0] = value;\n `;\n for (let i = 1; i < rank - 1; ++i) {\n block += `\n else if (index == ${i})\n m[${i}] = value;\n `;\n }\n block += `\n else\n m[${rank - 1}] = value;\n `;\n const body = `\n void setVecItem(out int m[${rank}], int index, int value) {\n ${block}\n }\n `;\n return {setVecItem: new GlslLibRoutine(body)};\n }\n protected getVecItem(): {[name: string]: GlslLibRoutine} {\n const outputLayout = this.context.outputTextureLayout;\n const rank = outputLayout.shape.length;\n let block = `\n if(index < 0)\n index = ${rank} + index;\n if (index == 0)\n return m[0];\n `;\n for (let i = 1; i < rank - 1; ++i) {\n block += `\n else if (index == ${i})\n return m[${i}];\n `;\n }\n block += `\n else\n return m[${rank - 1}];\n `;\n const body = `\n int getVecItem(int m[${rank}], int index) {\n ${block}\n }\n `;\n return {getVecItem: new GlslLibRoutine(body)};\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {CoordsGlslLib} from './glsl-coordinate-lib';\nimport {GlslContext, GlslLib} from './glsl-definitions';\nimport {EncodingGlslLib} from './glsl-encoding-lib';\nimport {FragColorGlslLib} from './glsl-fragcolor-lib';\nimport {ShapeUtilsGlslLib} from './glsl-shape-utils-lib';\nimport {VecGlslLib} from './glsl-vec-lib';\n\nexport const glslRegistry: {[name: string]: new (context: GlslContext) => GlslLib} = {\n 'encoding': EncodingGlslLib,\n 'fragcolor': FragColorGlslLib,\n 'vec': VecGlslLib,\n 'shapeUtils': ShapeUtilsGlslLib,\n 'coordinates': CoordsGlslLib,\n // 'arrays': ArrayGlslSLib\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {GlslContext, GlslLib, GlslLibRoutineNode, TopologicalSortGlslRoutines} from './glsl-definitions';\nimport {replaceInlines} from './glsl-function-inliner';\nimport {glslRegistry} from './glsl-registered-libs';\nimport {getDefaultFragShaderMain, getFragShaderPreamble} from './glsl-source';\nimport {ProgramInfo, TextureLayout, VariableInfo} from './types';\nimport {WebGLContext} from './webgl-context';\n\n/**\n * Preprocessor for the additions to the GLSL language\n * It deals with:\n * @include directives\n * @inline\n * Loop unrolling (not implemented)\n * Macro resolution (not implemented)\n */\nexport class GlslPreprocessor {\n readonly context: GlslContext;\n readonly libs: {[name: string]: GlslLib} = {};\n readonly glslLibRoutineDependencyGraph: {[routineName: string]: GlslLibRoutineNode} = {};\n\n constructor(\n glContext: WebGLContext, programInfo: ProgramInfo, inputTextureLayouts: TextureLayout[],\n outputTextureLayout: TextureLayout) {\n this.context = new GlslContext(glContext, programInfo, inputTextureLayouts, outputTextureLayout);\n\n // construct GlslLibs\n Object.keys(glslRegistry).forEach((name: string) => {\n const lib = new glslRegistry[name](this.context);\n this.libs[name] = lib;\n });\n\n // construct GlslRoutineDependencyGraph\n const map = this.glslLibRoutineDependencyGraph;\n for (const libName in this.libs) {\n const lib = this.libs[libName];\n const routinesInLib = lib.getFunctions();\n for (const routine in routinesInLib) {\n const key = libName + '.' + routine;\n let currentNode: GlslLibRoutineNode;\n if (map[key]) {\n currentNode = map[key];\n currentNode.routineBody = routinesInLib[routine].routineBody;\n } else {\n currentNode = new GlslLibRoutineNode(key, routinesInLib[routine].routineBody);\n map[key] = currentNode;\n }\n const dependencies = routinesInLib[routine].dependencies;\n if (dependencies) {\n for (let i = 0; i < dependencies.length; ++i) {\n if (!map[dependencies[i]]) {\n const node = new GlslLibRoutineNode(dependencies[i]);\n map[dependencies[i]] = node;\n currentNode.addDependency(node);\n } else {\n currentNode.addDependency(map[dependencies[i]]);\n }\n }\n }\n }\n }\n }\n\n preprocess(): string {\n const programInfo = this.context.programInfo;\n let source = programInfo.shaderSource;\n\n // append main() function\n if (!this.context.programInfo.hasMain) {\n source = `${source}\n ${getDefaultFragShaderMain(this.context.glContext.version, this.context.outputTextureLayout.shape.length)}`;\n }\n // replace inlines\n source = replaceInlines(source);\n\n // concat final source string\n return `${getFragShaderPreamble(this.context.glContext.version)}\n ${this.getUniforms(programInfo.inputNames, programInfo.variables)}\n ${this.getImports(source)}\n ${source}`;\n }\n\n protected getImports(script: string): string {\n const routinesIncluded = this.selectGlslLibRoutinesToBeIncluded(script);\n\n if (routinesIncluded.length === 0) {\n return '';\n }\n\n let routines = '';\n for (let i = 0; i < routinesIncluded.length; ++i) {\n if (routinesIncluded[i].routineBody) {\n routines += routinesIncluded[i].routineBody + '\\n';\n } else {\n throw new Error(`Missing body for the Glsl Library routine: ${routinesIncluded[i].name}`);\n }\n }\n\n return routines;\n }\n private selectGlslLibRoutinesToBeIncluded(script: string): GlslLibRoutineNode[] {\n const nodes: GlslLibRoutineNode[] = [];\n\n Object.keys(this.glslLibRoutineDependencyGraph).forEach(classAndRoutine => {\n const routine = classAndRoutine.split('.')[1];\n if (script.indexOf(routine) !== -1) {\n nodes.push(this.glslLibRoutineDependencyGraph[classAndRoutine]);\n }\n });\n\n return TopologicalSortGlslRoutines.returnOrderedNodes(nodes);\n }\n\n protected getUniforms(samplers?: string[], variables?: VariableInfo[]): string {\n const uniformLines: string[] = [];\n if (samplers) {\n for (const sampler of samplers) {\n uniformLines.push(`uniform sampler2D ${sampler};`);\n }\n }\n if (variables) {\n for (const variable of variables) {\n uniformLines.push(\n `uniform ${variable.type} ${variable.name}${variable.arrayLength ? `[${variable.arrayLength}]` : ''};`);\n }\n }\n return uniformLines.join('\\n');\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {env} from 'onnxruntime-common';\n\nimport {Logger, Profiler} from '../../instrument';\n\nimport {GlslPreprocessor} from './glsl-preprocessor';\nimport {getVertexShaderSource} from './glsl-source';\nimport {TextureLayoutStrategy} from './texture-layout-strategy';\nimport {Artifact, ProgramInfo, ProgramVariable, TextureData, TextureLayout, VariableInfo} from './types';\nimport {WebGLContext} from './webgl-context';\n\n/**\n * ProgramManager is the main class behind running computations\n * It builds ProgramInfo's into Artifacts\n * It compiles given ProgramInfo's into WebGL Prorams (cached as Artifacts)\n * Uses the artifact to run the computation by calling Draw on\n * the WebGL drawing buffer\n * ProgramManager automatically maps (binds) input variables to their\n * corresponding Location's in the binary program\n */\nexport class ProgramManager {\n repo: Map; // this should be per-session object\n vertexShader: WebGLShader;\n attributesBound: boolean;\n\n constructor(\n public profiler: Readonly, public glContext: WebGLContext,\n public textureLayoutStrategy: TextureLayoutStrategy) {\n this.repo = new Map();\n this.attributesBound = false;\n }\n getArtifact(key: unknown): Artifact|undefined {\n return this.repo.get(key);\n }\n setArtifact(key: unknown, artifact: Artifact): void {\n this.repo.set(key, artifact);\n }\n run(buildArtifact: Artifact, inputs: TextureData[], output: TextureData): void {\n this.profiler.event('op', `ProgramManager.run ${buildArtifact.programInfo.name ?? 'unknown kernel'}`, () => {\n const gl = this.glContext.gl;\n const program = buildArtifact.program;\n gl.useProgram(program);\n try {\n this.bindOutput(output);\n if (!this.attributesBound) {\n this.bindAttributes(buildArtifact.attribLocations);\n }\n this.bindUniforms(buildArtifact.uniformLocations, buildArtifact.programInfo.variables ?? [], inputs);\n } catch (err) {\n Logger.error('ProgramManager', buildArtifact.programInfo.shaderSource);\n throw err;\n }\n this.profiler.event('backend', 'GlContext.draw()', () => {\n this.glContext.draw();\n });\n }, this.glContext);\n }\n dispose(): void {\n if (this.vertexShader) {\n this.glContext.deleteShader(this.vertexShader);\n }\n this.repo.forEach(a => this.glContext.deleteProgram(a.program));\n }\n build(programInfo: ProgramInfo, inputTextureLayouts: TextureLayout[], outputTextureLayout: TextureLayout): Artifact {\n return this.profiler.event('backend', 'ProgramManager.build', () => {\n const preprocessor = new GlslPreprocessor(this.glContext, programInfo, inputTextureLayouts, outputTextureLayout);\n const fragScript = preprocessor.preprocess();\n const program = this.compile(fragScript);\n const artifact = {\n programInfo,\n program,\n uniformLocations: this.getUniformLocations(\n program, preprocessor.context.programInfo.inputNames, preprocessor.context.programInfo.variables),\n attribLocations: this.getAttribLocations(program)\n };\n return artifact;\n });\n }\n protected compile(fragShaderScript: string): WebGLProgram {\n if (!this.vertexShader) {\n Logger.verbose('ProrgramManager', 'Compiling and caching Vertex shader for the first time');\n const vertexShaderScript = getVertexShaderSource(this.glContext.version);\n this.vertexShader = this.glContext.compileShader(vertexShaderScript, this.glContext.gl.VERTEX_SHADER);\n }\n if (env.debug) {\n Logger.verbose('ProrgramManager', `FragShader:\n${fragShaderScript}\n`);\n }\n const fragShader = this.glContext.compileShader(fragShaderScript, this.glContext.gl.FRAGMENT_SHADER);\n const program = this.glContext.createProgram(this.vertexShader, fragShader);\n this.glContext.deleteShader(fragShader);\n return program;\n }\n bindOutput(td: TextureData): void {\n const width = td.width;\n const height = td.height;\n Logger.verbose(\n 'ProrgramManager',\n `Binding output texture to Framebuffer: w/h=${width}/${height}, shape=${td.shape}, type=${td.tensor.type}`);\n this.glContext.attachFramebuffer(td.texture, width, height);\n }\n bindAttributes(attribLocations: Artifact.AttribLocations): void {\n const positionHandle = attribLocations.position;\n const textureCoordHandle = attribLocations.textureCoord;\n this.glContext.setVertexAttributes(positionHandle, textureCoordHandle);\n this.attributesBound = true;\n }\n bindUniforms(uniformLocations: Artifact.UniformLocations, variables: ProgramVariable[], textures: TextureData[]):\n void {\n const gl = this.glContext.gl;\n let texturePosition = 0;\n for (const {name, type, location, arrayLength} of uniformLocations) {\n const value = variables.find(v => v.name === name)?.data;\n if (type !== 'sampler2D' && !value) {\n throw new Error(`variable '${name}' does not have data defined in program info`);\n }\n switch (type) {\n case 'sampler2D':\n this.bindTexture(textures[texturePosition], location, texturePosition);\n texturePosition++;\n break;\n case 'float':\n if (arrayLength) {\n gl.uniform1fv(location, value as number[]);\n } else {\n gl.uniform1f(location, value as number);\n }\n break;\n case 'int':\n if (arrayLength) {\n gl.uniform1iv(location, value as number[]);\n } else {\n gl.uniform1i(location, value as number);\n }\n break;\n default:\n throw new Error(`Uniform not implemented: ${type}`);\n }\n }\n }\n bindTexture(td: TextureData, uniformHandle: WebGLUniformLocation, position: number): void {\n this.glContext.bindTextureToUniform(td.texture, position, uniformHandle);\n }\n getAttribLocations(program: WebGLProgram): Artifact.AttribLocations {\n return {\n position: this.getAttribLocation(program, 'position'),\n textureCoord: this.getAttribLocation(program, 'textureCoord')\n };\n }\n getUniformLocations(program: WebGLProgram, samplers?: string[], variables?: VariableInfo[]):\n Artifact.UniformLocations {\n const uniformLocations: Artifact.UniformLocations = [];\n if (samplers) {\n for (const sampler of samplers) {\n uniformLocations.push({name: sampler, type: 'sampler2D', location: this.getUniformLocation(program, sampler)});\n }\n }\n if (variables) {\n for (const variable of variables) {\n uniformLocations.push({...variable, location: this.getUniformLocation(program, variable.name)});\n }\n }\n return uniformLocations;\n }\n getUniformLocation(program: WebGLProgram, name: string): WebGLUniformLocation {\n const gl = this.glContext.gl;\n const reference = gl.getUniformLocation(program, name);\n if (reference === null) {\n throw new Error(`Uniform ${name} not found.`);\n }\n return reference;\n }\n getAttribLocation(program: WebGLProgram, name: string): number {\n const gl = this.glContext.gl;\n const attributeLocation: number = gl.getAttribLocation(program, name);\n return attributeLocation;\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Logger, Profiler} from '../../instrument';\nimport {Tensor} from '../../tensor';\n\nimport {Encoder, EncoderUsage} from './texture-data-encoder';\nimport {TextureLayoutStrategy} from './texture-layout-strategy';\nimport {TextureData, TextureLayout} from './types';\nimport {WebGLContext} from './webgl-context';\n\nexport interface TextureManagerConfig {\n reuseTextures?: boolean;\n}\n\n/**\n * TextureManager is the mainly responsible for caching Textures\n * Textures are cached in 2 levels:\n * 1. the texures which are associated with a dataId (from Tensor)\n * Caching these is crucial to performance. These are In-use Textures\n * 2. textures which are not in use by any current ProgramInfo/Tensor\n * These are called Free Textures\n * TextureManager is also used to help creating textures. For this it\n * uses WebGLContext and TextureLayoutStrategy\n */\nexport class TextureManager {\n private readonly inUseTextures: Map;\n private readonly idleTextures: Map;\n private readonly textureLookup: Map;\n private readonly pendingRead: Map void>> = new Map();\n\n constructor(\n public glContext: WebGLContext, public layoutStrategy: TextureLayoutStrategy, public profiler: Readonly,\n private config: TextureManagerConfig) {\n if (config.reuseTextures) {\n this.inUseTextures = new Map();\n this.idleTextures = new Map();\n this.textureLookup = new Map();\n }\n }\n createTextureFromLayout(\n dataType: Tensor.DataType, layout: TextureLayout, data?: Tensor.NumberType, usage?: EncoderUsage) {\n const textureDataType = this.toEncoderType(dataType);\n\n const encoder = this.glContext.getEncoder(textureDataType, layout.channels || 1, usage);\n if (layout.isPacked && usage === EncoderUsage.UploadOnly) {\n throw new Error('not implemented');\n }\n const width = layout.width;\n const height = layout.height;\n\n let key: string|undefined;\n let inUseTextures: WebGLTexture[]|undefined;\n if (this.config.reuseTextures) {\n key = `${width}x${height}_${encoder.format}_${encoder.internalFormat}_${encoder.textureType}`;\n inUseTextures = this.inUseTextures.get(key);\n if (!inUseTextures) {\n inUseTextures = [];\n this.inUseTextures.set(key, inUseTextures);\n }\n\n const idleTextures = this.idleTextures.get(key);\n if (idleTextures && idleTextures.length > 0) {\n const texture = idleTextures.pop()!;\n inUseTextures.push(texture);\n if (usage === EncoderUsage.UploadOnly) {\n this.glContext.updateTexture(texture, width, height, encoder, this.toTextureData(dataType, data)!);\n }\n return texture;\n }\n }\n\n Logger.verbose('TextureManager', `Creating new texture of size ${layout.width}x${layout.height}`);\n const texture = this.glContext.allocateTexture(width, height, encoder, this.toTextureData(dataType, data));\n\n if (this.config.reuseTextures) {\n inUseTextures!.push(texture);\n this.textureLookup.set(texture, key!);\n }\n return texture;\n }\n readTexture(td: TextureData, dataType: Tensor.DataType, channels?: number): Tensor.NumberType {\n if (!channels) {\n channels = 1;\n }\n return this.profiler.event('backend', 'TextureManager.readTexture', () => {\n const dataSize = td.shape.reduce((a, b) => a * b) * channels!;\n const data = this.glContext.readTexture(\n td.texture, td.width, td.height, dataSize, this.toEncoderType(dataType), channels!);\n return this.toTensorData(dataType, data);\n });\n }\n async readTextureAsync(td: TextureData, dataType: Tensor.DataType, channels?: number): Promise {\n const dataId = td.tensor.dataId;\n if (!channels) {\n channels = 1;\n }\n if (this.pendingRead.has(dataId)) {\n const subscribers = this.pendingRead.get(dataId);\n return new Promise(resolve => subscribers?.push(resolve));\n }\n return this.profiler.event('backend', 'TextureManager.readTextureAsync', async () => {\n this.pendingRead.set(dataId, []);\n const dataSize = td.shape.reduce((a, b) => a * b) * channels!;\n // add a fence waiting for the data to be ready\n await this.glContext.createAndWaitForFence();\n const data = this.glContext.readTexture(\n td.texture, td.width, td.height, dataSize, this.toEncoderType(dataType), channels!);\n const tensorData = this.toTensorData(dataType, data);\n const subscribers = this.pendingRead.get(dataId);\n this.pendingRead.delete(dataId);\n subscribers?.forEach(resolve => resolve(tensorData));\n return tensorData;\n });\n }\n readUint8TextureAsFloat(td: TextureData): Float32Array {\n return this.profiler.event('backend', 'TextureManager.readUint8TextureAsFloat', () => {\n const dataSize = td.shape.reduce((a, b) => a * b);\n const data = this.glContext.readTexture(td.texture, td.width, td.height, dataSize * 4, 'byte', 4);\n return new Float32Array(data.buffer, data.byteOffset, dataSize);\n });\n }\n releaseTexture(textureData: TextureData, deleteTexture?: boolean): void {\n let key: string|undefined;\n if (this.config.reuseTextures) {\n key = this.textureLookup.get(textureData.texture);\n if (key) {\n if (deleteTexture) {\n this.textureLookup.delete(key);\n }\n const inUseTextures = this.inUseTextures.get(key);\n if (inUseTextures) {\n const index = inUseTextures.indexOf(textureData.texture);\n if (index !== -1) {\n inUseTextures.splice(index, 1);\n let idleTextures = this.idleTextures.get(key);\n if (!idleTextures) {\n idleTextures = [];\n this.idleTextures.set(key, idleTextures);\n }\n idleTextures.push(textureData.texture);\n }\n }\n }\n }\n\n if (!key || deleteTexture) {\n Logger.verbose('TextureManager', `Deleting texture of size ${textureData.width}x${textureData.height}`);\n this.glContext.deleteTexture(textureData.texture);\n }\n }\n toTensorData(dataType: Tensor.DataType, data: Encoder.DataArrayType): Tensor.NumberType {\n switch (dataType) {\n case 'int16':\n return data instanceof Int16Array ? data : Int16Array.from(data);\n case 'int32':\n return data instanceof Int32Array ? data : Int32Array.from(data);\n case 'int8':\n return data instanceof Int8Array ? data : Int8Array.from(data);\n case 'uint16':\n return data instanceof Uint16Array ? data : Uint16Array.from(data);\n case 'uint32':\n return data instanceof Uint32Array ? data : Uint32Array.from(data);\n case 'uint8':\n case 'bool':\n return data instanceof Uint8Array ? data : Uint8Array.from(data);\n case 'float32':\n return data instanceof Float32Array ? data : Float32Array.from(data);\n case 'float64':\n return data instanceof Float64Array ? data : Float64Array.from(data);\n default:\n throw new Error(`TensorData type ${dataType} is not supported`);\n }\n }\n toTextureData(_dataType: Tensor.DataType, data: Tensor.NumberType|undefined): Encoder.DataArrayType|undefined {\n if (!data) {\n return undefined;\n }\n return (data instanceof Float32Array) ? data : new Float32Array(data);\n /*\n switch (dataType) {\n case 'int16':\n case 'int32':\n case 'uint16':\n case 'uint32':\n return (data.constructor === Uint32Array) ? data as Uint32Array : new Uint32Array(data);\n case 'int8':\n case 'uint8':\n case 'bool':\n return (data.constructor === Uint8Array) ? data as Uint8Array : new Uint8Array(data);\n case 'float32':\n case 'float64':\n return (data.constructor === Float32Array) ? data as Float32Array : new Float32Array(data);\n default:\n throw new Error(`TensorData type ${dataType} is not supported`);\n }\n */\n }\n toEncoderType(_dataType: Tensor.DataType): Encoder.DataType {\n return 'float';\n // switch (dataType) {\n // case 'int16':\n // case 'int32':\n // case 'uint16':\n // case 'uint32':\n // return 'int';\n // case 'uint8':\n // case 'bool':\n // return 'byte';\n // case 'float32':\n // case 'float64':\n // return 'float';\n // default:\n // throw new Error(`TensorData type ${dataType} is not supported`);\n // }\n }\n clearActiveTextures(): void {\n this.glContext.clearActiveTextures();\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {SessionHandler} from '../../backend';\nimport {Graph} from '../../graph';\nimport {Logger} from '../../instrument';\nimport {Operator} from '../../operators';\nimport {OpSet, resolveOperator} from '../../opset';\nimport {Session} from '../../session';\nimport {Tensor} from '../../tensor';\nimport {WebGLBackend} from '../backend-webgl';\n\nimport {WebGLInferenceHandler} from './inference-handler';\nimport {WEBGL_OP_RESOLVE_RULES} from './op-resolve-rules';\nimport {ProgramManager} from './program-manager';\nimport {PreferLogicalStrategy, TextureLayoutStrategy} from './texture-layout-strategy';\nimport {TextureManager} from './texture-manager';\nimport {TextureData} from './types';\n\nexport class WebGLSessionHandler implements SessionHandler {\n programManager: ProgramManager;\n textureManager: TextureManager;\n layoutStrategy: TextureLayoutStrategy;\n packedTextureDataCache: Map;\n unpackedTextureDataCache: Map;\n pack2unpackMap: Map;\n unpack2packMap: Map;\n initializers: Set;\n pack?: boolean;\n\n constructor(public readonly backend: WebGLBackend, public readonly context: Session.Context) {\n this.layoutStrategy = new PreferLogicalStrategy(backend.glContext.maxTextureSize);\n this.programManager = new ProgramManager(this.context.profiler, backend.glContext, this.layoutStrategy);\n this.textureManager = new TextureManager(\n backend.glContext, this.layoutStrategy, this.context.profiler,\n {reuseTextures: backend.textureCacheMode === 'full'});\n this.packedTextureDataCache = new Map();\n this.unpackedTextureDataCache = new Map();\n this.pack = backend.pack;\n this.pack2unpackMap = new Map();\n this.unpack2packMap = new Map();\n }\n\n createInferenceHandler() {\n return new WebGLInferenceHandler(this);\n }\n onGraphInitialized(graph: Graph): void {\n const initializers = graph.getValues().filter(v => v.from === -1 && v.tensor).map(v => v.tensor!.dataId);\n this.initializers = new Set(initializers);\n }\n isInitializer(tensorId: Tensor.Id): boolean {\n return this.initializers ? this.initializers.has(tensorId) : false;\n }\n addInitializer(tensorId: Tensor.Id): void {\n this.initializers.add(tensorId);\n }\n getTextureData(tensorId: Tensor.Id, isPacked: boolean): TextureData|undefined {\n if (isPacked) {\n return this.packedTextureDataCache.get(tensorId);\n } else {\n return this.unpackedTextureDataCache.get(tensorId);\n }\n }\n setTextureData(tensorId: Tensor.Id, textureData: TextureData, isPacked = false): void {\n Logger.verbose('WebGLSessionHandler', 'Storing Texture data in cache');\n if (isPacked) {\n this.packedTextureDataCache.set(tensorId, textureData);\n } else {\n this.unpackedTextureDataCache.set(tensorId, textureData);\n }\n }\n dispose(): void {\n this.programManager.dispose();\n this.textureManager.clearActiveTextures();\n this.packedTextureDataCache.forEach(td => this.textureManager.releaseTexture(td, true));\n this.packedTextureDataCache = new Map();\n this.unpackedTextureDataCache.forEach(td => this.textureManager.releaseTexture(td, true));\n this.unpackedTextureDataCache = new Map();\n }\n resolve(node: Graph.Node, opsets: readonly OpSet[], graph: Graph): Operator {\n const op = resolveOperator(node, opsets, WEBGL_OP_RESOLVE_RULES);\n return {impl: op.opImpl, context: op.opInit ? op.opInit(node, graph) : node};\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {env} from 'onnxruntime-common';\n\nimport * as DataEncoders from './texture-data-encoder';\nimport {DataEncoder, Encoder, EncoderUsage} from './texture-data-encoder';\nimport {repeatedTry} from './utils';\n\nexport interface FenceContext {\n query: WebGLSync|null;\n isFencePassed(): boolean;\n}\n\ntype PollItem = {\n isDoneFn: () => boolean; resolveFn: () => void;\n};\n\nexport function linearSearchLastTrue(arr: Array<() => boolean>): number {\n let i = 0;\n for (; i < arr.length; ++i) {\n const isDone = arr[i]();\n if (!isDone) {\n break;\n }\n }\n return i - 1;\n}\n\n/**\n * Abstraction and wrapper around WebGLRenderingContext and its operations\n */\nexport class WebGLContext {\n gl: WebGLRenderingContext;\n version: 1|2;\n\n private vertexbuffer: WebGLBuffer;\n private framebuffer: WebGLFramebuffer;\n\n // WebGL flags and vital parameters\n private isFloatTextureAttachableToFrameBuffer: boolean;\n isFloat32DownloadSupported: boolean;\n isRenderFloat32Supported: boolean;\n isBlendSupported: boolean;\n maxTextureSize: number;\n // private maxCombinedTextureImageUnits: number;\n private maxTextureImageUnits: number;\n // private maxCubeMapTextureSize: number;\n // private shadingLanguageVersion: string;\n // private webglVendor: string;\n // private webglVersion: string;\n\n // WebGL2 flags and vital parameters\n // private max3DTextureSize: number;\n // private maxArrayTextureLayers: number;\n // private maxColorAttachments: number;\n // private maxDrawBuffers: number;\n\n // WebGL extensions\n // eslint-disable-next-line camelcase\n textureFloatExtension: OES_texture_float|null;\n // eslint-disable-next-line camelcase\n textureHalfFloatExtension: OES_texture_half_float|null;\n\n // WebGL2 extensions\n colorBufferFloatExtension: unknown|null;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n disjointTimerQueryWebgl2Extension: {TIME_ELAPSED_EXT: GLenum; GPU_DISJOINT_EXT: GLenum}|null;\n\n private disposed: boolean;\n private frameBufferBound = false;\n\n constructor(gl: WebGLRenderingContext, version: 1|2) {\n this.gl = gl;\n this.version = version;\n\n this.getExtensions();\n this.vertexbuffer = this.createVertexbuffer();\n this.framebuffer = this.createFramebuffer();\n this.queryVitalParameters();\n }\n\n allocateTexture(width: number, height: number, encoder: DataEncoder, data?: Encoder.DataArrayType): WebGLTexture {\n const gl = this.gl;\n // create the texture\n const texture = gl.createTexture();\n // bind the texture so the following methods effect this texture.\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n const buffer = data ? encoder.encode(data, width * height) : null;\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0, // Level of detail.\n encoder.internalFormat, width, height,\n 0, // Always 0 in OpenGL ES.\n encoder.format, encoder.textureType, buffer);\n this.checkError();\n return texture as WebGLTexture;\n }\n updateTexture(\n texture: WebGLTexture, width: number, height: number, encoder: DataEncoder, data: Encoder.DataArrayType): void {\n const gl = this.gl;\n gl.bindTexture(gl.TEXTURE_2D, texture);\n const buffer = encoder.encode(data, width * height);\n gl.texSubImage2D(\n gl.TEXTURE_2D,\n 0, // level\n 0, // xoffset\n 0, // yoffset\n width, height, encoder.format, encoder.textureType, buffer);\n this.checkError();\n }\n attachFramebuffer(texture: WebGLTexture, width: number, height: number): void {\n const gl = this.gl;\n // Make it the target for framebuffer operations - including rendering.\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer);\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture,\n 0); // 0, we aren't using MIPMAPs\n this.checkError();\n gl.viewport(0, 0, width, height);\n gl.scissor(0, 0, width, height);\n }\n readTexture(\n texture: WebGLTexture, width: number, height: number, dataSize: number, dataType: Encoder.DataType,\n channels: number): Encoder.DataArrayType {\n const gl = this.gl;\n if (!channels) {\n channels = 1;\n }\n if (!this.frameBufferBound) {\n this.attachFramebuffer(texture, width, height);\n }\n const encoder = this.getEncoder(dataType, channels);\n const buffer = encoder.allocate(width * height);\n // bind texture to framebuffer\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.framebufferTexture2D(\n gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture,\n 0); // 0, we aren't using MIPMAPs\n // TODO: Check if framebuffer is ready\n gl.readPixels(0, 0, width, height, gl.RGBA, encoder.textureType, buffer);\n this.checkError();\n // unbind FB\n return encoder.decode(buffer, dataSize);\n }\n\n isFramebufferReady(): boolean {\n // TODO: Implement logic to check if the framebuffer is ready\n return true;\n }\n getActiveTexture(): string {\n const gl = this.gl;\n const n = gl.getParameter(this.gl.ACTIVE_TEXTURE);\n return `TEXTURE${(n - gl.TEXTURE0)}`;\n }\n getTextureBinding(): WebGLTexture {\n return this.gl.getParameter(this.gl.TEXTURE_BINDING_2D);\n }\n getFramebufferBinding(): WebGLFramebuffer {\n return this.gl.getParameter(this.gl.FRAMEBUFFER_BINDING);\n }\n setVertexAttributes(positionHandle: number, textureCoordHandle: number): void {\n const gl = this.gl;\n gl.vertexAttribPointer(positionHandle, 3, gl.FLOAT, false, 20, 0);\n gl.enableVertexAttribArray(positionHandle);\n if (textureCoordHandle !== -1) {\n gl.vertexAttribPointer(textureCoordHandle, 2, gl.FLOAT, false, 20, 12);\n gl.enableVertexAttribArray(textureCoordHandle);\n }\n this.checkError();\n }\n createProgram(\n vertexShader: WebGLShader,\n fragShader: WebGLShader,\n ): WebGLProgram {\n const gl = this.gl;\n const program = gl.createProgram()!;\n\n // the program consists of our shaders\n gl.attachShader(program, vertexShader);\n gl.attachShader(program, fragShader);\n gl.linkProgram(program);\n return program;\n }\n compileShader(shaderSource: string, shaderType: number): WebGLShader {\n const gl = this.gl;\n const shader = gl.createShader(shaderType);\n if (!shader) {\n throw new Error(`createShader() returned null with type ${shaderType}`);\n }\n\n gl.shaderSource(shader, shaderSource);\n gl.compileShader(shader);\n if (gl.getShaderParameter(shader, gl.COMPILE_STATUS) === false) {\n throw new Error(`Failed to compile shader: ${gl.getShaderInfoLog(shader)}\nShader source:\n${shaderSource}`);\n }\n return shader;\n }\n deleteShader(shader: WebGLShader): void {\n this.gl.deleteShader(shader);\n }\n bindTextureToUniform(texture: WebGLTexture, position: number, uniformHandle: WebGLUniformLocation): void {\n const gl = this.gl;\n gl.activeTexture(gl.TEXTURE0 + position);\n this.checkError();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n this.checkError();\n gl.uniform1i(uniformHandle, position);\n this.checkError();\n }\n draw(): void {\n this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4);\n this.checkError();\n }\n checkError(): void {\n if (env.debug) {\n const gl = this.gl;\n const error = gl.getError();\n let label = '';\n switch (error) {\n case (gl.NO_ERROR):\n return;\n case (gl.INVALID_ENUM):\n label = 'INVALID_ENUM';\n break;\n case (gl.INVALID_VALUE):\n label = 'INVALID_VALUE';\n break;\n case (gl.INVALID_OPERATION):\n label = 'INVALID_OPERATION';\n break;\n case (gl.INVALID_FRAMEBUFFER_OPERATION):\n label = 'INVALID_FRAMEBUFFER_OPERATION';\n break;\n case (gl.OUT_OF_MEMORY):\n label = 'OUT_OF_MEMORY';\n break;\n case (gl.CONTEXT_LOST_WEBGL):\n label = 'CONTEXT_LOST_WEBGL';\n break;\n default:\n label = `Unknown WebGL Error: ${error.toString(16)}`;\n }\n throw new Error(label);\n }\n }\n deleteTexture(texture: WebGLTexture): void {\n this.gl.deleteTexture(texture);\n }\n deleteProgram(program: WebGLProgram): void {\n this.gl.deleteProgram(program);\n }\n getEncoder(dataType: Encoder.DataType, channels: number, usage: EncoderUsage = EncoderUsage.Default): DataEncoder {\n if (this.version === 2) {\n return new DataEncoders.RedFloat32DataEncoder(this.gl as WebGL2RenderingContext, channels);\n }\n\n switch (dataType) {\n case 'float':\n if (usage === EncoderUsage.UploadOnly || this.isRenderFloat32Supported) {\n return new DataEncoders.RGBAFloatDataEncoder(this.gl, channels);\n } else {\n return new DataEncoders.RGBAFloatDataEncoder(\n this.gl, channels, this.textureHalfFloatExtension!.HALF_FLOAT_OES);\n }\n case 'int':\n throw new Error('not implemented');\n case 'byte':\n return new DataEncoders.Uint8DataEncoder(this.gl, channels);\n default:\n throw new Error(`Invalid dataType: ${dataType}`);\n }\n }\n clearActiveTextures(): void {\n const gl = this.gl;\n for (let unit = 0; unit < this.maxTextureImageUnits; ++unit) {\n gl.activeTexture(gl.TEXTURE0 + unit);\n gl.bindTexture(gl.TEXTURE_2D, null);\n }\n }\n dispose(): void {\n if (this.disposed) {\n return;\n }\n const gl = this.gl;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.deleteFramebuffer(this.framebuffer);\n gl.bindBuffer(gl.ARRAY_BUFFER, null);\n gl.deleteBuffer(this.vertexbuffer);\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);\n gl.finish();\n this.disposed = true;\n }\n\n private createDefaultGeometry(): Float32Array {\n // Sets of x,y,z(=0),s,t coordinates.\n return new Float32Array([\n -1.0, 1.0, 0.0, 0.0, 1.0, // upper left\n -1.0, -1.0, 0.0, 0.0, 0.0, // lower left\n 1.0, 1.0, 0.0, 1.0, 1.0, // upper right\n 1.0, -1.0, 0.0, 1.0, 0.0 // lower right\n ]);\n }\n private createVertexbuffer(): WebGLBuffer {\n const gl = this.gl;\n const buffer = gl.createBuffer();\n if (!buffer) {\n throw new Error('createBuffer() returned null');\n }\n const geometry = this.createDefaultGeometry();\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n gl.bufferData(gl.ARRAY_BUFFER, geometry, gl.STATIC_DRAW);\n this.checkError();\n return buffer;\n }\n private createFramebuffer(): WebGLFramebuffer {\n const fb = this.gl.createFramebuffer();\n if (!fb) {\n throw new Error('createFramebuffer returned null');\n }\n return fb;\n }\n\n private queryVitalParameters(): void {\n const gl = this.gl;\n\n this.isFloatTextureAttachableToFrameBuffer = this.checkFloatTextureAttachableToFrameBuffer();\n this.isRenderFloat32Supported = this.checkRenderFloat32();\n this.isFloat32DownloadSupported = this.checkFloat32Download();\n\n if (this.version === 1 && !this.textureHalfFloatExtension && !this.isRenderFloat32Supported) {\n throw new Error('both float32 and float16 TextureType are not supported');\n }\n\n this.isBlendSupported = !this.isRenderFloat32Supported || this.checkFloat32Blend();\n\n // this.maxCombinedTextureImageUnits = gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS);\n this.maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);\n this.maxTextureImageUnits = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n // this.maxCubeMapTextureSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE);\n // this.shadingLanguageVersion = gl.getParameter(gl.SHADING_LANGUAGE_VERSION);\n // this.webglVendor = gl.getParameter(gl.VENDOR);\n // this.webglVersion = gl.getParameter(gl.VERSION);\n\n if (this.version === 2) {\n // this.max3DTextureSize = gl.getParameter(WebGL2RenderingContext.MAX_3D_TEXTURE_SIZE);\n // this.maxArrayTextureLayers = gl.getParameter(WebGL2RenderingContext.MAX_ARRAY_TEXTURE_LAYERS);\n // this.maxColorAttachments = gl.getParameter(WebGL2RenderingContext.MAX_COLOR_ATTACHMENTS);\n // this.maxDrawBuffers = gl.getParameter(WebGL2RenderingContext.MAX_DRAW_BUFFERS);\n }\n }\n private getExtensions(): void {\n if (this.version === 2) {\n this.colorBufferFloatExtension = this.gl.getExtension('EXT_color_buffer_float');\n this.disjointTimerQueryWebgl2Extension = this.gl.getExtension('EXT_disjoint_timer_query_webgl2');\n } else {\n this.textureFloatExtension = this.gl.getExtension('OES_texture_float');\n this.textureHalfFloatExtension = this.gl.getExtension('OES_texture_half_float');\n }\n }\n\n private checkFloatTextureAttachableToFrameBuffer(): boolean {\n // test whether Float32 texture is supported:\n // STEP.1 create a float texture\n const gl = this.gl;\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const internalFormat = this.version === 2 ? (gl as unknown as {RGBA32F: number}).RGBA32F : gl.RGBA;\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, 1, 1, 0, gl.RGBA, gl.FLOAT, null);\n // STEP.2 bind a frame buffer\n const frameBuffer = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffer);\n // STEP.3 attach texture to framebuffer\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\n // STEP.4 test whether framebuffer is complete\n const isComplete = gl.checkFramebufferStatus(gl.FRAMEBUFFER) === gl.FRAMEBUFFER_COMPLETE;\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.deleteTexture(texture);\n gl.deleteFramebuffer(frameBuffer);\n return isComplete;\n }\n\n private checkRenderFloat32(): boolean {\n if (this.version === 2) {\n if (!this.colorBufferFloatExtension) {\n return false;\n }\n } else {\n if (!this.textureFloatExtension) {\n return false;\n }\n }\n return this.isFloatTextureAttachableToFrameBuffer;\n }\n\n private checkFloat32Download(): boolean {\n if (this.version === 2) {\n if (!this.colorBufferFloatExtension) {\n return false;\n }\n } else {\n if (!this.textureFloatExtension) {\n return false;\n }\n if (!this.gl.getExtension('WEBGL_color_buffer_float')) {\n return false;\n }\n }\n return this.isFloatTextureAttachableToFrameBuffer;\n }\n\n /**\n * Check whether GL_BLEND is supported\n */\n private checkFloat32Blend(): boolean {\n // it looks like currently (2019-05-08) there is no easy way to detect whether BLEND is supported\n // https://github.com/microsoft/onnxjs/issues/145\n\n const gl = this.gl;\n\n let texture: WebGLTexture|null|undefined;\n let frameBuffer: WebGLFramebuffer|null|undefined;\n let vertexShader: WebGLShader|null|undefined;\n let fragmentShader: WebGLShader|null|undefined;\n let program: WebGLProgram|null|undefined;\n\n try {\n texture = gl.createTexture();\n frameBuffer = gl.createFramebuffer();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const internalFormat = this.version === 2 ? (gl as unknown as {RGBA32F: number}).RGBA32F : gl.RGBA;\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, 1, 1, 0, gl.RGBA, gl.FLOAT, null);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffer);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\n\n gl.enable(gl.BLEND);\n\n vertexShader = gl.createShader(gl.VERTEX_SHADER);\n if (!vertexShader) {\n return false;\n }\n gl.shaderSource(vertexShader, 'void main(){}');\n gl.compileShader(vertexShader);\n\n fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\n if (!fragmentShader) {\n return false;\n }\n gl.shaderSource(fragmentShader, 'precision highp float;void main(){gl_FragColor=vec4(0.5);}');\n gl.compileShader(fragmentShader);\n\n program = gl.createProgram();\n if (!program) {\n return false;\n }\n gl.attachShader(program, vertexShader);\n gl.attachShader(program, fragmentShader);\n gl.linkProgram(program);\n gl.useProgram(program);\n\n gl.drawArrays(gl.POINTS, 0, 1);\n return gl.getError() === gl.NO_ERROR;\n\n } finally {\n gl.disable(gl.BLEND);\n\n if (program) {\n gl.deleteProgram(program);\n }\n if (vertexShader) {\n gl.deleteShader(vertexShader);\n }\n if (fragmentShader) {\n gl.deleteShader(fragmentShader);\n }\n if (frameBuffer) {\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.deleteFramebuffer(frameBuffer);\n }\n if (texture) {\n gl.bindTexture(gl.TEXTURE_2D, null);\n gl.deleteTexture(texture);\n }\n }\n }\n\n beginTimer(): WebGLQuery {\n if (this.version === 2 && this.disjointTimerQueryWebgl2Extension) {\n const gl2 = this.gl as WebGL2RenderingContext;\n const ext = this.disjointTimerQueryWebgl2Extension;\n\n const query = gl2.createQuery() as WebGLQuery;\n gl2.beginQuery(ext.TIME_ELAPSED_EXT, query);\n return query;\n } else {\n // TODO: add webgl 1 handling.\n throw new Error('WebGL1 profiling currently not supported.');\n }\n }\n\n endTimer() {\n if (this.version === 2 && this.disjointTimerQueryWebgl2Extension) {\n const gl2 = this.gl as WebGL2RenderingContext;\n const ext = this.disjointTimerQueryWebgl2Extension;\n gl2.endQuery(ext.TIME_ELAPSED_EXT);\n return;\n } else {\n // TODO: add webgl 1 handling.\n throw new Error('WebGL1 profiling currently not supported');\n }\n }\n\n isTimerResultAvailable(query: WebGLQuery): boolean {\n let available = false, disjoint = false;\n if (this.version === 2 && this.disjointTimerQueryWebgl2Extension) {\n const gl2 = this.gl as WebGL2RenderingContext;\n const ext = this.disjointTimerQueryWebgl2Extension;\n\n available = gl2.getQueryParameter(query, gl2.QUERY_RESULT_AVAILABLE);\n disjoint = gl2.getParameter(ext.GPU_DISJOINT_EXT);\n } else {\n // TODO: add webgl 1 handling.\n throw new Error('WebGL1 profiling currently not supported');\n }\n\n return available && !disjoint;\n }\n\n getTimerResult(query: WebGLQuery): number {\n let timeElapsed = 0;\n if (this.version === 2) {\n const gl2 = this.gl as WebGL2RenderingContext;\n timeElapsed = gl2.getQueryParameter(query, gl2.QUERY_RESULT);\n gl2.deleteQuery(query);\n } else {\n // TODO: add webgl 1 handling.\n throw new Error('WebGL1 profiling currently not supported');\n }\n // return miliseconds\n return timeElapsed / 1000000;\n }\n\n async waitForQueryAndGetTime(query: WebGLQuery): Promise {\n await repeatedTry(() => this.isTimerResultAvailable(query));\n return this.getTimerResult(query);\n }\n\n public async createAndWaitForFence(): Promise {\n const fenceContext = this.createFence(this.gl);\n return this.pollFence(fenceContext);\n }\n\n private createFence(gl: WebGLRenderingContext): FenceContext {\n let isFencePassed: () => boolean;\n const gl2 = gl as WebGL2RenderingContext;\n const query = gl2.fenceSync(gl2.SYNC_GPU_COMMANDS_COMPLETE, 0);\n gl.flush();\n if (query === null) {\n isFencePassed = () => true;\n } else {\n isFencePassed = () => {\n const status = gl2.clientWaitSync(query, 0, 0);\n return status === gl2.ALREADY_SIGNALED || status === gl2.CONDITION_SATISFIED;\n };\n }\n return {query, isFencePassed};\n }\n\n async pollFence(fenceContext: FenceContext) {\n return new Promise(resolve => {\n void this.addItemToPoll(() => fenceContext.isFencePassed(), () => resolve());\n });\n }\n\n private itemsToPoll: PollItem[] = [];\n\n pollItems(): void {\n // Find the last query that has finished.\n const index = linearSearchLastTrue(this.itemsToPoll.map(x => x.isDoneFn));\n for (let i = 0; i <= index; ++i) {\n const {resolveFn} = this.itemsToPoll[i];\n resolveFn();\n }\n this.itemsToPoll = this.itemsToPoll.slice(index + 1);\n }\n\n private async addItemToPoll(isDoneFn: () => boolean, resolveFn: () => void) {\n this.itemsToPoll.push({isDoneFn, resolveFn});\n if (this.itemsToPoll.length > 1) {\n // We already have a running loop that polls.\n return;\n }\n // Start a new loop that polls.\n await repeatedTry(() => {\n this.pollItems();\n // End the loop if no more items to poll.\n return this.itemsToPoll.length === 0;\n });\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Logger} from '../../instrument';\n\nimport {WebGLContext} from './webgl-context';\n\nconst cache: {[contextId: string]: WebGLContext} = {};\n\n/**\n * This factory function creates proper WebGLRenderingContext based on\n * the current browsers capabilities\n * The order is from higher/most recent versions to most basic\n */\nexport function createWebGLContext(contextId?: 'webgl'|'webgl2'): WebGLContext {\n let context: WebGLContext|undefined;\n if ((!contextId || contextId === 'webgl2') && 'webgl2' in cache) {\n context = cache.webgl2;\n } else if ((!contextId || contextId === 'webgl') && 'webgl' in cache) {\n context = cache.webgl;\n }\n\n if (!context) {\n try {\n // try to create webgl context from an offscreen canvas\n const offscreenCanvas = createOffscreenCanvas();\n context = createNewWebGLContext(offscreenCanvas, contextId);\n } catch (e) {\n // if failed, fallback to try to use a normal canvas element\n const canvas = createCanvas();\n context = createNewWebGLContext(canvas, contextId);\n }\n }\n\n contextId = contextId || context.version === 1 ? 'webgl' : 'webgl2';\n const gl = context.gl;\n\n cache[contextId] = context;\n\n if (gl.isContextLost()) {\n delete cache[contextId];\n return createWebGLContext(contextId);\n }\n\n gl.disable(gl.DEPTH_TEST);\n gl.disable(gl.STENCIL_TEST);\n gl.disable(gl.BLEND);\n gl.disable(gl.DITHER);\n gl.disable(gl.POLYGON_OFFSET_FILL);\n gl.disable(gl.SAMPLE_COVERAGE);\n gl.enable(gl.SCISSOR_TEST);\n gl.enable(gl.CULL_FACE);\n gl.cullFace(gl.BACK);\n\n return context;\n}\n\nexport function createNewWebGLContext(canvas: HTMLCanvasElement, contextId?: 'webgl'|'webgl2'): WebGLContext {\n const contextAttributes: WebGLContextAttributes = {\n alpha: false,\n depth: false,\n antialias: false,\n stencil: false,\n preserveDrawingBuffer: false,\n premultipliedAlpha: false,\n failIfMajorPerformanceCaveat: false\n };\n let gl: WebGLRenderingContext|null;\n const ca = contextAttributes;\n if (!contextId || contextId === 'webgl2') {\n gl = canvas.getContext('webgl2', ca);\n if (gl) {\n try {\n return new WebGLContext(gl, 2);\n } catch (err) {\n Logger.warning('GlContextFactory', `failed to create WebGLContext using contextId 'webgl2'. Error: ${err}`);\n }\n }\n }\n if (!contextId || contextId === 'webgl') {\n gl = canvas.getContext('webgl', ca) || canvas.getContext('experimental-webgl', ca) as WebGLRenderingContext;\n if (gl) {\n try {\n return new WebGLContext(gl, 1);\n } catch (err) {\n Logger.warning(\n 'GlContextFactory',\n `failed to create WebGLContext using contextId 'webgl' or 'experimental-webgl'. Error: ${err}`);\n }\n }\n }\n\n throw new Error('WebGL is not supported');\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\ndeclare let OffscreenCanvas: {new (width: number, height: number): HTMLCanvasElement};\n\nfunction createCanvas(): HTMLCanvasElement {\n if (typeof document === 'undefined') {\n throw new TypeError('failed to create canvas: document is not supported');\n }\n const canvas: HTMLCanvasElement = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n return canvas;\n}\n\nfunction createOffscreenCanvas(): HTMLCanvasElement {\n if (typeof OffscreenCanvas === 'undefined') {\n throw new TypeError('failed to create offscreen canvas: OffscreenCanvas is not supported');\n }\n return new OffscreenCanvas(1, 1);\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {env} from 'onnxruntime-common';\n\nimport {Backend, SessionHandler} from '../backend';\nimport {Logger} from '../instrument';\nimport {Session} from '../session';\n\nimport {WebGLSessionHandler} from './webgl/session-handler';\nimport {WebGLContext} from './webgl/webgl-context';\nimport {createWebGLContext} from './webgl/webgl-context-factory';\n\n/**\n * WebGLBackend is the entry point for all WebGL opeartions\n * When it starts it created the WebGLRenderingContext\n * and other main framework components such as Program and Texture Managers\n */\nexport class WebGLBackend implements Backend {\n glContext: WebGLContext;\n\n get contextId(): 'webgl'|'webgl2'|undefined {\n return env.webgl.contextId;\n }\n set contextId(value: 'webgl'|'webgl2'|undefined) {\n env.webgl.contextId = value;\n }\n\n get matmulMaxBatchSize(): number|undefined {\n return env.webgl.matmulMaxBatchSize;\n }\n set matmulMaxBatchSize(value: number|undefined) {\n env.webgl.matmulMaxBatchSize = value;\n }\n\n get textureCacheMode(): 'initializerOnly'|'full'|undefined {\n return env.webgl.textureCacheMode;\n }\n set textureCacheMode(value: 'initializerOnly'|'full'|undefined) {\n env.webgl.textureCacheMode = value;\n }\n\n get pack(): boolean|undefined {\n return env.webgl.pack;\n }\n set pack(value: boolean|undefined) {\n env.webgl.pack = value;\n }\n\n get async(): boolean|undefined {\n return env.webgl.async;\n }\n set async(value: boolean|undefined) {\n env.webgl.async = value;\n }\n\n initialize(): boolean {\n try {\n this.glContext = createWebGLContext(this.contextId);\n if (typeof this.matmulMaxBatchSize !== 'number') {\n this.matmulMaxBatchSize = 16;\n }\n if (typeof this.textureCacheMode !== 'string') {\n this.textureCacheMode = 'full';\n }\n if (typeof this.pack !== 'boolean') {\n this.pack = false;\n }\n if (typeof this.async !== 'boolean') {\n this.async = false;\n }\n\n Logger.setWithEnv(env);\n\n if (!env.webgl.context) {\n Object.defineProperty(env.webgl, 'context', {value: this.glContext.gl});\n }\n\n Logger.verbose(\n 'WebGLBackend',\n `Created WebGLContext: ${typeof this.glContext} with matmulMaxBatchSize: ${\n this.matmulMaxBatchSize}; textureCacheMode: ${this.textureCacheMode}; pack: ${this.pack}; async: ${\n this.async}.`);\n return true;\n } catch (e) {\n Logger.warning('WebGLBackend', `Unable to initialize WebGLBackend. ${e}`);\n return false;\n }\n }\n createSessionHandler(context: Session.Context): SessionHandler {\n return new WebGLSessionHandler(this, context);\n }\n dispose(): void {\n this.glContext.dispose();\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {WebGLBackend} from './backends/backend-webgl';\nimport {Graph} from './graph';\nimport {Operator} from './operators';\nimport {OpSet} from './opset';\nimport {Session} from './session';\n\nexport interface InferenceHandler {\n /**\n * dispose the inference handler. it will be called as the last step in Session.run()\n */\n dispose(): void;\n}\n\nexport interface SessionHandler {\n /**\n * transform the graph at initialization time\n * @param graphTransformer the graph transformer to manipulate the model graph\n */\n transformGraph?(graphTransformer: Graph.Transformer): void;\n\n /**\n * create an instance of InferenceHandler to use in a Session.run() call\n */\n createInferenceHandler(): InferenceHandler;\n\n /**\n * dispose the session handler. it will be called when a session is being disposed explicitly\n */\n dispose(): void;\n\n /**\n * Resolves the operator from the name and opset version; backend specific\n * @param node the node to resolve\n * @param opsets a list of opsets that exported from the model\n * @param graph the completely initialized graph\n */\n resolve(node: Graph.Node, opsets: readonly OpSet[], graph: Graph): Operator;\n\n /**\n * This method let's the sessionHandler know that the graph initialization is complete\n * @param graph the completely initialized graph\n */\n onGraphInitialized?(graph: Graph): void;\n\n /**\n * a reference to the corresponding backend\n */\n readonly backend: Backend;\n\n /**\n * a reference to the session context\n */\n readonly context: Session.Context;\n}\n\nexport interface Backend {\n /**\n * initialize the backend. will be called only once, when the first time the\n * backend it to be used\n */\n initialize(): boolean|Promise;\n\n /**\n * create an instance of SessionHandler to use in a Session object's lifecycle\n */\n createSessionHandler(context: Session.Context): SessionHandler;\n\n /**\n * dispose the backend. currently this will not be called\n */\n dispose(): void;\n}\n\n// caches all initialized backend instances\nconst backendsCache: Map = new Map();\n\nexport const backend: {[name: string]: Backend} = {\n webgl: new WebGLBackend()\n};\n\n/**\n * Resolve a reference to the backend. If a hint is specified, the corresponding\n * backend will be used.\n */\nexport async function resolveBackend(hint?: string|readonly string[]): Promise {\n if (!hint) {\n return resolveBackend(['webgl']);\n } else {\n const hints = typeof hint === 'string' ? [hint] : hint;\n\n for (const backendHint of hints) {\n const cache = backendsCache.get(backendHint);\n if (cache) {\n return cache;\n }\n\n const backend = await tryLoadBackend(backendHint);\n if (backend) {\n return backend;\n }\n }\n }\n\n throw new Error('no available backend to use');\n}\n\nasync function tryLoadBackend(backendHint: string): Promise {\n const backendObj = backend;\n\n if (typeof backendObj[backendHint] !== 'undefined' && isBackend(backendObj[backendHint])) {\n const backend = backendObj[backendHint];\n let init = backend.initialize();\n if (typeof init === 'object' && 'then' in init) {\n init = await init;\n }\n if (init) {\n backendsCache.set(backendHint, backend);\n return backend;\n }\n }\n\n return undefined;\n}\n\nfunction isBackend(obj: unknown) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const o = obj as any;\n\n // check if an object is a Backend instance\n if (\n 'initialize' in o && typeof o.initialize === 'function' && // initialize()\n 'createSessionHandler' in o && typeof o.createSessionHandler === 'function' && // createSessionHandler()\n 'dispose' in o && typeof o.dispose === 'function' // dispose()\n ) {\n return true;\n }\n\n return false;\n}\n\nexport type BackendType = Backend;\nexport type SessionHandlerType = ReturnType;\nexport type InferenceHandlerType = ReturnType;\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {SessionHandler} from './backend';\nimport {Graph} from './graph';\nimport {Logger, Profiler} from './instrument';\nimport {Operator} from './operators';\nimport {Tensor} from './tensor';\n\nclass KernelOp {\n constructor(public op: Operator, public node: Graph.Node) {}\n}\n\nexport class ExecutionPlan {\n constructor(private graph: Graph, ops: Operator[], private profiler: Readonly) {\n this.initialize(ops);\n }\n\n initialize(ops: Operator[]) {\n this.profiler.event('session', 'ExecutionPlan.initialize', () => {\n const graphNodes = this.graph.getNodes();\n if (graphNodes.length !== ops.length) {\n throw new Error('The size of nodes and OPs do not match.');\n }\n\n this._ops = ops.map((op, i) => new KernelOp(op, graphNodes[i]));\n this.reset();\n\n // look for starter node(s)\n this._starter = [];\n this._ops.forEach((op, i) => {\n let resolved = true;\n for (const input of op.node.inputs) {\n if (\n !this._values[input] // not an initialized input\n && this.graph.getInputIndices().indexOf(input) === -1 // not model input\n ) {\n resolved = false;\n break;\n }\n }\n if (resolved) {\n this._starter.push(i);\n }\n });\n });\n }\n\n reset() {\n this._values = this.graph.getValues().map(i => i.tensor);\n }\n\n async execute(sessionHandler: SessionHandler, modelInputs: Tensor[]): Promise {\n return this.profiler.event('session', 'ExecutionPlan.execute', async () => {\n // reset mediem result\n this.reset();\n\n // create inference handler\n const inferenceHandler = sessionHandler.createInferenceHandler();\n\n // populate inputs value\n const graphInputs = this.graph.getInputIndices();\n if (modelInputs.length !== graphInputs.length) {\n throw new Error(`number of input tensors don't match the number of inputs to the model: actual: ${\n modelInputs.length} expected: ${graphInputs.length}`);\n }\n\n modelInputs.forEach((input, i) => {\n const index = graphInputs[i];\n this._values[index] = input;\n });\n\n // prepare running sequence\n const sequence: number[] = this._starter.slice(0);\n\n // execution iterations\n const graphValues = this.graph.getValues();\n const graphNodes = this.graph.getNodes();\n\n let rear = 0;\n while (rear < sequence.length) {\n const thisOpIndex = sequence[rear++];\n const thisOp = this._ops[thisOpIndex];\n\n // check input\n const inputList = thisOp.node.inputs.map(i => this._values[i]);\n if (inputList.indexOf(undefined) !== -1) {\n throw new Error(`unresolved input detected: op: ${thisOp.node}`);\n }\n\n // run\n const inputTensors = inputList as Tensor[];\n Logger.verbose(\n 'ExecPlan',\n `Running op:${thisOp.node.name} (${\n inputTensors.map((t, i) => `'${thisOp.node.inputs[i]}': ${t.type}[${t.dims.join(',')}]`).join(', ')})`);\n\n const outputList = await this.profiler.event(\n 'node', thisOp.node.name, async () => thisOp.op.impl(inferenceHandler, inputTensors, thisOp.op.context));\n\n // check output\n if (outputList.length !== thisOp.node.outputs.length) {\n throw new Error('the size of output does not match model definition.');\n }\n\n // fill value\n outputList.forEach((output, i) => {\n const j = thisOp.node.outputs[i];\n if (this._values[j]) {\n throw new Error(`output [${j}] already has value: op:${thisOp.node.name}`);\n }\n this._values[j] = output;\n });\n\n // resolve downstream nodes\n const downstreamNodes = new Set();\n outputList.forEach((_output, i) => {\n const j = thisOp.node.outputs[i];\n for (const currentDownstreamNodeIndex of graphValues[j].to) {\n const currentDownstreamNode = graphNodes[currentDownstreamNodeIndex];\n let resolved = true;\n for (const k of currentDownstreamNode.inputs) {\n if (!this._values[k]) {\n resolved = false;\n break;\n }\n }\n if (resolved) {\n downstreamNodes.add(currentDownstreamNodeIndex);\n }\n }\n });\n sequence.push(...downstreamNodes);\n }\n\n const output: Tensor[] = [];\n for (let i = 0; i < this.graph.getOutputIndices().length; i++) {\n const outputIndex = this.graph.getOutputIndices()[i];\n const outputTensor = this._values[outputIndex];\n if (outputTensor === undefined) {\n throw new Error(`required output [${outputIndex}] does not have value`);\n }\n if (outputIndex === 0) {\n await outputTensor.getData();\n } else {\n // eslint-disable-next-line no-unused-expressions\n outputTensor.data;\n }\n output.push(outputTensor);\n }\n Logger.verbose('ExecPlan', 'disposing of inferenceHandler');\n inferenceHandler.dispose();\n return output;\n });\n }\n\n _values: Array;\n _ops: KernelOp[];\n _starter: number[];\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport Long from 'long';\n\nimport {onnxruntime} from './ort-schema/flatbuffers/ort-generated';\nimport {onnx} from './ort-schema/protobuf/onnx';\nimport {Tensor} from './tensor';\nimport {decodeUtf8String, LongUtil} from './util';\n\nimport ortFbs = onnxruntime.experimental.fbs;\n\nexport declare namespace Attribute {\n export interface DataTypeMap {\n float: number;\n int: number;\n string: string;\n tensor: Tensor;\n floats: number[];\n ints: number[];\n strings: string[];\n tensors: Tensor[];\n }\n\n export type DataType = keyof DataTypeMap;\n}\n\ntype ValueTypes = Attribute.DataTypeMap[Attribute.DataType];\n\ntype Value = [ValueTypes, Attribute.DataType];\n\nexport class Attribute {\n constructor(attributes: onnx.IAttributeProto[]|ortFbs.Attribute[]|null|undefined) {\n this._attributes = new Map();\n if (attributes !== null && attributes !== undefined) {\n for (const attr of attributes) {\n if (attr instanceof onnx.AttributeProto) {\n this._attributes.set(attr.name, [Attribute.getValue(attr), Attribute.getType(attr)]);\n } else if (attr instanceof ortFbs.Attribute) {\n this._attributes.set(attr.name()!, [Attribute.getValue(attr), Attribute.getType(attr)]);\n }\n }\n if (this._attributes.size < attributes.length) {\n throw new Error('duplicated attribute names');\n }\n }\n }\n\n set(key: string, type: Attribute.DataType, value: ValueTypes): void {\n this._attributes.set(key, [value, type]);\n }\n delete(key: string): void {\n this._attributes.delete(key);\n }\n getFloat(key: string, defaultValue?: Attribute.DataTypeMap['float']) {\n return this.get(key, 'float', defaultValue);\n }\n\n getInt(key: string, defaultValue?: Attribute.DataTypeMap['int']) {\n return this.get(key, 'int', defaultValue);\n }\n\n getString(key: string, defaultValue?: Attribute.DataTypeMap['string']) {\n return this.get(key, 'string', defaultValue);\n }\n\n getTensor(key: string, defaultValue?: Attribute.DataTypeMap['tensor']) {\n return this.get(key, 'tensor', defaultValue);\n }\n\n getFloats(key: string, defaultValue?: Attribute.DataTypeMap['floats']) {\n return this.get(key, 'floats', defaultValue);\n }\n\n getInts(key: string, defaultValue?: Attribute.DataTypeMap['ints']) {\n return this.get(key, 'ints', defaultValue);\n }\n\n getStrings(key: string, defaultValue?: Attribute.DataTypeMap['strings']) {\n return this.get(key, 'strings', defaultValue);\n }\n\n getTensors(key: string, defaultValue?: Attribute.DataTypeMap['tensors']) {\n return this.get(key, 'tensors', defaultValue);\n }\n\n private get(\n key: string, type: Attribute.DataType, defaultValue?: V): V {\n const valueAndType = this._attributes.get(key);\n if (valueAndType === undefined) {\n if (defaultValue !== undefined) {\n return defaultValue;\n }\n throw new Error(`required attribute not found: ${key}`);\n }\n if (valueAndType[1] !== type) {\n throw new Error(`type mismatch: expected ${type} but got ${valueAndType[1]}`);\n }\n return valueAndType[0] as V;\n }\n\n private static getType(attr: onnx.IAttributeProto|ortFbs.Attribute): Attribute.DataType {\n const type = attr instanceof onnx.AttributeProto ? (attr).type : (attr as ortFbs.Attribute).type();\n switch (type) {\n case onnx.AttributeProto.AttributeType.FLOAT:\n return 'float';\n case onnx.AttributeProto.AttributeType.INT:\n return 'int';\n case onnx.AttributeProto.AttributeType.STRING:\n return 'string';\n case onnx.AttributeProto.AttributeType.TENSOR:\n return 'tensor';\n case onnx.AttributeProto.AttributeType.FLOATS:\n return 'floats';\n case onnx.AttributeProto.AttributeType.INTS:\n return 'ints';\n case onnx.AttributeProto.AttributeType.STRINGS:\n return 'strings';\n case onnx.AttributeProto.AttributeType.TENSORS:\n return 'tensors';\n default:\n throw new Error(`attribute type is not supported yet: ${onnx.AttributeProto.AttributeType[type]}`);\n }\n }\n\n private static getValue(attr: onnx.IAttributeProto|ortFbs.Attribute) {\n const attrType = attr instanceof onnx.AttributeProto ? attr.type : (attr as ortFbs.Attribute).type();\n if (attrType === onnx.AttributeProto.AttributeType.GRAPH || attrType === onnx.AttributeProto.AttributeType.GRAPHS) {\n throw new Error('graph attribute is not supported yet');\n }\n\n const value = this.getValueNoCheck(attr);\n\n // cast LONG to number\n if (attrType === onnx.AttributeProto.AttributeType.INT && LongUtil.isLong(value)) {\n return LongUtil.longToNumber(value as Long | flatbuffers.Long);\n }\n\n // cast LONG[] to number[]\n if (attrType === onnx.AttributeProto.AttributeType.INTS) {\n const arr = (value as Array);\n const numberValue: number[] = new Array(arr.length);\n\n for (let i = 0; i < arr.length; i++) {\n const maybeLong = arr[i];\n numberValue[i] = LongUtil.longToNumber(maybeLong);\n }\n\n return numberValue;\n }\n\n // cast onnx.TensorProto to onnxjs.Tensor\n if (attrType === onnx.AttributeProto.AttributeType.TENSOR) {\n return attr instanceof onnx.AttributeProto ? Tensor.fromProto(value as onnx.ITensorProto) :\n Tensor.fromOrtTensor(value as ortFbs.Tensor);\n }\n\n // cast onnx.TensorProto[] to onnxjs.Tensor[]\n if (attrType === onnx.AttributeProto.AttributeType.TENSORS) {\n if (attr instanceof onnx.AttributeProto) {\n const tensorProtos = value as onnx.ITensorProto[];\n return tensorProtos.map(value => Tensor.fromProto(value));\n } else if (attr instanceof ortFbs.Attribute) {\n const tensorProtos = value as ortFbs.Tensor[];\n return tensorProtos.map(value => Tensor.fromOrtTensor(value));\n }\n }\n\n // cast Uint8Array to string\n if (attrType === onnx.AttributeProto.AttributeType.STRING) {\n // string in onnx attribute is of uint8array type, so we need to convert it to string below. While in ort format,\n // string attributes are returned as string, so no conversion is needed.\n if (attr instanceof onnx.AttributeProto) {\n const utf8String = value as Uint8Array;\n return decodeUtf8String(utf8String);\n }\n }\n\n // cast Uint8Array[] to string[]\n if (attrType === onnx.AttributeProto.AttributeType.STRINGS) {\n // strings in onnx attribute is returned as uint8array[], so we need to convert it to string[] below. While in ort\n // format strings attributes are returned as string[], so no conversion is needed.\n if (attr instanceof onnx.AttributeProto) {\n const utf8Strings = value as Uint8Array[];\n return utf8Strings.map(decodeUtf8String);\n }\n }\n\n return value as ValueTypes;\n }\n\n private static getValueNoCheck(attr: onnx.IAttributeProto|ortFbs.Attribute) {\n return attr instanceof (onnx.AttributeProto) ? this.getValueNoCheckFromOnnxFormat(attr) :\n this.getValueNoCheckFromOrtFormat(attr as ortFbs.Attribute);\n }\n\n private static getValueNoCheckFromOnnxFormat(attr: onnx.IAttributeProto) {\n switch (attr.type!) {\n case onnx.AttributeProto.AttributeType.FLOAT:\n return attr.f;\n case onnx.AttributeProto.AttributeType.INT:\n return attr.i;\n case onnx.AttributeProto.AttributeType.STRING:\n return attr.s;\n case onnx.AttributeProto.AttributeType.TENSOR:\n return attr.t;\n case onnx.AttributeProto.AttributeType.GRAPH:\n return attr.g;\n case onnx.AttributeProto.AttributeType.FLOATS:\n return attr.floats;\n case onnx.AttributeProto.AttributeType.INTS:\n return attr.ints;\n case onnx.AttributeProto.AttributeType.STRINGS:\n return attr.strings;\n case onnx.AttributeProto.AttributeType.TENSORS:\n return attr.tensors;\n case onnx.AttributeProto.AttributeType.GRAPHS:\n return attr.graphs;\n default:\n throw new Error(`unsupported attribute type: ${onnx.AttributeProto.AttributeType[attr.type!]}`);\n }\n }\n\n private static getValueNoCheckFromOrtFormat(attr: ortFbs.Attribute) {\n switch (attr.type()) {\n case ortFbs.AttributeType.FLOAT:\n return attr.f();\n case ortFbs.AttributeType.INT:\n return attr.i();\n case ortFbs.AttributeType.STRING:\n return attr.s();\n case ortFbs.AttributeType.TENSOR:\n return attr.t();\n case ortFbs.AttributeType.GRAPH:\n return attr.g();\n case ortFbs.AttributeType.FLOATS:\n return attr.floatsArray();\n case ortFbs.AttributeType.INTS: {\n const ints = [];\n for (let i = 0; i < attr.intsLength(); i++) {\n ints.push(attr.ints(i)!);\n }\n return ints;\n }\n case ortFbs.AttributeType.STRINGS: {\n const strings = [];\n for (let i = 0; i < attr.stringsLength(); i++) {\n strings.push(attr.strings(i));\n }\n return strings;\n }\n case ortFbs.AttributeType.TENSORS: {\n const tensors = [];\n for (let i = 0; i < attr.tensorsLength(); i++) {\n tensors.push(attr.tensors(i)!);\n }\n return tensors;\n }\n // case ortFbs.AttributeType.GRAPHS:\n // TODO: Subgraph not supported yet.\n // const graphs = [];\n // for (let i = 0; i < attr.graphsLength(); i++) {\n // graphs.push(attr.graphs(i)!);\n // }\n // return graphs;\n default:\n throw new Error(`unsupported attribute type: ${ortFbs.AttributeType[attr.type()]}`);\n }\n }\n\n protected _attributes: Map;\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Attribute} from './attribute';\nimport {onnxruntime} from './ort-schema/flatbuffers/ort-generated';\nimport {onnx} from './ort-schema/protobuf/onnx';\nimport {Tensor} from './tensor';\nimport {LongUtil, MAX_CLIP, MIN_CLIP, ProtoUtil} from './util';\n\nimport ortFbs = onnxruntime.experimental.fbs;\n\nexport declare namespace Graph {\n export interface Shape {\n readonly dims: readonly number[];\n }\n export interface ValueType {\n readonly tensorType: Tensor.DataType;\n readonly shape: Shape;\n }\n export interface Value {\n // the tensor data. empty for non-initialized inputs\n readonly tensor?: Tensor;\n\n // index to the Node where the value comes from. -1 for initializer.\n readonly from: number;\n\n // indices to the Nodes where the values go to.\n readonly to: readonly number[];\n\n // value type specification. empty for non-input values.\n readonly type?: ValueType;\n }\n export interface Node {\n // name of the node\n readonly name: string;\n\n // the operator type\n readonly opType: string;\n\n // indices to the Values where the inputs come from.\n readonly inputs: readonly number[];\n\n // indices to the Values where the outpus go to.\n readonly outputs: readonly number[];\n\n // the attributes that used by the operator\n readonly attributes: Attribute;\n }\n\n /**\n * a Transformer is an instance that allows all possible transformation operations that applied to a graph\n */\n export interface Transformer {\n removeAllIdentityNodes(): void;\n removeAllDropoutNodes(): void;\n fuseConvActivationNodes(): void;\n // TODO: add generic functions to manipulate the graph\n }\n\n // an initializer can use transformer to transform the graph\n export interface Initializer {\n transformGraph(transformer: Transformer): void;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport interface Graph {\n getInputIndices(): readonly number[];\n getInputNames(): readonly string[];\n getOutputIndices(): readonly number[];\n getOutputNames(): readonly string[];\n getValues(): readonly Graph.Value[];\n getNodes(): readonly Graph.Node[];\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-redeclare\nexport const Graph = {\n /**\n * construct a graph from a graph protobuf type\n */\n from: (graphProto: onnx.IGraphProto|ortFbs.Graph, initializer?: Graph.Initializer) =>\n new GraphImpl(graphProto, initializer),\n};\n\nclass Value implements Graph.Value {\n constructor(valueInfo?: onnx.IValueInfoProto) {\n this._from = undefined;\n this._to = [];\n this.tensor = undefined;\n this.type = undefined;\n\n if (valueInfo) {\n this.type = ProtoUtil.tensorValueTypeFromProto(valueInfo.type!.tensorType!);\n }\n }\n\n _from?: number; // -1 represent from initializer\n get from() {\n return this._from!;\n }\n _to: number[];\n get to() {\n return this._to;\n }\n type?: Graph.ValueType;\n tensor?: Tensor;\n}\n\nclass Node implements Graph.Node {\n constructor(_nodeProto: onnx.INodeProto|ortFbs.Node, name?: string) {\n if (_nodeProto instanceof onnx.NodeProto) {\n this.name = _nodeProto.name;\n this.opType = _nodeProto.opType;\n this.attributes = new Attribute(_nodeProto.attribute);\n } else if (_nodeProto instanceof ortFbs.Node) {\n this.name = name ?? _nodeProto.name()!;\n this.opType = _nodeProto.opType()!;\n this.attributes = new Attribute(ProtoUtil.tensorAttributesFromORTFormat(_nodeProto));\n }\n\n this.inputs = [];\n this.outputs = [];\n this.executeNode = true;\n }\n\n name: string;\n opType: string;\n inputs: number[];\n outputs: number[];\n attributes: Attribute;\n executeNode: boolean;\n}\n\nclass GraphImpl implements Graph, Graph.Transformer {\n private _allData: Value[];\n\n private _allInputIndices: number[];\n private _allInputNames: string[];\n\n private _allOutputIndices: number[];\n private _allOutputNames: string[];\n\n private _nodes: Node[];\n\n constructor(graph: onnx.IGraphProto|ortFbs.Graph, graphInitializer?: Graph.Initializer) {\n if (!graph) {\n throw new TypeError('graph is empty');\n }\n\n // build the graph - will throw exceptions if something fatal is detected\n this.buildGraph(graph);\n\n // execute any transformation logic for the graph (if applicable)\n this.transformGraph(graphInitializer);\n\n // check for cycles and other inconsistencies - will throw exceptions if something fatal is detected\n this.checkIsAcyclic();\n }\n\n getInputIndices(): readonly number[] {\n return this._allInputIndices;\n }\n\n getInputNames(): readonly string[] {\n return this._allInputNames;\n }\n\n getOutputIndices(): readonly number[] {\n return this._allOutputIndices;\n }\n\n getOutputNames(): readonly string[] {\n return this._allOutputNames;\n }\n\n getValues(): readonly Graph.Value[] {\n return this._allData;\n }\n\n getNodes(): readonly Graph.Node[] {\n return this._nodes;\n }\n\n private buildGraph(graph: onnx.IGraphProto|ortFbs.Graph) {\n // build the graph - will throw exceptions if something fatal is detected\n if (graph instanceof onnx.GraphProto) {\n this.buildGraphFromOnnxFormat(graph);\n } else if (graph instanceof ortFbs.Graph) {\n this.buildGraphFromOrtFormat(graph);\n } else {\n throw new TypeError('Graph type is not supported.');\n }\n }\n private buildGraphFromOnnxFormat(graph: onnx.IGraphProto) {\n const dataIndices = new Map();\n this._allData = [];\n\n this._allInputIndices = [];\n this._allInputNames = [];\n\n this._allOutputIndices = [];\n this._allOutputNames = [];\n\n this._nodes = [];\n\n const nodesIndices = new Map();\n\n // scan all inputs\n if (!graph.input) {\n throw new Error('missing information in graph: input');\n }\n const inputValueNames = [];\n for (const i of graph.input) {\n if (dataIndices.has(i.name!)) {\n throw new Error(`duplicated input name: ${i.name}`);\n }\n const currentIndex = this._allData.push(new Value(i)) - 1;\n dataIndices.set(i.name!, currentIndex);\n inputValueNames.push(i.name!);\n }\n\n // scan all initializers\n if (!graph.initializer) {\n throw new Error('missing information in graph: initializer');\n }\n for (const i of graph.initializer) {\n let index = dataIndices.get(i.name!);\n if (index === undefined) {\n const value = new Value();\n value.type = {\n shape: {dims: ProtoUtil.tensorDimsFromProto(i.dims!)},\n tensorType: ProtoUtil.tensorDataTypeFromProto(i.dataType!)\n };\n index = this._allData.push(value) - 1;\n dataIndices.set(i.name!, index);\n }\n this._allData[index]._from = -1;\n this._allData[index].tensor = Tensor.fromProto(i);\n }\n\n // filter out input indices\n for (let i = 0; i < this._allData.length; i++) {\n if (!this._allData[i].tensor) {\n this._allInputIndices.push(i);\n this._allInputNames.push(inputValueNames[i]);\n }\n }\n\n // scan all outputs\n if (!graph.output) {\n throw new Error('missing information in graph: output');\n }\n for (const i of graph.output) {\n if (dataIndices.has(i.name!)) {\n throw new Error(`duplicated output name: ${i.name}`);\n }\n const currentIndex = this._allData.push(new Value(i)) - 1;\n dataIndices.set(i.name!, currentIndex);\n this._allOutputIndices.push(currentIndex);\n this._allOutputNames.push(i.name!);\n }\n\n // scan all nodes\n if (!graph.node) {\n throw new Error('missing information in graph: node');\n }\n for (const nodeProto of graph.node) {\n if (!nodeProto.name) {\n // assign a name to the node if it doesn't have one\n for (let pick = 0;; pick++) {\n const name = `unnamed_${nodeProto.opType}_${pick}`;\n if (!nodesIndices.has(name)) {\n nodeProto.name = name;\n break;\n }\n }\n }\n\n if (nodesIndices.has(nodeProto.name)) {\n throw new Error(`duplicated node name: ${nodeProto.name}`);\n }\n const currentIndex = this._nodes.push(new Node(nodeProto)) - 1;\n nodesIndices.set(nodeProto.name, currentIndex);\n }\n\n // scan node's outputs\n for (let i = 0; i < this._nodes.length; i++) {\n const node = this._nodes[i];\n const nodeProto = graph.node[i];\n if (!nodeProto.output) {\n throw new Error(`missing output for node: ${nodeProto.name}`);\n }\n for (const output of nodeProto.output) {\n let dataIndex = dataIndices.get(output);\n if (typeof dataIndex === 'undefined') {\n dataIndex = this._allData.push(new Value()) - 1;\n dataIndices.set(output, dataIndex);\n }\n node.outputs.push(dataIndex);\n\n if (this._allData[dataIndex]._from !== undefined) {\n throw new Error(`multiple nodes output to one data value: ${dataIndex}`);\n }\n this._allData[dataIndex]._from = i;\n\n // for the 'Constant' operator, just create a new edge in the graph corresponding to the 'output' of the\n // operator and ignore the node from the graph\n if (nodeProto.opType === 'Constant') {\n if (!nodeProto.attribute || nodeProto.attribute.length !== 1 || !nodeProto.attribute[0].t) {\n throw new Error('missing attributes or missing tensor value in attributes for this Constant operator');\n }\n if (!nodeProto.output || nodeProto.output.length !== 1) {\n throw new Error('missing output or incorrect number of outputs for this Constant operator');\n }\n node.outputs.pop();\n node.executeNode = false;\n\n this._allData[dataIndex]._from = -1;\n this._allData[dataIndex].tensor = Tensor.fromProto(nodeProto.attribute[0].t);\n }\n }\n }\n\n // scan node's inputs\n for (let i = 0; i < this._nodes.length; i++) {\n const node = this._nodes[i];\n const nodeProto = graph.node[i];\n\n if (!nodeProto.input) {\n throw new Error(`missing input for node: ${nodeProto.name}`);\n }\n for (const input of nodeProto.input) {\n const dataIndex = dataIndices.get(input);\n if (typeof dataIndex === 'undefined') {\n // handle exception when opset > 9 and roi / scales not given\n if (input === '' && (nodeProto.input.length === 3 || nodeProto.input.length === 4) &&\n nodeProto.opType === 'Resize') {\n continue;\n }\n throw new Error(`unrecognized input '${input}' for node: ${nodeProto.name}`);\n }\n node.inputs.push(dataIndex);\n\n this._allData[dataIndex]._to.push(i);\n }\n }\n\n return true;\n }\n\n private buildGraphFromOrtFormat(graph: ortFbs.Graph) {\n const dataIndices = new Map();\n this._allData = [];\n\n this._allInputIndices = [];\n this._allInputNames = [];\n\n this._allOutputIndices = [];\n this._allOutputNames = [];\n\n this._nodes = [];\n\n const nodesIndices = new Map();\n\n // scan all inputs\n const inputValueNames = [];\n for (let i = 0; i < graph.inputsLength(); i++) {\n const inputName = graph.inputs(i);\n if (dataIndices.has(inputName)) {\n throw new Error(`duplicated input name: ${inputName}`);\n }\n // Find the input typeInfo from nodeargs\n for (let j = 0; j < graph.nodeArgsLength(); j++) {\n if (graph.nodeArgs(j)?.name() === inputName) {\n const value = new Value();\n const valueType = graph.nodeArgs(j)?.type()?.valueType();\n if (valueType !== ortFbs.TypeInfoValue.tensor_type) {\n throw new Error('Unexpected value type for the nodeArg.');\n }\n const valueInfo = graph.nodeArgs(j)!.type()!.value(new ortFbs.TensorTypeAndShape())!;\n const type = ProtoUtil.tensorDataTypeFromProto(valueInfo.elemType());\n const shape = valueInfo.shape()!;\n const dims = [];\n for (let k = 0; k < shape.dimLength()!; k++) {\n dims.push(LongUtil.longToNumber(shape.dim(k)!.value()!.dimValue()!));\n }\n value.type = {shape: {dims}, tensorType: type};\n const currentIndex = this._allData.push(value) - 1;\n dataIndices.set(inputName, currentIndex);\n inputValueNames.push(inputName);\n }\n }\n }\n // check initializers\n for (let i = 0; i < graph.initializersLength(); i++) {\n const initializer = graph.initializers(i)!;\n let index = dataIndices.get(initializer.name()!);\n if (index === undefined) {\n const value = new Value();\n const dims = ProtoUtil.tensorDimsFromORTFormat(initializer);\n const type = ProtoUtil.tensorDataTypeFromProto(initializer.dataType());\n value.type = {shape: {dims}, tensorType: type};\n index = this._allData.push(value) - 1;\n dataIndices.set(initializer.name()!, index);\n }\n this._allData[index]._from = -1;\n this._allData[index].tensor = Tensor.fromOrtTensor(initializer);\n }\n\n // filter out input indices\n for (let i = 0; i < this._allData.length; i++) {\n if (!this._allData[i].tensor) {\n this._allInputIndices.push(i);\n this._allInputNames.push(inputValueNames[i]);\n }\n }\n\n // scan all outputs\n for (let i = 0; i < graph.outputsLength(); i++) {\n const outputName = graph.outputs(i);\n if (dataIndices.has(outputName)) {\n throw new Error(`duplicated output name: ${outputName}`);\n }\n const currentIndex = this._allData.push(new Value()) - 1;\n dataIndices.set(outputName, currentIndex);\n this._allOutputIndices.push(currentIndex);\n this._allOutputNames.push(outputName);\n }\n\n // scan all nodes\n if (!graph.nodes) {\n throw new Error('missing information in graph: node');\n }\n for (let i = 0; i < graph.nodesLength(); i++) {\n const nodeProto = graph.nodes(i);\n let name = nodeProto!.name();\n if (!name) {\n // assign a name to the node if it doesn't have one\n for (let pick = 0;; pick++) {\n name = `unnamed_${nodeProto!.opType()}_${pick}`;\n if (!nodesIndices.has(name)) {\n // an unique name is found. break.\n break;\n }\n }\n }\n\n if (nodesIndices.has(name)) {\n throw new Error(`duplicated node name: ${name}`);\n }\n const currentIndex = this._nodes.push(new Node(nodeProto!, name)) - 1;\n nodesIndices.set(name, currentIndex);\n }\n\n // scan node's outputs\n for (let i = 0; i < this._nodes.length; i++) {\n const node = this._nodes[i];\n const nodeProto = graph.nodes(i);\n if (nodeProto == null) {\n throw new Error(`No node exists at index ${i}`);\n }\n if (nodeProto?.outputsLength() === 0) {\n throw new Error(`missing output for node: ${nodeProto.name}`);\n }\n for (let j = 0; j < nodeProto?.outputsLength(); j++) {\n const output = nodeProto?.outputs(j);\n let dataIndex = dataIndices.get(output);\n if (typeof dataIndex === 'undefined') {\n dataIndex = this._allData.push(new Value()) - 1;\n dataIndices.set(output, dataIndex);\n }\n node.outputs.push(dataIndex);\n\n if (this._allData[dataIndex]._from !== undefined) {\n throw new Error(`multiple nodes output to one data value: ${dataIndex}`);\n }\n this._allData[dataIndex]._from = i;\n\n // for the 'Constant' operator, just create a new edge in the graph corresponding to the 'output' of the\n // operator and ignore the node from the graph\n if (nodeProto.opType() === 'Constant') {\n if (nodeProto.attributesLength() !== 1 || !nodeProto.attributes(0)!.t()) {\n throw new Error('missing attributes or missing tensor value in attributes for this Constant operator');\n }\n if (nodeProto.outputsLength() !== 1) {\n throw new Error('missing output or incorrect number of outputs for this Constant operator');\n }\n node.outputs.pop();\n node.executeNode = false;\n\n this._allData[dataIndex]._from = -1;\n this._allData[dataIndex].tensor = Tensor.fromOrtTensor(nodeProto.attributes(0)!.t()!);\n }\n }\n }\n\n // scan node's inputs\n for (let i = 0; i < this._nodes.length; i++) {\n const node = this._nodes[i];\n const nodeProto = graph.nodes(i)!;\n\n if (nodeProto.inputsLength() === 0) {\n throw new Error(`missing input for node: ${nodeProto.name}`);\n }\n for (let j = 0; j < nodeProto.inputsLength()!; j++) {\n const input = nodeProto.inputs(j)!;\n const dataIndex = dataIndices.get(input);\n if (typeof dataIndex === 'undefined') {\n throw new Error(`unrecognized input '${input}' for node: ${nodeProto!.name()}`);\n }\n node.inputs.push(dataIndex);\n\n this._allData[dataIndex]._to.push(i);\n }\n }\n }\n\n private checkIsAcyclic() {\n // go through the graph and check for cycles or other fatal inconsistencies\n const starters: Set = new Set();\n this._allInputIndices.forEach(i => {\n const data = this._allData[i];\n data._to.forEach(j => {\n starters.add(j);\n });\n });\n\n // Iterative DFS to check for cycles\n const nodesStack = Array.from(starters);\n const nodesState = new Array(this._nodes.length).fill('white');\n\n while (nodesStack.length > 0) {\n const nodeIndex = nodesStack.pop()!;\n // this node has now been processed completely. Mark this node 'black' to denote this.\n if (nodesState[nodeIndex] === 'gray') {\n nodesState[nodeIndex] = 'black';\n } else {\n // this node is under processing stage. mark this node 'gray' to denote this.\n nodesStack.push(nodeIndex);\n nodesState[nodeIndex] = 'gray';\n\n this._nodes[nodeIndex].outputs.forEach((outgoingEdgeIndex) => {\n const data = this._allData[outgoingEdgeIndex];\n if (typeof data.tensor !== 'undefined') {\n throw new Error('node outputs should not be initialized');\n }\n if (data._from !== nodeIndex) {\n throw new Error('from property of the Value object doesn\\'t match index of Node being processed');\n }\n data._to.forEach((downstreamNodeIndex) => {\n // back edge found - cyclic\n if (nodesState[downstreamNodeIndex] === 'gray') {\n throw new Error('model graph is cyclic');\n }\n // tree edge found - continue processing by adding it to stack\n else if (nodesState[downstreamNodeIndex] === 'white') {\n nodesStack.push(downstreamNodeIndex);\n }\n });\n });\n }\n }\n }\n\n private transformGraph(graphInitializer?: Graph.Initializer): void {\n // apply common transform\n this.removeAllIdentityNodes();\n this.removeAllDropoutNodes();\n this.fuseConvActivationNodes();\n // apply initializer specific transform\n if (graphInitializer) {\n graphInitializer.transformGraph(this);\n }\n\n // finalize graph\n this.finalizeGraph();\n }\n\n /**\n * finalize the graph.\n *\n * this function should be called after all the transformation completed.\n * this function removes all unnecessary nodes and values from the graph\n */\n finalizeGraph() {\n let offset = 0;\n // delete all nodes that are not being executed\n // The graph is represented using these two arrays\n // this._nodes - Array holding the kernels to execute - each entry is a kernel pointing to this._allData\n // this._allData - hold 2 fields - to [] & from - these feileds hold the graph map for inputs and outputs per node\n // newIndices - remapping the graph after reading the flag 'executeNode'\n const newIndices = new Array(this._nodes.length, 0);\n let nodePossition = 0;\n\n for (let i = 0; i < this._nodes.length; i++) {\n // giving new indexes to the nodes based on execution flag\n newIndices[i] = nodePossition;\n if (this._nodes[i].executeNode) {\n if (nodePossition !== i) {\n this._nodes[nodePossition] = this._nodes[i];\n }\n nodePossition++;\n\n } else {\n // delete all output values\n this._nodes[i].outputs.forEach(ind => {\n this._allData[ind]._from = -2;\n });\n }\n }\n\n // removing the unused nodes\n this._nodes.splice(nodePossition, this._nodes.length - nodePossition);\n\n // Updating this._allData according to the new this._nodes\n for (let i = 0; i < this._allData.length; i++) {\n const currentData = this._allData[i];\n if (currentData._from !== undefined && currentData._from !== -1 && currentData._from !== -2) {\n currentData._from = newIndices[currentData._from];\n }\n\n for (let j = 0; j < currentData._to.length; j++) {\n if (currentData._to[j] >= 0) {\n currentData._to[j] = newIndices[currentData._to[j]];\n } else {\n throw new Error('Trying to update a removed node');\n }\n }\n }\n\n offset = 0;\n // delete all values that are not being referenced\n for (let i = 0; i < this._allData.length; i++) {\n // if current value is neither linked to next node, nor an output value, remove it.\n if (this._allData[i].from === -2 && this._allOutputIndices.indexOf(i + offset) === -1) {\n offset++;\n this._allData.splice(i, 1);\n i--;\n continue;\n }\n if (offset > 0) {\n let ind = -1;\n // if current value is neither an input value nor an initializer, find the node it's\n // coming from and update the corresponding node output\n if (this._allData[i].from !== undefined && this._allData[i].from !== -1) {\n ind = this._nodes[this._allData[i].from].outputs.indexOf(i + offset);\n if (ind !== -1) {\n this._nodes[this._allData[i].from].outputs[ind] = i;\n }\n } else {\n // if current value is an input value, update its reference in inputIndices\n ind = this._allInputIndices.indexOf(i + offset);\n if (ind !== -1) {\n this._allInputIndices[ind] = i;\n }\n }\n\n // find the node that the current value is linking to and update its input reference\n this._allData[i].to.forEach(node => {\n ind = this._nodes[node].inputs.indexOf(i + offset);\n if (ind !== -1) {\n this._nodes[node].inputs[ind] = i;\n }\n });\n if (this._allData[i].to.length === 0) {\n // if current value is a graph output, update its reference in outputIndices\n ind = this._allOutputIndices.indexOf(i + offset);\n if (ind !== -1) {\n this._allOutputIndices[ind] = i;\n }\n }\n }\n }\n }\n\n /**\n * Delete the specified node. Assume the node has one incoming input and the first output connected to other nodes.\n * An input validation must be done before calling this function.\n * @param nodeIndex The index of node to be deleted\n */\n private deleteNode(nodeIndex: number) {\n const node = this._nodes[nodeIndex];\n if (node.outputs.length > 1) {\n for (let i = 1; i < node.outputs.length; i++) {\n if (this._allData[node.outputs[i]].to.length > 0) {\n throw new Error('Node deletion with more than one output connected to other nodes is not supported. ');\n }\n }\n }\n\n // this node wil not be executed\n node.executeNode = false;\n const inputValueIndex = node.inputs[0];\n const outputValueIndex = node.outputs[0];\n const nodesConsumingOutput = this._allData[outputValueIndex].to;\n\n // remove this node from the to property of the input Value\n for (let i = 0; i < node.inputs.length; i++) {\n const delIndex = this._allData[node.inputs[i]].to.indexOf(nodeIndex);\n // should not happen\n if (delIndex === -1) {\n throw new Error('The Value object doesn\\'t have the current Node in it\\'s \\'to\\' property ');\n }\n this._allData[node.inputs[i]].to.splice(delIndex, 1);\n }\n\n // clear node indices consuming this output Value\n this._allData[outputValueIndex]._to = [];\n\n // if the output of this node is a graph output, adjust the index appropriately\n const index = this._allOutputIndices.indexOf(outputValueIndex);\n if (index !== -1) {\n this._allOutputIndices[index] = inputValueIndex;\n }\n\n // override the inputs for nodes consuming this node's output with the input to this node\n if (nodesConsumingOutput && nodesConsumingOutput.length > 0) {\n for (const nodeIndex of nodesConsumingOutput) {\n const replaceIndex = this._nodes[nodeIndex].inputs.indexOf(outputValueIndex);\n // should not happen\n if (replaceIndex === -1) {\n throw new Error('The Node object doesn\\'t have the output Value in it\\'s \\'inputs\\' property ');\n }\n this._nodes[nodeIndex].inputs[replaceIndex] = inputValueIndex;\n this._allData[inputValueIndex].to.push(nodeIndex);\n }\n }\n }\n\n removeAllDropoutNodes() {\n let nodeIndex = 0;\n for (const node of this._nodes) {\n // weed out 'Dropout' nodes so that no time is wasted in execution\n if (node.opType === 'Dropout') {\n // the node should have exactly 1 input and 1 or 2 outputs\n if (node.inputs.length !== 1) {\n throw new Error('Dropout nodes should only contain one input. ');\n }\n if (node.outputs.length !== 1 && node.outputs.length !== 2) {\n throw new Error('Dropout nodes should contain either 1 or 2 output(s)');\n }\n // the second output should not be referenced by any other node\n if (node.outputs.length === 2 && this._allData[node.outputs[1]]._to.length !== 0) {\n throw new Error('Dropout nodes\\'s second output should not be referenced by other nodes');\n }\n this.deleteNode(nodeIndex);\n }\n nodeIndex++;\n }\n }\n\n removeAllIdentityNodes() {\n let nodeIndex = 0;\n for (const node of this._nodes) {\n // weed out 'Identity' nodes so that no time is wasted in execution\n if (node.opType === 'Identity') {\n this.deleteNode(nodeIndex);\n }\n nodeIndex++;\n }\n }\n\n isActivation(n: Node): boolean {\n switch (n.opType) {\n // TODO: add other activation methods\n case 'Relu':\n case 'Sigmoid':\n case 'Clip':\n return true;\n default:\n return false;\n }\n }\n\n fuseConvActivationNodes() {\n for (const node of this._nodes) {\n if (node.opType === 'Conv') {\n const next = this._allData[node.outputs[0]]._to;\n if (next.length === 1 && this.isActivation(this._nodes[next[0]])) {\n const child = this._nodes[next[0]];\n if (child.opType === 'Clip') {\n if (child.inputs.length === 1) {\n try {\n node.attributes.set(\n 'activation_params', 'floats',\n [child.attributes.getFloat('min'), child.attributes.getFloat('max')]);\n } catch (e) {\n node.attributes.set('activation_params', 'floats', [MIN_CLIP, MAX_CLIP]);\n }\n } else if (\n child.inputs.length >= 3 && this._allData[child.inputs[1]].tensor !== undefined &&\n this._allData[child.inputs[2]].tensor !== undefined) {\n node.attributes.set('activation_params', 'floats', [\n this._allData[child.inputs[1]].tensor!.floatData[0], this._allData[child.inputs[2]].tensor!.floatData[0]\n ]);\n } else {\n // Skip fusion with clip node since clip min and clip max are not coming from initializer\n continue;\n }\n }\n node.attributes.set('activation', 'string', (child.opType));\n this.deleteNode(next[0]);\n }\n }\n }\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {flatbuffers} from 'flatbuffers';\n\nimport {Graph} from './graph';\nimport {OpSet} from './opset';\nimport {onnxruntime} from './ort-schema/flatbuffers/ort-generated';\nimport {onnx} from './ort-schema/protobuf/onnx';\nimport {LongUtil} from './util';\n\nimport ortFbs = onnxruntime.experimental.fbs;\n\nexport class Model {\n // empty model\n constructor() {}\n\n load(buf: Uint8Array, graphInitializer?: Graph.Initializer, isOrtFormat?: boolean): void {\n let onnxError: Error|undefined;\n if (!isOrtFormat) {\n // isOrtFormat === false || isOrtFormat === undefined\n try {\n this.loadFromOnnxFormat(buf, graphInitializer);\n return;\n } catch (e) {\n if (isOrtFormat !== undefined) {\n throw e;\n }\n onnxError = e;\n }\n }\n\n try {\n this.loadFromOrtFormat(buf, graphInitializer);\n } catch (e) {\n if (isOrtFormat !== undefined) {\n throw e;\n }\n // Tried both formats and failed (when isOrtFormat === undefined)\n throw new Error(`Failed to load model as ONNX format: ${onnxError}\\nas ORT format: ${e}`);\n }\n }\n\n private loadFromOnnxFormat(buf: Uint8Array, graphInitializer?: Graph.Initializer): void {\n const modelProto = onnx.ModelProto.decode(buf);\n const irVersion = LongUtil.longToNumber(modelProto.irVersion);\n if (irVersion < 3) {\n throw new Error('only support ONNX model with IR_VERSION>=3');\n }\n\n this._opsets =\n modelProto.opsetImport.map(i => ({domain: i.domain as string, version: LongUtil.longToNumber(i.version!)}));\n\n this._graph = Graph.from(modelProto.graph!, graphInitializer);\n }\n\n private loadFromOrtFormat(buf: Uint8Array, graphInitializer?: Graph.Initializer): void {\n const fb = new flatbuffers.ByteBuffer(buf);\n const ortModel = ortFbs.InferenceSession.getRootAsInferenceSession(fb).model()!;\n const irVersion = LongUtil.longToNumber(ortModel.irVersion());\n if (irVersion < 3) {\n throw new Error('only support ONNX model with IR_VERSION>=3');\n }\n this._opsets = [];\n for (let i = 0; i < ortModel.opsetImportLength(); i++) {\n const opsetId = ortModel.opsetImport(i)!;\n this._opsets.push({domain: opsetId?.domain() as string, version: LongUtil.longToNumber(opsetId.version()!)});\n }\n\n this._graph = Graph.from(ortModel.graph()!, graphInitializer);\n }\n\n private _graph: Graph;\n get graph(): Graph {\n return this._graph;\n }\n\n private _opsets: OpSet[];\n get opsets(): readonly OpSet[] {\n return this._opsets;\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {resolveBackend, SessionHandlerType} from './backend';\nimport {ExecutionPlan} from './execution-plan';\nimport {Graph} from './graph';\nimport {Profiler} from './instrument';\nimport {Model} from './model';\nimport {Operator} from './operators';\nimport {Tensor} from './tensor';\n\nexport declare namespace Session {\n export interface Config {\n backendHint?: string;\n profiler?: Profiler.Config;\n }\n\n export interface Context {\n profiler: Readonly;\n graphInputTypes?: Tensor.DataType[];\n graphInputDims?: Array;\n }\n}\n\nexport class Session {\n constructor(config: Session.Config = {}) {\n this._initialized = false;\n this.backendHint = config.backendHint;\n this.profiler = Profiler.create(config.profiler);\n this.context = {profiler: this.profiler, graphInputTypes: [], graphInputDims: []};\n }\n\n get inputNames(): readonly string[] {\n return this._model.graph.getInputNames();\n }\n get outputNames(): readonly string[] {\n return this._model.graph.getOutputNames();\n }\n\n startProfiling() {\n this.profiler.start();\n }\n\n endProfiling() {\n this.profiler.stop();\n }\n\n async loadModel(uri: string): Promise;\n async loadModel(buffer: ArrayBuffer, byteOffset?: number, length?: number): Promise;\n async loadModel(buffer: Uint8Array): Promise;\n async loadModel(arg: string|ArrayBuffer|Uint8Array, byteOffset?: number, length?: number): Promise {\n await this.profiler.event('session', 'Session.loadModel', async () => {\n // resolve backend and session handler\n const backend = await resolveBackend(this.backendHint);\n this.sessionHandler = backend.createSessionHandler(this.context);\n\n this._model = new Model();\n if (typeof arg === 'string') {\n const isOrtFormat = arg.endsWith('.ort');\n if (typeof process !== 'undefined' && process.versions && process.versions.node) {\n // node\n const {readFile} = require('node:fs/promises');\n const buf = await readFile(arg);\n this.initialize(buf, isOrtFormat);\n } else {\n // browser\n const response = await fetch(arg);\n const buf = await response.arrayBuffer();\n this.initialize(new Uint8Array(buf), isOrtFormat);\n }\n } else if (!ArrayBuffer.isView(arg)) {\n // load model from ArrayBuffer\n const arr = new Uint8Array(arg, byteOffset || 0, length || arg.byteLength);\n this.initialize(arr);\n } else {\n // load model from Uint8array\n this.initialize(arg);\n }\n });\n }\n\n private initialize(modelProtoBlob: Uint8Array, isOrtFormat?: boolean): void {\n if (this._initialized) {\n throw new Error('already initialized');\n }\n\n this.profiler.event('session', 'Session.initialize', () => {\n // load graph\n const graphInitializer =\n this.sessionHandler.transformGraph ? this.sessionHandler as Graph.Initializer : undefined;\n this._model.load(modelProtoBlob, graphInitializer, isOrtFormat);\n\n // graph is completely initialzied at this stage , let the interested handlers know\n if (this.sessionHandler.onGraphInitialized) {\n this.sessionHandler.onGraphInitialized(this._model.graph);\n }\n // initialize each operator in the graph\n this.initializeOps(this._model.graph);\n\n // instantiate an ExecutionPlan object to be used by the Session object\n this._executionPlan = new ExecutionPlan(this._model.graph, this._ops, this.profiler);\n });\n\n this._initialized = true;\n }\n\n async run(inputs: Map|Tensor[]): Promise> {\n if (!this._initialized) {\n throw new Error('session not initialized yet');\n }\n\n return this.profiler.event('session', 'Session.run', async () => {\n const inputTensors = this.normalizeAndValidateInputs(inputs);\n\n const outputTensors = await this._executionPlan.execute(this.sessionHandler, inputTensors);\n\n return this.createOutput(outputTensors);\n });\n }\n\n private normalizeAndValidateInputs(inputs: Map|Tensor[]): Tensor[] {\n const modelInputNames = this._model.graph.getInputNames();\n\n // normalize inputs\n // inputs: Tensor[]\n if (Array.isArray(inputs)) {\n if (inputs.length !== modelInputNames.length) {\n throw new Error(`incorrect input array length: expected ${modelInputNames.length} but got ${inputs.length}`);\n }\n }\n // convert map to array\n // inputs: Map\n else {\n if (inputs.size !== modelInputNames.length) {\n throw new Error(`incorrect input map size: expected ${modelInputNames.length} but got ${inputs.size}`);\n }\n\n const sortedInputs = new Array(inputs.size);\n let sortedInputsIndex = 0;\n for (let i = 0; i < modelInputNames.length; ++i) {\n const tensor = inputs.get(modelInputNames[i]);\n if (!tensor) {\n throw new Error(`missing input tensor for: '${name}'`);\n }\n sortedInputs[sortedInputsIndex++] = tensor;\n }\n\n inputs = sortedInputs;\n }\n\n // validate dims requirements\n // First session run - graph input data is not cached for the session\n if (!this.context.graphInputTypes || this.context.graphInputTypes.length === 0 || !this.context.graphInputDims ||\n this.context.graphInputDims.length === 0) {\n const modelInputIndices = this._model.graph.getInputIndices();\n const modelValues = this._model.graph.getValues();\n\n const graphInputDims = new Array(modelInputIndices.length);\n\n for (let i = 0; i < modelInputIndices.length; ++i) {\n const graphInput = modelValues[modelInputIndices[i]];\n graphInputDims[i] = graphInput.type!.shape.dims;\n\n // cached for second and subsequent runs.\n // Some parts of the framework works on the assumption that the graph and types and shapes are static\n this.context.graphInputTypes!.push(graphInput.type!.tensorType);\n this.context.graphInputDims!.push(inputs[i].dims);\n }\n\n this.validateInputTensorDims(graphInputDims, inputs, true);\n }\n\n // Second and subsequent session runs - graph input data is cached for the session\n else {\n this.validateInputTensorDims(this.context.graphInputDims, inputs, false);\n }\n\n // validate types requirement\n this.validateInputTensorTypes(this.context.graphInputTypes!, inputs);\n\n return inputs;\n }\n\n private validateInputTensorTypes(graphInputTypes: Tensor.DataType[], givenInputs: Tensor[]) {\n for (let i = 0; i < givenInputs.length; i++) {\n const expectedType = graphInputTypes[i];\n const actualType = givenInputs[i].type;\n if (expectedType !== actualType) {\n throw new Error(`input tensor[${i}] check failed: expected type '${expectedType}' but got ${actualType}`);\n }\n }\n }\n\n private validateInputTensorDims(\n graphInputDims: Array, givenInputs: Tensor[], noneDimSupported: boolean) {\n for (let i = 0; i < givenInputs.length; i++) {\n const expectedDims = graphInputDims[i];\n const actualDims = givenInputs[i].dims;\n if (!this.compareTensorDims(expectedDims, actualDims, noneDimSupported)) {\n throw new Error(`input tensor[${i}] check failed: expected shape '[${expectedDims.join(',')}]' but got [${\n actualDims.join(',')}]`);\n }\n }\n }\n\n private compareTensorDims(expectedDims: readonly number[], actualDims: readonly number[], noneDimSupported: boolean):\n boolean {\n if (expectedDims.length !== actualDims.length) {\n return false;\n }\n\n for (let i = 0; i < expectedDims.length; ++i) {\n if (expectedDims[i] !== actualDims[i] && (!noneDimSupported || expectedDims[i] !== 0)) {\n // data shape mis-match AND not a 'None' dimension.\n return false;\n }\n }\n\n return true;\n }\n\n private createOutput(outputTensors: Tensor[]): Map {\n const modelOutputNames = this._model.graph.getOutputNames();\n if (outputTensors.length !== modelOutputNames.length) {\n throw new Error('expected number of outputs do not match number of generated outputs');\n }\n\n const output = new Map();\n for (let i = 0; i < modelOutputNames.length; ++i) {\n output.set(modelOutputNames[i], outputTensors[i]);\n }\n\n return output;\n }\n\n private initializeOps(graph: Graph): void {\n const nodes = graph.getNodes();\n this._ops = new Array(nodes.length);\n\n for (let i = 0; i < nodes.length; i++) {\n this._ops[i] = this.sessionHandler.resolve(nodes[i], this._model.opsets, graph);\n }\n }\n\n private _model: Model;\n private _initialized: boolean;\n\n private _ops: Operator[];\n private _executionPlan: ExecutionPlan;\n\n private backendHint?: string;\n\n private sessionHandler: SessionHandlerType;\n private context: Session.Context;\n private profiler: Readonly;\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {InferenceSession, InferenceSessionHandler, SessionHandler, Tensor} from 'onnxruntime-common';\n\nimport {Session} from './session';\nimport {Tensor as OnnxjsTensor} from './tensor';\n\nexport class OnnxjsSessionHandler implements InferenceSessionHandler {\n constructor(private session: Session) {\n this.inputNames = this.session.inputNames;\n this.outputNames = this.session.outputNames;\n }\n\n async dispose(): Promise {}\n inputNames: readonly string[];\n outputNames: readonly string[];\n async run(\n feeds: SessionHandler.FeedsType, _fetches: SessionHandler.FetchesType,\n _options: InferenceSession.RunOptions): Promise {\n const inputMap = new Map();\n for (const name in feeds) {\n if (Object.hasOwnProperty.call(feeds, name)) {\n const feed = feeds[name];\n inputMap.set(\n name,\n new OnnxjsTensor(\n feed.dims, feed.type as OnnxjsTensor.DataType, undefined, undefined,\n feed.data as OnnxjsTensor.NumberType));\n }\n }\n const outputMap = await this.session.run(inputMap);\n const output: SessionHandler.ReturnType = {};\n outputMap.forEach((tensor, name) => {\n output[name] = new Tensor(tensor.type, tensor.data, tensor.dims);\n });\n return output;\n }\n startProfiling(): void {\n this.session.startProfiling();\n }\n endProfiling(): void {\n this.session.endProfiling();\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\n/* eslint-disable import/no-internal-modules */\nimport {Backend, InferenceSession, InferenceSessionHandler} from 'onnxruntime-common';\n\nimport {Session} from './onnxjs/session';\nimport {OnnxjsSessionHandler} from './onnxjs/session-handler-inference';\n\nclass OnnxjsBackend implements Backend {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n async init(): Promise {}\n\n async createInferenceSessionHandler(pathOrBuffer: string|Uint8Array, options?: InferenceSession.SessionOptions):\n Promise {\n // NOTE: Session.Config(from onnx.js) is not compatible with InferenceSession.SessionOptions(from\n // onnxruntime-common).\n // In future we should remove Session.Config and use InferenceSession.SessionOptions.\n // Currently we allow this to happen to make test runner work.\n const session = new Session(options as unknown as Session.Config);\n\n // typescript cannot merge method override correctly (so far in 4.2.3). need if-else to call the method.\n if (typeof pathOrBuffer === 'string') {\n await session.loadModel(pathOrBuffer);\n } else {\n await session.loadModel(pathOrBuffer);\n }\n\n return new OnnxjsSessionHandler(session);\n }\n}\n\nexport const onnxjsBackend = new OnnxjsBackend();\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nexport const isNode = !!(typeof process !== 'undefined' && process.versions && process.versions.node);\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\n/// \n\n//\n// * type hack for \"HTMLImageElement\"\n//\n// in typescript, the type of \"HTMLImageElement\" is defined in lib.dom.d.ts, which is conflict with lib.webworker.d.ts.\n// when we use webworker, the lib.webworker.d.ts will be used, which does not have HTMLImageElement defined.\n//\n// we will get the following errors complaining that HTMLImageElement is not defined:\n//\n// ====================================================================================================================\n//\n// ../common/dist/cjs/tensor-factory.d.ts:187:29 - error TS2552: Cannot find name 'HTMLImageElement'. Did you mean\n// 'HTMLLIElement'?\n//\n// 187 fromImage(imageElement: HTMLImageElement, options?: TensorFromImageElementOptions):\n// Promise | TypedTensor<'uint8'>>;\n// ~~~~~~~~~~~~~~~~\n//\n// node_modules/@webgpu/types/dist/index.d.ts:83:7 - error TS2552: Cannot find name 'HTMLImageElement'. Did you mean\n// 'HTMLLIElement'?\n//\n// 83 | HTMLImageElement\n// ~~~~~~~~~~~~~~~~\n//\n// ====================================================================================================================\n//\n// `HTMLImageElement` is only used in type declaration and not in real code. So we define it as `unknown` here to\n// bypass the type check.\n\n//\n// * type hack for \"document\"\n//\n// in typescript, the type of \"document\" is defined in lib.dom.d.ts, so it's not available in webworker.\n//\n// we will get the following errors complaining that document is not defined:\n//\n// ====================================================================================================================\n//\n// lib/wasm/wasm-utils-import.ts:7:33 - error TS2584: Cannot find name 'document'. Do you need to change your target\n// library? Try changing the 'lib' compiler option to include 'dom'.\n//\n// 7 export const scriptSrc = typeof document !== 'undefined' ? (document?.currentScript as HTMLScriptElement)?.src :\n// ~~~~~~~~\n//\n// lib/wasm/wasm-utils-import.ts:7:61 - error TS2584: Cannot find name 'document'. Do you need to change your target\n// library? Try changing the 'lib' compiler option to include 'dom'.\n//\n// 7 export const scriptSrc = typeof document !== 'undefined' ? (document?.currentScript as HTMLScriptElement)?.src :\n// ~~~~~~~~\n//\n// lib/wasm/wasm-utils-import.ts:7:88 - error TS2552: Cannot find name 'HTMLScriptElement'. Did you mean\n// 'HTMLLIElement'?\n//\n// 7 export const scriptSrc = typeof document !== 'undefined' ? (document?.currentScript as HTMLScriptElement)?.src :\n// ~~~~~~~~~~~~~~~~~\n// ====================================================================================================================\n//\n// `document` is used to get the current script URL, which is not available in webworker. This file is served as a\n// \"dual\" file for entries of both webworker and the esm module.\n//\ndeclare global {\n type HTMLImageElement = unknown;\n type HTMLScriptElement = {src?: string};\n const document: undefined|{currentScript?: HTMLScriptElement};\n}\n\n/**\n * @summary\n *\n * This file is served as a \"dual\" file for both entries of the following:\n * - The proxy worker itself.\n * - When used as a worker, it listens to the messages from the main thread and performs the corresponding operations.\n * - Should be imported directly using `new Worker()` in the main thread.\n *\n * - The ESM module that creates the proxy worker (as a worker launcher).\n * - When used as a worker launcher, it creates the proxy worker and returns it.\n * - Should be imported using `import()` in the main thread, with the query parameter `import=1`.\n *\n * This file will be always compiling into ESM format.\n */\n\nimport type {OrtWasmMessage, SerializableTensorMetadata} from '../proxy-messages.js';\nimport {createSession, copyFromExternalBuffer, endProfiling, extractTransferableBuffers, initEp, initRuntime, releaseSession, run} from '../wasm-core-impl.js';\nimport {initializeWebAssembly} from '../wasm-factory.js';\nimport {scriptSrc} from '../wasm-utils-import.js';\n\nconst WORKER_NAME = 'ort-wasm-proxy-worker';\nconst isProxyWorker = globalThis.self?.name === WORKER_NAME;\n\nif (isProxyWorker) {\n // Worker thread\n self.onmessage = (ev: MessageEvent): void => {\n const {type, in : message} = ev.data;\n try {\n switch (type) {\n case 'init-wasm':\n initializeWebAssembly(message!.wasm)\n .then(\n () => {\n initRuntime(message!).then(\n () => {\n postMessage({type});\n },\n err => {\n postMessage({type, err});\n });\n },\n err => {\n postMessage({type, err});\n });\n break;\n case 'init-ep': {\n const {epName, env} = message!;\n initEp(env, epName)\n .then(\n () => {\n postMessage({type});\n },\n err => {\n postMessage({type, err});\n });\n break;\n }\n case 'copy-from': {\n const {buffer} = message!;\n const bufferData = copyFromExternalBuffer(buffer);\n postMessage({type, out: bufferData} as OrtWasmMessage);\n break;\n }\n case 'create': {\n const {model, options} = message!;\n createSession(model, options)\n .then(\n sessionMetadata => {\n postMessage({type, out: sessionMetadata} as OrtWasmMessage);\n },\n err => {\n postMessage({type, err});\n });\n break;\n }\n case 'release':\n releaseSession(message!);\n postMessage({type});\n break;\n case 'run': {\n const {sessionId, inputIndices, inputs, outputIndices, options} = message!;\n run(sessionId, inputIndices, inputs, outputIndices, new Array(outputIndices.length).fill(null), options)\n .then(\n outputs => {\n if (outputs.some(o => o[3] !== 'cpu')) {\n postMessage({type, err: 'Proxy does not support non-cpu tensor location.'});\n } else {\n postMessage(\n {type, out: outputs} as OrtWasmMessage,\n extractTransferableBuffers([...inputs, ...outputs] as SerializableTensorMetadata[]));\n }\n },\n err => {\n postMessage({type, err});\n });\n break;\n }\n case 'end-profiling':\n endProfiling(message!);\n postMessage({type});\n break;\n default:\n }\n } catch (err) {\n postMessage({type, err} as OrtWasmMessage);\n }\n };\n}\n\nexport default isProxyWorker ?\n null :\n (urlOverride?: string) =>\n new Worker(urlOverride ?? scriptSrc!, {type: BUILD_DEFS.IS_ESM ? 'module' : 'classic', name: WORKER_NAME});\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport type {OrtWasmModule} from './wasm-types';\nimport {isNode} from './wasm-utils-env';\n\n/**\n * The classic script source URL. This is not always available in non ESModule environments.\n *\n * In Node.js, this is undefined.\n */\nexport const scriptSrc =\n // if Nodejs, return undefined\n isNode ? undefined :\n // if It's ESM, use import.meta.url\n BUILD_DEFS.ESM_IMPORT_META_URL ??\n // use `document.currentScript.src` if available\n (typeof document !== 'undefined' ? (document.currentScript as HTMLScriptElement)?.src :\n // use `self.location.href` if available\n (typeof self !== 'undefined' ? self.location?.href : undefined));\n\n/**\n * The origin of the current location.\n *\n * In Node.js, this is undefined.\n */\nconst origin = isNode || typeof location === 'undefined' ? undefined : location.origin;\n\n/**\n * Check if the given filename with prefix is from the same origin.\n */\nconst isSameOrigin = (filename: string, prefixOverride?: string) => {\n try {\n const baseUrl = prefixOverride ?? scriptSrc;\n const url = baseUrl ? new URL(filename, baseUrl) : new URL(filename);\n return url.origin === origin;\n } catch {\n return false;\n }\n};\n\n/**\n * Normalize the inputs to an absolute URL with the given prefix override. If failed, return undefined.\n */\nconst normalizeUrl = (filename: string, prefixOverride?: string) => {\n const baseUrl = prefixOverride ?? scriptSrc;\n try {\n const url = baseUrl ? new URL(filename, baseUrl) : new URL(filename);\n return url.href;\n } catch {\n return undefined;\n }\n};\n\n/**\n * Create a fallback URL if an absolute URL cannot be created by the normalizeUrl function.\n */\nconst fallbackUrl = (filename: string, prefixOverride?: string) => `${prefixOverride ?? './'}${filename}`;\n\n/**\n * This helper function is used to preload a module from a URL.\n *\n * If the origin of the worker URL is different from the current origin, the worker cannot be loaded directly.\n * See discussions in https://github.com/webpack-contrib/worker-loader/issues/154\n *\n * In this case, we will fetch the worker URL and create a new Blob URL with the same origin as a workaround.\n *\n * @param absoluteUrl - The absolute URL to preload.\n *\n * @returns - A promise that resolves to a new Blob URL\n */\nconst preload = async(absoluteUrl: string): Promise => {\n const response = await fetch(absoluteUrl, {credentials: 'same-origin'});\n const blob = await response.blob();\n return URL.createObjectURL(blob);\n};\n\n/**\n * This helper function is used to dynamically import a module from a URL.\n *\n * The build script has special handling for this function to ensure that the URL is not bundled into the final output.\n *\n * @param url - The URL to import.\n *\n * @returns - A promise that resolves to the default export of the module.\n */\nconst dynamicImportDefault = async(url: string): Promise => (await import(/* webpackIgnore: true */ url)).default;\n\n/**\n * The proxy worker factory imported from the proxy worker module.\n *\n * This is only available when the WebAssembly proxy is not disabled.\n */\nconst createProxyWorker: ((urlOverride?: string) => Worker)|undefined =\n // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires\n BUILD_DEFS.DISABLE_WASM_PROXY ? undefined : require('./proxy-worker/main').default;\n\n/**\n * Import the proxy worker.\n *\n * This function will perform the following steps:\n * 1. If a preload is needed, it will preload the module and return the object URL.\n * 2. Use the proxy worker factory to create the proxy worker.\n *\n * @returns - A promise that resolves to a tuple of 2 elements:\n * - The object URL of the preloaded module, or undefined if no preload is needed.\n * - The proxy worker.\n */\nexport const importProxyWorker = async(): Promise<[undefined | string, Worker]> => {\n if (!scriptSrc) {\n throw new Error('Failed to load proxy worker: cannot determine the script source URL.');\n }\n\n // If the script source is from the same origin, we can use the embedded proxy module directly.\n if (isSameOrigin(scriptSrc)) {\n return [undefined, createProxyWorker!()];\n }\n\n // Otherwise, need to preload\n const url = await preload(scriptSrc);\n return [url, createProxyWorker!(url)];\n};\n\n/**\n * The embedded WebAssembly module.\n *\n * This is only available in ESM and when embedding is not disabled.\n */\nconst embeddedWasmModule: EmscriptenModuleFactory|undefined =\n BUILD_DEFS.IS_ESM && BUILD_DEFS.DISABLE_DYNAMIC_IMPORT ?\n // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires\n require(\n !BUILD_DEFS.DISABLE_TRAINING ? '../../dist/ort-training-wasm-simd-threaded.mjs' :\n !BUILD_DEFS.DISABLE_JSEP ? '../../dist/ort-wasm-simd-threaded.jsep.mjs' :\n '../../dist/ort-wasm-simd-threaded.mjs')\n .default :\n undefined;\n\n/**\n * Import the WebAssembly module.\n *\n * This function will perform the following steps:\n * 1. If BUILD_DEFS.DISABLE_DYNAMIC_IMPORT is true, use the embedded module.\n * 2. If a preload is needed, it will preload the module and return the object URL.\n * 3. Otherwise, it will perform a dynamic import of the module.\n *\n * @returns - A promise that resolves to a tuple of 2 elements:\n * - The object URL of the preloaded module, or undefined if no preload is needed.\n * - The default export of the module, which is a factory function to create the WebAssembly module.\n */\nexport const importWasmModule = async(\n urlOverride: string|undefined, prefixOverride: string|undefined,\n isMultiThreaded: boolean): Promise<[undefined | string, EmscriptenModuleFactory]> => {\n if (BUILD_DEFS.DISABLE_DYNAMIC_IMPORT) {\n return [undefined, embeddedWasmModule!];\n } else {\n const wasmModuleFilename = !BUILD_DEFS.DISABLE_TRAINING ? 'ort-training-wasm-simd-threaded.mjs' :\n !BUILD_DEFS.DISABLE_JSEP ? 'ort-wasm-simd-threaded.jsep.mjs' :\n 'ort-wasm-simd-threaded.mjs';\n const wasmModuleUrl = urlOverride ?? normalizeUrl(wasmModuleFilename, prefixOverride);\n // need to preload if all of the following conditions are met:\n // 1. not in Node.js.\n // - Node.js does not have the same origin policy for creating workers.\n // 2. multi-threaded is enabled.\n // - If multi-threaded is disabled, no worker will be created. So we don't need to preload the module.\n // 3. the absolute URL is available.\n // - If the absolute URL is failed to be created, the origin cannot be determined. In this case, we will not\n // preload the module.\n // 4. the worker URL is not from the same origin.\n // - If the worker URL is from the same origin, we can create the worker directly.\n const needPreload = !isNode && isMultiThreaded && wasmModuleUrl && !isSameOrigin(wasmModuleUrl, prefixOverride);\n const url = needPreload ? (await preload(wasmModuleUrl)) :\n (wasmModuleUrl ?? fallbackUrl(wasmModuleFilename, prefixOverride));\n return [needPreload ? url : undefined, await dynamicImportDefault>(url)];\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Env} from 'onnxruntime-common';\n\nimport type {OrtWasmModule} from './wasm-types';\nimport {importWasmModule} from './wasm-utils-import';\n\nlet wasm: OrtWasmModule|undefined;\nlet initialized = false;\nlet initializing = false;\nlet aborted = false;\n\nconst isMultiThreadSupported = (): boolean => {\n // If 'SharedArrayBuffer' is not available, WebAssembly threads will not work.\n if (typeof SharedArrayBuffer === 'undefined') {\n return false;\n }\n\n try {\n // Test for transferability of SABs (for browsers. needed for Firefox)\n // https://groups.google.com/forum/#!msg/mozilla.dev.platform/IHkBZlHETpA/dwsMNchWEQAJ\n if (typeof MessageChannel !== 'undefined') {\n new MessageChannel().port1.postMessage(new SharedArrayBuffer(1));\n }\n\n // Test for WebAssembly threads capability (for both browsers and Node.js)\n // This typed array is a WebAssembly program containing threaded instructions.\n return WebAssembly.validate(new Uint8Array([\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5,\n 4, 1, 3, 1, 1, 10, 11, 1, 9, 0, 65, 0, 254, 16, 2, 0, 26, 11\n ]));\n } catch (e) {\n return false;\n }\n};\n\nconst isSimdSupported = (): boolean => {\n try {\n // Test for WebAssembly SIMD capability (for both browsers and Node.js)\n // This typed array is a WebAssembly program containing SIMD instructions.\n\n // The binary data is generated from the following code by wat2wasm:\n //\n // (module\n // (type $t0 (func))\n // (func $f0 (type $t0)\n // (drop\n // (i32x4.dot_i16x8_s\n // (i8x16.splat\n // (i32.const 0))\n // (v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000)))))\n\n return WebAssembly.validate(new Uint8Array([\n 0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 10, 30, 1, 28, 0, 65, 0,\n 253, 15, 253, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 253, 186, 1, 26, 11\n ]));\n } catch (e) {\n return false;\n }\n};\n\nexport const initializeWebAssembly = async(flags: Env.WebAssemblyFlags): Promise => {\n if (initialized) {\n return Promise.resolve();\n }\n if (initializing) {\n throw new Error('multiple calls to \\'initializeWebAssembly()\\' detected.');\n }\n if (aborted) {\n throw new Error('previous call to \\'initializeWebAssembly()\\' failed.');\n }\n\n initializing = true;\n\n // wasm flags are already initialized\n const timeout = flags.initTimeout!;\n let numThreads = flags.numThreads!;\n\n // ensure SIMD is supported\n if (!isSimdSupported()) {\n throw new Error('WebAssembly SIMD is not supported in the current environment.');\n }\n\n // check if multi-threading is supported\n const multiThreadSupported = isMultiThreadSupported();\n if (numThreads > 1 && !multiThreadSupported) {\n if (typeof self !== 'undefined' && !self.crossOriginIsolated) {\n // eslint-disable-next-line no-console\n console.warn(\n 'env.wasm.numThreads is set to ' + numThreads +\n ', but this will not work unless you enable crossOriginIsolated mode. ' +\n 'See https://web.dev/cross-origin-isolation-guide/ for more info.');\n }\n\n // eslint-disable-next-line no-console\n console.warn(\n 'WebAssembly multi-threading is not supported in the current environment. ' +\n 'Falling back to single-threading.');\n\n // set flags.numThreads to 1 so that OrtInit() will not create a global thread pool.\n flags.numThreads = numThreads = 1;\n }\n\n const wasmPaths = flags.wasmPaths;\n const wasmPrefixOverride = typeof wasmPaths === 'string' ? wasmPaths : undefined;\n const mjsPathOverrideFlag = (wasmPaths as Env.WasmFilePaths)?.mjs;\n const mjsPathOverride = (mjsPathOverrideFlag as URL)?.href ?? mjsPathOverrideFlag;\n const wasmPathOverrideFlag = (wasmPaths as Env.WasmFilePaths)?.wasm;\n const wasmPathOverride = (wasmPathOverrideFlag as URL)?.href ?? wasmPathOverrideFlag;\n const wasmBinaryOverride = flags.wasmBinary;\n\n const [objectUrl, ortWasmFactory] = (await importWasmModule(mjsPathOverride, wasmPrefixOverride, numThreads > 1));\n\n let isTimeout = false;\n\n const tasks: Array> = [];\n\n // promise for timeout\n if (timeout > 0) {\n tasks.push(new Promise((resolve) => {\n setTimeout(() => {\n isTimeout = true;\n resolve();\n }, timeout);\n }));\n }\n\n // promise for module initialization\n tasks.push(new Promise((resolve, reject) => {\n const config: Partial = {\n /**\n * The number of threads. WebAssembly will create (Module.numThreads - 1) workers. If it is 1, no worker will be\n * created.\n */\n numThreads,\n };\n\n if (wasmBinaryOverride) {\n /**\n * Set a custom buffer which contains the WebAssembly binary. This will skip the wasm file fetching.\n */\n config.wasmBinary = wasmBinaryOverride;\n } else if (wasmPathOverride || wasmPrefixOverride) {\n /**\n * A callback function to locate the WebAssembly file. The function should return the full path of the file.\n *\n * Since Emscripten 3.1.58, this function is only called for the .wasm file.\n */\n config.locateFile = (fileName, scriptDirectory) =>\n wasmPathOverride ?? (wasmPrefixOverride ?? scriptDirectory) + fileName;\n }\n\n ortWasmFactory(config).then(\n // wasm module initialized successfully\n module => {\n initializing = false;\n initialized = true;\n wasm = module;\n resolve();\n if (objectUrl) {\n URL.revokeObjectURL(objectUrl);\n }\n },\n // wasm module failed to initialize\n (what) => {\n initializing = false;\n aborted = true;\n reject(what);\n });\n }));\n\n await Promise.race(tasks);\n\n if (isTimeout) {\n throw new Error(`WebAssembly backend initializing failed due to timeout: ${timeout}ms`);\n }\n};\n\nexport const getInstance = (): OrtWasmModule => {\n if (initialized && wasm) {\n return wasm;\n }\n\n throw new Error('WebAssembly is not initialized yet.');\n};\n\nexport const dispose = (): void => {\n if (initialized && !initializing && !aborted) {\n // TODO: currently \"PThread.terminateAllThreads()\" is not exposed in the wasm module.\n // And this function is not yet called by any code.\n // If it is needed in the future, we should expose it in the wasm module and uncomment the following line.\n\n // wasm?.PThread?.terminateAllThreads();\n wasm = undefined;\n\n initializing = false;\n initialized = false;\n aborted = true;\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {getInstance} from './wasm-factory';\n\nexport const allocWasmString = (data: string, allocs: number[]): number => {\n const wasm = getInstance();\n\n const dataLength = wasm.lengthBytesUTF8(data) + 1;\n const dataOffset = wasm._malloc(dataLength);\n wasm.stringToUTF8(data, dataOffset, dataLength);\n allocs.push(dataOffset);\n\n return dataOffset;\n};\n\ninterface ExtraOptionsHandler {\n (name: string, value: string): void;\n}\n\nexport const iterateExtraOptions =\n (options: Record, prefix: string, seen: WeakSet>,\n handler: ExtraOptionsHandler): void => {\n if (typeof options == 'object' && options !== null) {\n if (seen.has(options)) {\n throw new Error('Circular reference in options');\n } else {\n seen.add(options);\n }\n }\n\n Object.entries(options).forEach(([key, value]) => {\n const name = (prefix) ? prefix + key : key;\n if (typeof value === 'object') {\n iterateExtraOptions(value as Record, name + '.', seen, handler);\n } else if (typeof value === 'string' || typeof value === 'number') {\n handler(name, value.toString());\n } else if (typeof value === 'boolean') {\n handler(name, (value) ? '1' : '0');\n } else {\n throw new Error(`Can't handle extra config type: ${typeof value}`);\n }\n });\n };\n\n/**\n * check web assembly API's last error and throw error if any error occurred.\n * @param message a message used when an error occurred.\n */\nexport const checkLastError = (message: string): void => {\n const wasm = getInstance();\n\n const stack = wasm.stackSave();\n try {\n const paramsOffset = wasm.stackAlloc(8);\n wasm._OrtGetLastError(paramsOffset, paramsOffset + 4);\n const errorCode = wasm.HEAP32[paramsOffset / 4];\n const errorMessagePointer = wasm.HEAPU32[paramsOffset / 4 + 1];\n const errorMessage = errorMessagePointer ? wasm.UTF8ToString(errorMessagePointer) : '';\n throw new Error(`${message} ERROR_CODE: ${errorCode}, ERROR_MESSAGE: ${errorMessage}`);\n } finally {\n wasm.stackRestore(stack);\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {InferenceSession} from 'onnxruntime-common';\n\nimport {getInstance} from './wasm-factory';\nimport {allocWasmString, checkLastError, iterateExtraOptions} from './wasm-utils';\n\nexport const setRunOptions = (options: InferenceSession.RunOptions): [number, number[]] => {\n const wasm = getInstance();\n let runOptionsHandle = 0;\n const allocs: number[] = [];\n\n const runOptions: InferenceSession.RunOptions = options || {};\n\n try {\n if (options?.logSeverityLevel === undefined) {\n runOptions.logSeverityLevel = 2; // Default to warning\n } else if (\n typeof options.logSeverityLevel !== 'number' || !Number.isInteger(options.logSeverityLevel) ||\n options.logSeverityLevel < 0 || options.logSeverityLevel > 4) {\n throw new Error(`log serverity level is not valid: ${options.logSeverityLevel}`);\n }\n\n if (options?.logVerbosityLevel === undefined) {\n runOptions.logVerbosityLevel = 0; // Default to 0\n } else if (typeof options.logVerbosityLevel !== 'number' || !Number.isInteger(options.logVerbosityLevel)) {\n throw new Error(`log verbosity level is not valid: ${options.logVerbosityLevel}`);\n }\n\n if (options?.terminate === undefined) {\n runOptions.terminate = false;\n }\n\n let tagDataOffset = 0;\n if (options?.tag !== undefined) {\n tagDataOffset = allocWasmString(options.tag, allocs);\n }\n\n runOptionsHandle = wasm._OrtCreateRunOptions(\n runOptions.logSeverityLevel!, runOptions.logVerbosityLevel!, !!runOptions.terminate!, tagDataOffset);\n if (runOptionsHandle === 0) {\n checkLastError('Can\\'t create run options.');\n }\n\n if (options?.extra !== undefined) {\n iterateExtraOptions(options.extra, '', new WeakSet>(), (key, value) => {\n const keyDataOffset = allocWasmString(key, allocs);\n const valueDataOffset = allocWasmString(value, allocs);\n\n if (wasm._OrtAddRunConfigEntry(runOptionsHandle, keyDataOffset, valueDataOffset) !== 0) {\n checkLastError(`Can't set a run config entry: ${key} - ${value}.`);\n }\n });\n }\n\n return [runOptionsHandle, allocs];\n } catch (e) {\n if (runOptionsHandle !== 0) {\n wasm._OrtReleaseRunOptions(runOptionsHandle);\n }\n allocs.forEach(alloc => wasm._free(alloc));\n throw e;\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {InferenceSession} from 'onnxruntime-common';\n\nimport {getInstance} from './wasm-factory';\nimport {allocWasmString, checkLastError, iterateExtraOptions} from './wasm-utils';\n\nconst getGraphOptimzationLevel = (graphOptimizationLevel: string|unknown): number => {\n switch (graphOptimizationLevel) {\n case 'disabled':\n return 0;\n case 'basic':\n return 1;\n case 'extended':\n return 2;\n case 'all':\n return 99;\n default:\n throw new Error(`unsupported graph optimization level: ${graphOptimizationLevel}`);\n }\n};\n\nconst getExecutionMode = (executionMode: 'sequential'|'parallel'): number => {\n switch (executionMode) {\n case 'sequential':\n return 0;\n case 'parallel':\n return 1;\n default:\n throw new Error(`unsupported execution mode: ${executionMode}`);\n }\n};\n\nconst appendDefaultOptions = (options: InferenceSession.SessionOptions): void => {\n if (!options.extra) {\n options.extra = {};\n }\n if (!options.extra.session) {\n options.extra.session = {};\n }\n const session = options.extra.session as Record;\n if (!session.use_ort_model_bytes_directly) {\n // eslint-disable-next-line camelcase\n session.use_ort_model_bytes_directly = '1';\n }\n\n // if using JSEP with WebGPU, always disable memory pattern\n if (options.executionProviders &&\n options.executionProviders.some(ep => (typeof ep === 'string' ? ep : ep.name) === 'webgpu')) {\n options.enableMemPattern = false;\n }\n};\n\nconst setExecutionProviders =\n (sessionOptionsHandle: number, executionProviders: readonly InferenceSession.ExecutionProviderConfig[],\n allocs: number[]): void => {\n for (const ep of executionProviders) {\n let epName = typeof ep === 'string' ? ep : ep.name;\n\n // check EP name\n switch (epName) {\n case 'webnn':\n epName = 'WEBNN';\n if (typeof ep !== 'string') {\n const webnnOptions = ep as InferenceSession.WebNNExecutionProviderOption;\n // const context = (webnnOptions as InferenceSession.WebNNOptionsWithMLContext)?.context;\n const deviceType = (webnnOptions as InferenceSession.WebNNContextOptions)?.deviceType;\n if (deviceType) {\n const keyDataOffset = allocWasmString('deviceType', allocs);\n const valueDataOffset = allocWasmString(deviceType, allocs);\n if (getInstance()._OrtAddSessionConfigEntry(sessionOptionsHandle, keyDataOffset, valueDataOffset) !==\n 0) {\n checkLastError(`Can't set a session config entry: 'deviceType' - ${deviceType}.`);\n }\n }\n }\n break;\n case 'webgpu':\n epName = 'JS';\n if (typeof ep !== 'string') {\n const webgpuOptions = ep as InferenceSession.WebGpuExecutionProviderOption;\n if (webgpuOptions?.preferredLayout) {\n if (webgpuOptions.preferredLayout !== 'NCHW' && webgpuOptions.preferredLayout !== 'NHWC') {\n throw new Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${webgpuOptions.preferredLayout}`);\n }\n const keyDataOffset = allocWasmString('preferredLayout', allocs);\n const valueDataOffset = allocWasmString(webgpuOptions.preferredLayout, allocs);\n if (getInstance()._OrtAddSessionConfigEntry(sessionOptionsHandle, keyDataOffset, valueDataOffset) !==\n 0) {\n checkLastError(\n `Can't set a session config entry: 'preferredLayout' - ${webgpuOptions.preferredLayout}.`);\n }\n }\n }\n break;\n case 'wasm':\n case 'cpu':\n continue;\n default:\n throw new Error(`not supported execution provider: ${epName}`);\n }\n\n const epNameDataOffset = allocWasmString(epName, allocs);\n if (getInstance()._OrtAppendExecutionProvider(sessionOptionsHandle, epNameDataOffset) !== 0) {\n checkLastError(`Can't append execution provider: ${epName}.`);\n }\n }\n };\n\nexport const setSessionOptions = (options?: InferenceSession.SessionOptions): [number, number[]] => {\n const wasm = getInstance();\n let sessionOptionsHandle = 0;\n const allocs: number[] = [];\n\n const sessionOptions: InferenceSession.SessionOptions = options || {};\n appendDefaultOptions(sessionOptions);\n\n try {\n const graphOptimizationLevel = getGraphOptimzationLevel(sessionOptions.graphOptimizationLevel ?? 'all');\n const executionMode = getExecutionMode(sessionOptions.executionMode ?? 'sequential');\n const logIdDataOffset =\n typeof sessionOptions.logId === 'string' ? allocWasmString(sessionOptions.logId, allocs) : 0;\n\n const logSeverityLevel = sessionOptions.logSeverityLevel ?? 2; // Default to 2 - warning\n if (!Number.isInteger(logSeverityLevel) || logSeverityLevel < 0 || logSeverityLevel > 4) {\n throw new Error(`log serverity level is not valid: ${logSeverityLevel}`);\n }\n\n const logVerbosityLevel = sessionOptions.logVerbosityLevel ?? 0; // Default to 0 - verbose\n if (!Number.isInteger(logVerbosityLevel) || logVerbosityLevel < 0 || logVerbosityLevel > 4) {\n throw new Error(`log verbosity level is not valid: ${logVerbosityLevel}`);\n }\n\n const optimizedModelFilePathOffset = typeof sessionOptions.optimizedModelFilePath === 'string' ?\n allocWasmString(sessionOptions.optimizedModelFilePath, allocs) :\n 0;\n\n sessionOptionsHandle = wasm._OrtCreateSessionOptions(\n graphOptimizationLevel, !!sessionOptions.enableCpuMemArena, !!sessionOptions.enableMemPattern, executionMode,\n !!sessionOptions.enableProfiling, 0, logIdDataOffset, logSeverityLevel, logVerbosityLevel,\n optimizedModelFilePathOffset);\n if (sessionOptionsHandle === 0) {\n checkLastError('Can\\'t create session options.');\n }\n\n if (sessionOptions.executionProviders) {\n setExecutionProviders(sessionOptionsHandle, sessionOptions.executionProviders, allocs);\n }\n\n if (sessionOptions.enableGraphCapture !== undefined) {\n if (typeof sessionOptions.enableGraphCapture !== 'boolean') {\n throw new Error(`enableGraphCapture must be a boolean value: ${sessionOptions.enableGraphCapture}`);\n }\n const keyDataOffset = allocWasmString('enableGraphCapture', allocs);\n const valueDataOffset = allocWasmString(sessionOptions.enableGraphCapture.toString(), allocs);\n if (wasm._OrtAddSessionConfigEntry(sessionOptionsHandle, keyDataOffset, valueDataOffset) !== 0) {\n checkLastError(\n `Can't set a session config entry: 'enableGraphCapture' - ${sessionOptions.enableGraphCapture}.`);\n }\n }\n\n if (sessionOptions.freeDimensionOverrides) {\n for (const [name, value] of Object.entries(sessionOptions.freeDimensionOverrides)) {\n if (typeof name !== 'string') {\n throw new Error(`free dimension override name must be a string: ${name}`);\n }\n if (typeof value !== 'number' || !Number.isInteger(value) || value < 0) {\n throw new Error(`free dimension override value must be a non-negative integer: ${value}`);\n }\n const nameOffset = allocWasmString(name, allocs);\n if (wasm._OrtAddFreeDimensionOverride(sessionOptionsHandle, nameOffset, value) !== 0) {\n checkLastError(`Can't set a free dimension override: ${name} - ${value}.`);\n }\n }\n }\n\n if (sessionOptions.extra !== undefined) {\n iterateExtraOptions(sessionOptions.extra, '', new WeakSet>(), (key, value) => {\n const keyDataOffset = allocWasmString(key, allocs);\n const valueDataOffset = allocWasmString(value, allocs);\n\n if (wasm._OrtAddSessionConfigEntry(sessionOptionsHandle, keyDataOffset, valueDataOffset) !== 0) {\n checkLastError(`Can't set a session config entry: ${key} - ${value}.`);\n }\n });\n }\n\n return [sessionOptionsHandle, allocs];\n } catch (e) {\n if (sessionOptionsHandle !== 0) {\n wasm._OrtReleaseSessionOptions(sessionOptionsHandle);\n }\n allocs.forEach(alloc => wasm._free(alloc));\n throw e;\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Tensor} from 'onnxruntime-common';\n\n// a dummy type declaration for Float16Array in case any polyfill is available.\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-explicit-any\n const Float16Array: any;\n}\n\n// This file includes common definitions. They do NOT have dependency on the WebAssembly instance.\n\n/**\n * Copied from ONNX definition. Use this to drop dependency 'onnx_proto' to decrease compiled .js file size.\n */\nexport const enum DataType {\n undefined = 0,\n float = 1,\n uint8 = 2,\n int8 = 3,\n uint16 = 4,\n int16 = 5,\n int32 = 6,\n int64 = 7,\n string = 8,\n bool = 9,\n float16 = 10,\n double = 11,\n uint32 = 12,\n uint64 = 13,\n complex64 = 14,\n complex128 = 15,\n bfloat16 = 16\n}\n\n/**\n * Map string tensor data to enum value\n */\nexport const tensorDataTypeStringToEnum = (type: string): DataType => {\n switch (type) {\n case 'int8':\n return DataType.int8;\n case 'uint8':\n return DataType.uint8;\n case 'bool':\n return DataType.bool;\n case 'int16':\n return DataType.int16;\n case 'uint16':\n return DataType.uint16;\n case 'int32':\n return DataType.int32;\n case 'uint32':\n return DataType.uint32;\n case 'float16':\n return DataType.float16;\n case 'float32':\n return DataType.float;\n case 'float64':\n return DataType.double;\n case 'string':\n return DataType.string;\n case 'int64':\n return DataType.int64;\n case 'uint64':\n return DataType.uint64;\n\n default:\n throw new Error(`unsupported data type: ${type}`);\n }\n};\n\n/**\n * Map enum value to string tensor data\n */\nexport const tensorDataTypeEnumToString = (typeProto: DataType): Tensor.Type => {\n switch (typeProto) {\n case DataType.int8:\n return 'int8';\n case DataType.uint8:\n return 'uint8';\n case DataType.bool:\n return 'bool';\n case DataType.int16:\n return 'int16';\n case DataType.uint16:\n return 'uint16';\n case DataType.int32:\n return 'int32';\n case DataType.uint32:\n return 'uint32';\n case DataType.float16:\n return 'float16';\n case DataType.float:\n return 'float32';\n case DataType.double:\n return 'float64';\n case DataType.string:\n return 'string';\n case DataType.int64:\n return 'int64';\n case DataType.uint64:\n return 'uint64';\n\n default:\n throw new Error(`unsupported data type: ${typeProto}`);\n }\n};\n\n/**\n * get tensor element size in bytes by the given data type\n * @returns size in integer or undefined if the data type is not supported\n */\nexport const getTensorElementSize = (dateType: number): number|\n undefined => [undefined, 4, 1, 1, 2, 2, 4, 8, undefined, 1, 2, 8, 4, 8, undefined, undefined, undefined][dateType];\n\n/**\n * get typed array constructor by the given tensor type\n */\nexport const tensorTypeToTypedArrayConstructor = (type: Tensor.Type): Float32ArrayConstructor|Uint8ArrayConstructor|\n Int8ArrayConstructor|Uint16ArrayConstructor|Int16ArrayConstructor|Int32ArrayConstructor|BigInt64ArrayConstructor|\n Uint8ArrayConstructor|Float64ArrayConstructor|Uint32ArrayConstructor|BigUint64ArrayConstructor => {\n switch (type) {\n case 'float16':\n // allow Float16Array polyfill.\n return typeof Float16Array !== 'undefined' && Float16Array.from ? Float16Array : Uint16Array;\n case 'float32':\n return Float32Array;\n case 'uint8':\n return Uint8Array;\n case 'int8':\n return Int8Array;\n case 'uint16':\n return Uint16Array;\n case 'int16':\n return Int16Array;\n case 'int32':\n return Int32Array;\n case 'bool':\n return Uint8Array;\n case 'float64':\n return Float64Array;\n case 'uint32':\n return Uint32Array;\n case 'int64':\n return BigInt64Array;\n case 'uint64':\n return BigUint64Array;\n default:\n throw new Error(`unsupported type: ${type}`);\n }\n };\n\n/**\n * Map string log level to integer value\n */\nexport const logLevelStringToEnum = (logLevel?: 'verbose'|'info'|'warning'|'error'|'fatal'): number => {\n switch (logLevel) {\n case 'verbose':\n return 0;\n case 'info':\n return 1;\n case 'warning':\n return 2;\n case 'error':\n return 3;\n case 'fatal':\n return 4;\n default:\n throw new Error(`unsupported logging level: ${logLevel}`);\n }\n};\n\n/**\n * Check whether the given tensor type is supported by GPU buffer\n */\nexport const isGpuBufferSupportedType = (type: Tensor.Type): type is Tensor.GpuBufferDataTypes => type === 'float32' ||\n type === 'float16' || type === 'int32' || type === 'int64' || type === 'uint32' || type === 'uint8' ||\n type === 'bool';\n\n/**\n * Map string data location to integer value\n */\nexport const dataLocationStringToEnum = (location: Tensor.DataLocation): number => {\n switch (location) {\n case 'none':\n return 0;\n case 'cpu':\n return 1;\n case 'cpu-pinned':\n return 2;\n case 'texture':\n return 3;\n case 'gpu-buffer':\n return 4;\n default:\n throw new Error(`unsupported data location: ${location}`);\n }\n};\n\n/**\n * Map integer data location to string value\n */\nexport const dataLocationEnumToString = (location: number): Tensor.DataLocation|undefined =>\n (['none', 'cpu', 'cpu-pinned', 'texture', 'gpu-buffer'] as const)[location];\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {isNode} from './wasm-utils-env';\n\n/**\n * Load a file into a Uint8Array.\n *\n * @param file - the file to load. Can be a URL/path, a Blob, an ArrayBuffer, or a Uint8Array.\n * @returns a Uint8Array containing the file data.\n */\nexport const loadFile = async(file: string|Blob|ArrayBufferLike|Uint8Array): Promise => {\n if (typeof file === 'string') {\n if (isNode) {\n // load file into ArrayBuffer in Node.js\n try {\n const {readFile} = require('node:fs/promises');\n return new Uint8Array(await readFile(file));\n } catch (e) {\n if (e.code === 'ERR_FS_FILE_TOO_LARGE') {\n // file is too large, use fs.createReadStream instead\n const {createReadStream} = require('node:fs');\n const stream = createReadStream(file);\n const chunks: Uint8Array[] = [];\n for await (const chunk of stream) {\n chunks.push(chunk);\n }\n return new Uint8Array(Buffer.concat(chunks));\n }\n throw e;\n }\n } else {\n // load file into ArrayBuffer in browsers\n const response = await fetch(file);\n if (!response.ok) {\n throw new Error(`failed to load external data file: ${file}`);\n }\n const contentLengthHeader = response.headers.get('Content-Length');\n const fileSize = contentLengthHeader ? parseInt(contentLengthHeader, 10) : 0;\n if (fileSize < 1073741824 /* 1GB */) {\n // when Content-Length header is not set, we cannot determine the file size. We assume it is small enough to\n // load into memory.\n return new Uint8Array(await response.arrayBuffer());\n } else {\n // file is too large, use stream instead\n if (!response.body) {\n throw new Error(`failed to load external data file: ${file}, no response body.`);\n }\n const reader = response.body.getReader();\n\n let buffer;\n try {\n // try to create ArrayBuffer directly\n buffer = new ArrayBuffer(fileSize);\n } catch (e) {\n if (e instanceof RangeError) {\n // use WebAssembly Memory to allocate larger ArrayBuffer\n const pages = Math.ceil(fileSize / 65536);\n buffer = new WebAssembly.Memory({initial: pages, maximum: pages}).buffer;\n } else {\n throw e;\n }\n }\n\n let offset = 0;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const {done, value} = await reader.read();\n if (done) {\n break;\n }\n const chunkSize = value.byteLength;\n const chunk = new Uint8Array(buffer, offset, chunkSize);\n chunk.set(value);\n offset += chunkSize;\n }\n return new Uint8Array(buffer, 0, fileSize);\n }\n }\n\n } else if (file instanceof Blob) {\n return new Uint8Array(await file.arrayBuffer());\n } else if (file instanceof Uint8Array) {\n return file;\n } else {\n return new Uint8Array(file);\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\n// WebNN API currently does not have a TypeScript definition file. This file is a workaround with types generated from\n// WebNN API specification.\n// https://github.com/webmachinelearning/webnn/issues/677\n/// \n\nimport {Env, InferenceSession, Tensor} from 'onnxruntime-common';\n\nimport {SerializableInternalBuffer, SerializableSessionMetadata, SerializableTensorMetadata, TensorMetadata} from './proxy-messages';\nimport {setRunOptions} from './run-options';\nimport {setSessionOptions} from './session-options';\nimport {dataLocationStringToEnum, getTensorElementSize, isGpuBufferSupportedType, logLevelStringToEnum, tensorDataTypeEnumToString, tensorDataTypeStringToEnum, tensorTypeToTypedArrayConstructor} from './wasm-common';\nimport {getInstance} from './wasm-factory';\nimport {allocWasmString, checkLastError} from './wasm-utils';\nimport {loadFile} from './wasm-utils-load-file';\n\n// #region Initializations\n\n/**\n * There are 4 different \"initialization\" steps for ORT. They happen in different places and different time.\n *\n * 1. JavaScript initialization for onnxruntime-common and onnxruntime-web.\n * This is the first initialization step. In this step, onnxruntime-web calls onnxruntime-common's registerBackend()\n * function multiple times to register all the available backends. The backend registration is very fast. It only\n * registers the backend name with the uninitialized backend object. No heavy initialization is done in this step.\n * Refer to web/lib/index.ts for the backend registration.\n *\n * 2. WebAssembly artifact initialization.\n * This happens when any registered wasm backend is used for the first time (ie. `ort.InferenceSession.create()` or\n * `ort.TrainingSession.create()` is called). In this step, onnxruntime-web does the followings:\n * - create a proxy worker and make sure the proxy worker is ready to receive messages, if proxy is enabled.\n * - perform feature detection, locate correct WebAssembly artifact path and call the Emscripten generated\n * JavaScript code to initialize the WebAssembly runtime.\n * - if proxy is enabled, this step happens in the proxy worker using message 'init-wasm'.\n * - downloading the 'ort-wasm{...}.wasm' file is done in this step.\n * - if multi-thread is enabled, one or more webworker will be created to initialize the PThread threadpool.\n *\n * 3. ORT environment initialization.\n * This happens after step 2. In this step, onnxruntime-web performs ONNX Runtime environment initialization.\n * Function `_OrtInit()` is called in this step.\n * - if proxy is enabled, this step happens in the proxy worker using message 'init-ort'.\n * - logging level (ort.env.logLevel) and thread number (ort.env.wasm.numThreads) are set in this step.\n *\n * 4. Session initialization.\n * This happens when `ort.InferenceSession.create()` or `ort.TrainingSession.create()` is called. Unlike the first 3\n * steps (they only called once), this step will be done for each session. In this step, onnxruntime-web does the\n * followings:\n * If the parameter is a URL:\n * - download the model data from the URL.\n * - copy the model data to the WASM heap. (proxy: 'copy-from')\n * - dereference the model buffer. This step allows the original ArrayBuffer to be garbage collected.\n * - call `_OrtCreateSession()` to create the session. (proxy: 'create')\n *\n * If the parameter is a Uint8Array object:\n * - copy the model data to the WASM heap. (proxy: 'copy-from')\n * - call `_OrtCreateSession()` to create the session. (proxy: 'create')\n *\n *\n */\n\n/**\n * initialize ORT environment.\n *\n * @param numThreads SetGlobalIntraOpNumThreads(numThreads)\n * @param loggingLevel CreateEnv(static_cast(logging_level))\n */\nconst initOrt = (numThreads: number, loggingLevel: number): void => {\n const errorCode = getInstance()._OrtInit(numThreads, loggingLevel);\n if (errorCode !== 0) {\n checkLastError('Can\\'t initialize onnxruntime.');\n }\n};\n\n/**\n * initialize runtime environment.\n * @param env passed in the environment config object.\n */\nexport const initRuntime = async(env: Env): Promise => {\n // init ORT\n initOrt(env.wasm.numThreads!, logLevelStringToEnum(env.logLevel));\n};\n\n/**\n * perform EP specific initialization.\n *\n * @param env\n * @param epName\n */\nexport const initEp = async(env: Env, epName: string): Promise => {\n if (!BUILD_DEFS.DISABLE_JSEP) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires\n const initJsep = require('./jsep/init').init;\n\n if (epName === 'webgpu') {\n // perform WebGPU availability check\n if (typeof navigator === 'undefined' || !navigator.gpu) {\n throw new Error('WebGPU is not supported in current environment');\n }\n\n let adapter = env.webgpu.adapter as GPUAdapter | null;\n if (!adapter) {\n // if adapter is not set, request a new adapter.\n const powerPreference = env.webgpu.powerPreference;\n if (powerPreference !== undefined && powerPreference !== 'low-power' &&\n powerPreference !== 'high-performance') {\n throw new Error(`Invalid powerPreference setting: \"${powerPreference}\"`);\n }\n const forceFallbackAdapter = env.webgpu.forceFallbackAdapter;\n if (forceFallbackAdapter !== undefined && typeof forceFallbackAdapter !== 'boolean') {\n throw new Error(`Invalid forceFallbackAdapter setting: \"${forceFallbackAdapter}\"`);\n }\n adapter = await navigator.gpu.requestAdapter({powerPreference, forceFallbackAdapter});\n if (!adapter) {\n throw new Error(\n 'Failed to get GPU adapter. ' +\n 'You may need to enable flag \"--enable-unsafe-webgpu\" if you are using Chrome.');\n }\n } else {\n // if adapter is set, validate it.\n if (typeof adapter.limits !== 'object' || typeof adapter.features !== 'object' ||\n typeof adapter.requestDevice !== 'function') {\n throw new Error('Invalid GPU adapter set in `env.webgpu.adapter`. It must be a GPUAdapter object.');\n }\n }\n\n await initJsep('webgpu', getInstance(), env, adapter);\n }\n if (epName === 'webnn') {\n // perform WebNN availability check\n if (typeof navigator === 'undefined' || !(navigator as unknown as {ml: unknown}).ml) {\n throw new Error('WebNN is not supported in current environment');\n }\n\n await initJsep('webnn', getInstance(), env);\n }\n }\n};\n\n// #endregion Initializations\n\n/**\n * valid data locations for input/output tensors.\n */\ntype SupportedTensorDataLocationForInputOutput = 'cpu'|'cpu-pinned'|'gpu-buffer';\n\ntype IOBindingState = {\n /**\n * the handle of IO binding.\n */\n readonly handle: number;\n\n /**\n * the preferred location for each output tensor.\n *\n * value is one of 'cpu', 'cpu-pinned', 'gpu-buffer'.\n */\n readonly outputPreferredLocations: readonly SupportedTensorDataLocationForInputOutput[];\n\n /**\n * enum value of the preferred location for each output tensor.\n */\n readonly outputPreferredLocationsEncoded: readonly number[];\n};\n\n/**\n * tuple elements are: InferenceSession ID; inputNamesUTF8Encoded; outputNamesUTF8Encoded; bindingState\n */\ntype SessionMetadata = [\n inferenceSessionId: number, inputNamesUTF8Encoded: number[], outputNamesUTF8Encoded: number[],\n bindingState: IOBindingState|null, enableGraphCapture: boolean, inputOutputBound: boolean\n];\n\nconst activeSessions = new Map();\n\n/**\n * get the input/output count of the session.\n * @param sessionHandle the handle representing the session. should be non-zero.\n * @returns a tuple including 2 numbers, representing the input count and output count.\n */\nconst getSessionInputOutputCount = (sessionHandle: number): [number, number] => {\n const wasm = getInstance();\n const stack = wasm.stackSave();\n try {\n const dataOffset = wasm.stackAlloc(8);\n const errorCode = wasm._OrtGetInputOutputCount(sessionHandle, dataOffset, dataOffset + 4);\n if (errorCode !== 0) {\n checkLastError('Can\\'t get session input/output count.');\n }\n return [wasm.HEAP32[dataOffset / 4], wasm.HEAP32[dataOffset / 4 + 1]];\n } finally {\n wasm.stackRestore(stack);\n }\n};\n\n/**\n * allocate the memory and memcpy the external buffer.\n *\n * @param model - the external buffer containing the model data. Must not be the same buffer as the WASM heap.\n * @returns a 2-elements tuple - the pointer and size of the allocated buffer\n */\nexport const copyFromExternalBuffer = (model: Uint8Array): [number, number] => {\n const wasm = getInstance();\n const modelDataOffset = wasm._malloc(model.byteLength);\n if (modelDataOffset === 0) {\n throw new Error(`Can't create a session. failed to allocate a buffer of size ${model.byteLength}.`);\n }\n wasm.HEAPU8.set(model, modelDataOffset);\n return [modelDataOffset, model.byteLength];\n};\n\n/**\n * create an inference session from a model data buffer.\n *\n * @param modelData - either a Uint8Array object representing the model data, or a 2-elements tuple containing the\n * pointer and size of the model data buffer.\n * @param options an optional session options object.\n * @returns a 3-elements tuple containing [session handle, input names, output names]\n */\nexport const createSession = async(\n modelData: Uint8Array|SerializableInternalBuffer,\n options?: InferenceSession.SessionOptions): Promise => {\n let modelDataOffset: number, modelDataLength: number;\n const wasm = getInstance();\n\n if (Array.isArray(modelData)) {\n // if model data is an array, it must be a 2-elements tuple containing the pointer and size of the model data\n [modelDataOffset, modelDataLength] = modelData;\n } else if (modelData.buffer === wasm.HEAPU8.buffer) {\n // if model data uses the same buffer as the WASM heap, we don't need to copy it.\n [modelDataOffset, modelDataLength] = [modelData.byteOffset, modelData.byteLength];\n } else {\n // otherwise, copy the model data to the WASM heap.\n [modelDataOffset, modelDataLength] = copyFromExternalBuffer(modelData);\n }\n\n let sessionHandle = 0;\n let sessionOptionsHandle = 0;\n let ioBindingHandle = 0;\n let allocs: number[] = [];\n const inputNamesUTF8Encoded = [];\n const outputNamesUTF8Encoded = [];\n\n try {\n [sessionOptionsHandle, allocs] = setSessionOptions(options);\n\n if (options?.externalData && wasm.mountExternalData) {\n const loadingPromises = [];\n for (const file of options.externalData) {\n const path = typeof file === 'string' ? file : file.path;\n loadingPromises.push(loadFile(typeof file === 'string' ? file : file.data).then(data => {\n wasm.mountExternalData!(path, data);\n }));\n }\n\n // wait for all external data files to be loaded\n await Promise.all(loadingPromises);\n }\n\n for (const provider of options?.executionProviders ?? []) {\n const providerName = typeof provider === 'string' ? provider : provider.name;\n if (providerName === 'webnn') {\n if (wasm.currentContext) {\n throw new Error('WebNN execution provider is already set.');\n }\n if (typeof provider !== 'string') {\n const webnnOptions = provider as InferenceSession.WebNNExecutionProviderOption;\n const context = (webnnOptions as InferenceSession.WebNNOptionsWithMLContext)?.context;\n const gpuDevice = (webnnOptions as InferenceSession.WebNNOptionsWebGpu)?.gpuDevice;\n const deviceType = (webnnOptions as InferenceSession.WebNNContextOptions)?.deviceType;\n const numThreads = (webnnOptions as InferenceSession.WebNNContextOptions)?.numThreads;\n const powerPreference = (webnnOptions as InferenceSession.WebNNContextOptions)?.powerPreference;\n if (context) {\n wasm.currentContext = context as MLContext;\n } else if (gpuDevice) {\n wasm.currentContext = await navigator.ml.createContext(gpuDevice);\n } else {\n wasm.currentContext = await navigator.ml.createContext({deviceType, numThreads, powerPreference});\n }\n } else {\n wasm.currentContext = await navigator.ml.createContext();\n }\n break;\n }\n }\n\n sessionHandle = await wasm._OrtCreateSession(modelDataOffset, modelDataLength, sessionOptionsHandle);\n if (sessionHandle === 0) {\n checkLastError('Can\\'t create a session.');\n }\n\n // clear current MLContext after session creation\n if (wasm.currentContext) {\n wasm.currentContext = undefined;\n }\n\n const [inputCount, outputCount] = getSessionInputOutputCount(sessionHandle);\n\n const enableGraphCapture = !!options?.enableGraphCapture;\n\n const inputNames = [];\n const outputNames = [];\n const outputPreferredLocations: SupportedTensorDataLocationForInputOutput[] = [];\n for (let i = 0; i < inputCount; i++) {\n const name = wasm._OrtGetInputName(sessionHandle, i);\n if (name === 0) {\n checkLastError('Can\\'t get an input name.');\n }\n inputNamesUTF8Encoded.push(name);\n inputNames.push(wasm.UTF8ToString(name));\n }\n for (let i = 0; i < outputCount; i++) {\n const name = wasm._OrtGetOutputName(sessionHandle, i);\n if (name === 0) {\n checkLastError('Can\\'t get an output name.');\n }\n outputNamesUTF8Encoded.push(name);\n const nameString = wasm.UTF8ToString(name);\n outputNames.push(nameString);\n\n if (!BUILD_DEFS.DISABLE_JSEP) {\n if (enableGraphCapture && options?.preferredOutputLocation === undefined) {\n outputPreferredLocations.push('gpu-buffer');\n continue;\n }\n const location = typeof options?.preferredOutputLocation === 'string' ?\n options.preferredOutputLocation :\n options?.preferredOutputLocation?.[nameString] ?? 'cpu';\n if (location !== 'cpu' && location !== 'cpu-pinned' && location !== 'gpu-buffer') {\n throw new Error(`Not supported preferred output location: ${location}.`);\n }\n if (enableGraphCapture && location !== 'gpu-buffer') {\n throw new Error(`Not supported preferred output location: ${\n location}. Only 'gpu-buffer' location is supported when enableGraphCapture is true.`);\n }\n outputPreferredLocations.push(location);\n }\n }\n\n // use IO binding only when at least one output is preffered to be on GPU.\n let bindingState: IOBindingState|null = null;\n if (!BUILD_DEFS.DISABLE_JSEP && outputPreferredLocations.some(l => l === 'gpu-buffer')) {\n ioBindingHandle = wasm._OrtCreateBinding(sessionHandle);\n if (ioBindingHandle === 0) {\n checkLastError('Can\\'t create IO binding.');\n }\n\n bindingState = {\n handle: ioBindingHandle,\n outputPreferredLocations,\n outputPreferredLocationsEncoded: outputPreferredLocations.map(l => dataLocationStringToEnum(l)),\n };\n }\n\n activeSessions.set(\n sessionHandle,\n [sessionHandle, inputNamesUTF8Encoded, outputNamesUTF8Encoded, bindingState, enableGraphCapture, false]);\n return [sessionHandle, inputNames, outputNames];\n } catch (e) {\n inputNamesUTF8Encoded.forEach(buf => wasm._OrtFree(buf));\n outputNamesUTF8Encoded.forEach(buf => wasm._OrtFree(buf));\n\n if (ioBindingHandle !== 0) {\n wasm._OrtReleaseBinding(ioBindingHandle);\n }\n\n if (sessionHandle !== 0) {\n wasm._OrtReleaseSession(sessionHandle);\n }\n throw e;\n } finally {\n wasm._free(modelDataOffset);\n if (sessionOptionsHandle !== 0) {\n wasm._OrtReleaseSessionOptions(sessionOptionsHandle);\n }\n allocs.forEach(alloc => wasm._free(alloc));\n\n // unmount external data if necessary\n wasm.unmountExternalData?.();\n }\n};\n\nexport const releaseSession = (sessionId: number): void => {\n const wasm = getInstance();\n const session = activeSessions.get(sessionId);\n if (!session) {\n throw new Error(`cannot release session. invalid session id: ${sessionId}`);\n }\n const [sessionHandle, inputNamesUTF8Encoded, outputNamesUTF8Encoded, ioBindingState, enableGraphCapture] = session;\n\n if (ioBindingState) {\n if (enableGraphCapture) {\n wasm._OrtClearBoundOutputs(ioBindingState.handle);\n }\n wasm._OrtReleaseBinding(ioBindingState.handle);\n }\n\n wasm.jsepOnReleaseSession?.(sessionId);\n\n inputNamesUTF8Encoded.forEach(buf => wasm._OrtFree(buf));\n outputNamesUTF8Encoded.forEach(buf => wasm._OrtFree(buf));\n wasm._OrtReleaseSession(sessionHandle);\n activeSessions.delete(sessionId);\n};\n\nexport const prepareInputOutputTensor =\n (tensor: TensorMetadata|null, tensorHandles: number[], allocs: number[], sessionId: number, index: number,\n enableGraphCapture = false): void => {\n if (!tensor) {\n tensorHandles.push(0);\n return;\n }\n\n const wasm = getInstance();\n\n const dataType = tensor[0];\n const dims = tensor[1];\n const location = tensor[3];\n\n let rawData: number;\n let dataByteLength: number;\n\n if (dataType === 'string' && location === 'gpu-buffer') {\n throw new Error('String tensor is not supported on GPU.');\n }\n\n if (enableGraphCapture && location !== 'gpu-buffer') {\n throw new Error(\n `External buffer must be provided for input/output index ${index} when enableGraphCapture is true.`);\n }\n\n if (location === 'gpu-buffer') {\n const gpuBuffer = tensor[2].gpuBuffer as GPUBuffer;\n const elementSizeInBytes = getTensorElementSize(tensorDataTypeStringToEnum(dataType))!;\n dataByteLength = dims.reduce((a, b) => a * b, 1) * elementSizeInBytes;\n\n const registerBuffer = wasm.jsepRegisterBuffer;\n if (!registerBuffer) {\n throw new Error('Tensor location \"gpu-buffer\" is not supported without using WebGPU.');\n }\n rawData = registerBuffer(sessionId, index, gpuBuffer, dataByteLength);\n } else {\n const data = tensor[2];\n\n if (Array.isArray(data)) {\n // string tensor\n dataByteLength = 4 * data.length;\n rawData = wasm._malloc(dataByteLength);\n allocs.push(rawData);\n let dataIndex = rawData / 4;\n for (let i = 0; i < data.length; i++) {\n if (typeof data[i] !== 'string') {\n throw new TypeError(`tensor data at index ${i} is not a string`);\n }\n wasm.HEAPU32[dataIndex++] = allocWasmString(data[i], allocs);\n }\n } else {\n dataByteLength = data.byteLength;\n rawData = wasm._malloc(dataByteLength);\n allocs.push(rawData);\n wasm.HEAPU8.set(new Uint8Array(data.buffer, data.byteOffset, dataByteLength), rawData);\n }\n }\n\n const stack = wasm.stackSave();\n const dimsOffset = wasm.stackAlloc(4 * dims.length);\n try {\n let dimIndex = dimsOffset / 4;\n dims.forEach(d => wasm.HEAP32[dimIndex++] = d);\n const tensor = wasm._OrtCreateTensor(\n tensorDataTypeStringToEnum(dataType), rawData, dataByteLength, dimsOffset, dims.length,\n dataLocationStringToEnum(location));\n if (tensor === 0) {\n checkLastError(`Can't create tensor for input/output. session=${sessionId}, index=${index}.`);\n }\n tensorHandles.push(tensor);\n } finally {\n wasm.stackRestore(stack);\n }\n };\n\n/**\n * perform inference run\n */\nexport const run = async(\n sessionId: number, inputIndices: number[], inputTensors: TensorMetadata[], outputIndices: number[],\n outputTensors: Array, options: InferenceSession.RunOptions): Promise => {\n const wasm = getInstance();\n const session = activeSessions.get(sessionId);\n if (!session) {\n throw new Error(`cannot run inference. invalid session id: ${sessionId}`);\n }\n const sessionHandle = session[0];\n const inputNamesUTF8Encoded = session[1];\n const outputNamesUTF8Encoded = session[2];\n const ioBindingState = session[3];\n const enableGraphCapture = session[4];\n const inputOutputBound = session[5];\n\n const inputCount = inputIndices.length;\n const outputCount = outputIndices.length;\n\n let runOptionsHandle = 0;\n let runOptionsAllocs: number[] = [];\n\n const inputTensorHandles: number[] = [];\n const outputTensorHandles: number[] = [];\n const inputOutputAllocs: number[] = [];\n\n const beforeRunStack = wasm.stackSave();\n const inputValuesOffset = wasm.stackAlloc(inputCount * 4);\n const inputNamesOffset = wasm.stackAlloc(inputCount * 4);\n const outputValuesOffset = wasm.stackAlloc(outputCount * 4);\n const outputNamesOffset = wasm.stackAlloc(outputCount * 4);\n\n try {\n [runOptionsHandle, runOptionsAllocs] = setRunOptions(options);\n\n // create input tensors\n for (let i = 0; i < inputCount; i++) {\n prepareInputOutputTensor(\n inputTensors[i], inputTensorHandles, inputOutputAllocs, sessionId, inputIndices[i], enableGraphCapture);\n }\n\n // create output tensors\n for (let i = 0; i < outputCount; i++) {\n prepareInputOutputTensor(\n outputTensors[i], outputTensorHandles, inputOutputAllocs, sessionId, inputCount + outputIndices[i],\n enableGraphCapture);\n }\n\n let inputValuesIndex = inputValuesOffset / 4;\n let inputNamesIndex = inputNamesOffset / 4;\n let outputValuesIndex = outputValuesOffset / 4;\n let outputNamesIndex = outputNamesOffset / 4;\n for (let i = 0; i < inputCount; i++) {\n wasm.HEAPU32[inputValuesIndex++] = inputTensorHandles[i];\n wasm.HEAPU32[inputNamesIndex++] = inputNamesUTF8Encoded[inputIndices[i]];\n }\n for (let i = 0; i < outputCount; i++) {\n wasm.HEAPU32[outputValuesIndex++] = outputTensorHandles[i];\n wasm.HEAPU32[outputNamesIndex++] = outputNamesUTF8Encoded[outputIndices[i]];\n }\n\n if (!BUILD_DEFS.DISABLE_JSEP && ioBindingState && !inputOutputBound) {\n const {handle, outputPreferredLocations, outputPreferredLocationsEncoded} = ioBindingState;\n\n if (inputNamesUTF8Encoded.length !== inputCount) {\n throw new Error(`input count from feeds (${\n inputCount}) is expected to be always equal to model's input count (${inputNamesUTF8Encoded.length}).`);\n }\n\n // process inputs\n for (let i = 0; i < inputCount; i++) {\n const index = inputIndices[i];\n const errorCode = await wasm._OrtBindInput(handle, inputNamesUTF8Encoded[index], inputTensorHandles[i]);\n if (errorCode !== 0) {\n checkLastError(`Can't bind input[${i}] for session=${sessionId}.`);\n }\n }\n\n // process pre-allocated outputs\n for (let i = 0; i < outputCount; i++) {\n const index = outputIndices[i];\n const location = outputTensors[i]?.[3]; // undefined means output is not pre-allocated.\n\n if (location) {\n // output is pre-allocated. bind the tensor.\n const errorCode = wasm._OrtBindOutput(handle, outputNamesUTF8Encoded[index], outputTensorHandles[i], 0);\n if (errorCode !== 0) {\n checkLastError(`Can't bind pre-allocated output[${i}] for session=${sessionId}.`);\n }\n } else {\n // output is not pre-allocated. reset preferred location.\n const errorCode =\n wasm._OrtBindOutput(handle, outputNamesUTF8Encoded[index], 0, outputPreferredLocationsEncoded[index]);\n if (errorCode !== 0) {\n checkLastError(`Can't bind output[${i}] to ${outputPreferredLocations[i]} for session=${sessionId}.`);\n }\n }\n }\n activeSessions.set(\n sessionId,\n [sessionHandle, inputNamesUTF8Encoded, outputNamesUTF8Encoded, ioBindingState, enableGraphCapture, true]);\n }\n\n wasm.jsepOnRunStart?.(sessionHandle);\n let errorCode: number;\n if (!BUILD_DEFS.DISABLE_JSEP && ioBindingState) {\n errorCode = await wasm._OrtRunWithBinding(\n sessionHandle, ioBindingState.handle, outputCount, outputValuesOffset, runOptionsHandle);\n } else {\n errorCode = await wasm._OrtRun(\n sessionHandle, inputNamesOffset, inputValuesOffset, inputCount, outputNamesOffset, outputCount,\n outputValuesOffset, runOptionsHandle);\n }\n\n if (errorCode !== 0) {\n checkLastError('failed to call OrtRun().');\n }\n\n const output: TensorMetadata[] = [];\n\n for (let i = 0; i < outputCount; i++) {\n const tensor = wasm.HEAPU32[outputValuesOffset / 4 + i];\n if (tensor === outputTensorHandles[i]) {\n // output tensor is pre-allocated. no need to copy data.\n output.push(outputTensors[i]!);\n continue;\n }\n\n const beforeGetTensorDataStack = wasm.stackSave();\n // stack allocate 4 pointer value\n const tensorDataOffset = wasm.stackAlloc(4 * 4);\n\n let keepOutputTensor = false;\n let type: Tensor.Type|undefined, dataOffset = 0;\n try {\n const errorCode = wasm._OrtGetTensorData(\n tensor, tensorDataOffset, tensorDataOffset + 4, tensorDataOffset + 8, tensorDataOffset + 12);\n if (errorCode !== 0) {\n checkLastError(`Can't access output tensor data on index ${i}.`);\n }\n let tensorDataIndex = tensorDataOffset / 4;\n const dataType = wasm.HEAPU32[tensorDataIndex++];\n dataOffset = wasm.HEAPU32[tensorDataIndex++];\n const dimsOffset = wasm.HEAPU32[tensorDataIndex++];\n const dimsLength = wasm.HEAPU32[tensorDataIndex++];\n const dims = [];\n for (let i = 0; i < dimsLength; i++) {\n dims.push(wasm.HEAPU32[dimsOffset / 4 + i]);\n }\n wasm._OrtFree(dimsOffset);\n\n const size = dims.reduce((a, b) => a * b, 1);\n type = tensorDataTypeEnumToString(dataType);\n\n const preferredLocation = ioBindingState?.outputPreferredLocations[outputIndices[i]];\n\n if (type === 'string') {\n if (preferredLocation === 'gpu-buffer') {\n throw new Error('String tensor is not supported on GPU.');\n }\n const stringData: string[] = [];\n let dataIndex = dataOffset / 4;\n for (let i = 0; i < size; i++) {\n const offset = wasm.HEAPU32[dataIndex++];\n const maxBytesToRead = i === size - 1 ? undefined : wasm.HEAPU32[dataIndex] - offset;\n stringData.push(wasm.UTF8ToString(offset, maxBytesToRead));\n }\n output.push([type, dims, stringData, 'cpu']);\n } else {\n // If a certain output's preferred location is GPU but the tensor is empty, we still need to create a CPU\n // tensor for it. There is no mapping GPU buffer for an empty tensor.\n if (preferredLocation === 'gpu-buffer' && size > 0) {\n const getBuffer = wasm.jsepGetBuffer;\n if (!getBuffer) {\n throw new Error('preferredLocation \"gpu-buffer\" is not supported without using WebGPU.');\n }\n const gpuBuffer = getBuffer(dataOffset);\n const elementSize = getTensorElementSize(dataType);\n if (elementSize === undefined || !isGpuBufferSupportedType(type)) {\n throw new Error(`Unsupported data type: ${type}`);\n }\n\n // do not release the tensor right now. it will be released when user calls tensor.dispose().\n keepOutputTensor = true;\n\n output.push([\n type, dims, {\n gpuBuffer,\n download: wasm.jsepCreateDownloader!(gpuBuffer, size * elementSize, type),\n dispose: () => {\n wasm._OrtReleaseTensor(tensor);\n }\n },\n 'gpu-buffer'\n ]);\n } else {\n const typedArrayConstructor = tensorTypeToTypedArrayConstructor(type);\n const data = new typedArrayConstructor(size);\n new Uint8Array(data.buffer, data.byteOffset, data.byteLength)\n .set(wasm.HEAPU8.subarray(dataOffset, dataOffset + data.byteLength));\n output.push([type, dims, data, 'cpu']);\n }\n }\n } finally {\n wasm.stackRestore(beforeGetTensorDataStack);\n if (type === 'string' && dataOffset) {\n wasm._free(dataOffset);\n }\n if (!keepOutputTensor) {\n wasm._OrtReleaseTensor(tensor);\n }\n }\n }\n\n if (ioBindingState && !enableGraphCapture) {\n wasm._OrtClearBoundOutputs(ioBindingState.handle);\n activeSessions.set(\n sessionId,\n [sessionHandle, inputNamesUTF8Encoded, outputNamesUTF8Encoded, ioBindingState, enableGraphCapture, false]);\n }\n return output;\n } finally {\n wasm.stackRestore(beforeRunStack);\n\n inputTensorHandles.forEach(v => wasm._OrtReleaseTensor(v));\n outputTensorHandles.forEach(v => wasm._OrtReleaseTensor(v));\n inputOutputAllocs.forEach(p => wasm._free(p));\n\n if (runOptionsHandle !== 0) {\n wasm._OrtReleaseRunOptions(runOptionsHandle);\n }\n runOptionsAllocs.forEach(p => wasm._free(p));\n }\n};\n\n/**\n * end profiling\n */\nexport const endProfiling = (sessionId: number): void => {\n const wasm = getInstance();\n const session = activeSessions.get(sessionId);\n if (!session) {\n throw new Error('invalid session id');\n }\n const sessionHandle = session[0];\n\n // profile file name is not used yet, but it must be freed.\n const profileFileName = wasm._OrtEndProfiling(sessionHandle);\n if (profileFileName === 0) {\n checkLastError('Can\\'t get an profile file name.');\n }\n wasm._OrtFree(profileFileName);\n};\n\nexport const extractTransferableBuffers = (tensors: readonly SerializableTensorMetadata[]): ArrayBufferLike[] => {\n const buffers: ArrayBufferLike[] = [];\n for (const tensor of tensors) {\n const data = tensor[2];\n if (!Array.isArray(data) && 'buffer' in data) {\n buffers.push(data.buffer);\n }\n }\n return buffers;\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {env, InferenceSession} from 'onnxruntime-common';\n\nimport {OrtWasmMessage, SerializableInternalBuffer, SerializableSessionMetadata, SerializableTensorMetadata, TensorMetadata} from './proxy-messages';\nimport * as core from './wasm-core-impl';\nimport {initializeWebAssembly} from './wasm-factory';\nimport {importProxyWorker} from './wasm-utils-import';\n\nconst isProxy = (): boolean => !!env.wasm.proxy && typeof document !== 'undefined';\nlet proxyWorker: Worker|undefined;\nlet initializing = false;\nlet initialized = false;\nlet aborted = false;\nlet temporaryObjectUrl: string|undefined;\n\ntype PromiseCallbacks = [resolve: (result: T) => void, reject: (reason: unknown) => void];\nlet initWasmCallbacks: PromiseCallbacks;\nconst queuedCallbacks: Map>> = new Map();\n\nconst enqueueCallbacks = (type: OrtWasmMessage['type'], callbacks: PromiseCallbacks): void => {\n const queue = queuedCallbacks.get(type);\n if (queue) {\n queue.push(callbacks);\n } else {\n queuedCallbacks.set(type, [callbacks]);\n }\n};\n\nconst ensureWorker = (): void => {\n if (initializing || !initialized || aborted || !proxyWorker) {\n throw new Error('worker not ready');\n }\n};\n\nconst onProxyWorkerMessage = (ev: MessageEvent): void => {\n switch (ev.data.type) {\n case 'init-wasm':\n initializing = false;\n if (ev.data.err) {\n aborted = true;\n initWasmCallbacks[1](ev.data.err);\n } else {\n initialized = true;\n initWasmCallbacks[0]();\n }\n if (temporaryObjectUrl) {\n URL.revokeObjectURL(temporaryObjectUrl);\n temporaryObjectUrl = undefined;\n }\n break;\n case 'init-ep':\n case 'copy-from':\n case 'create':\n case 'release':\n case 'run':\n case 'end-profiling': {\n const callbacks = queuedCallbacks.get(ev.data.type)!;\n if (ev.data.err) {\n callbacks.shift()![1](ev.data.err);\n } else {\n callbacks.shift()![0](ev.data.out!);\n }\n break;\n }\n default:\n }\n};\n\n\nexport const initializeWebAssemblyAndOrtRuntime = async(): Promise => {\n if (initialized) {\n return;\n }\n if (initializing) {\n throw new Error('multiple calls to \\'initWasm()\\' detected.');\n }\n if (aborted) {\n throw new Error('previous call to \\'initWasm()\\' failed.');\n }\n\n initializing = true;\n\n if (!BUILD_DEFS.DISABLE_WASM_PROXY && isProxy()) {\n return new Promise((resolve, reject) => {\n proxyWorker?.terminate();\n\n void importProxyWorker().then(([objectUrl, worker]) => {\n try {\n proxyWorker = worker;\n proxyWorker.onerror = (ev: ErrorEvent) => reject(ev);\n proxyWorker.onmessage = onProxyWorkerMessage;\n initWasmCallbacks = [resolve, reject];\n const message: OrtWasmMessage = {type: 'init-wasm', in : env};\n proxyWorker.postMessage(message);\n temporaryObjectUrl = objectUrl;\n } catch (e) {\n reject(e);\n }\n }, reject);\n });\n\n } else {\n try {\n await initializeWebAssembly(env.wasm);\n await core.initRuntime(env);\n initialized = true;\n } catch (e) {\n aborted = true;\n throw e;\n } finally {\n initializing = false;\n }\n }\n};\n\nexport const initializeOrtEp = async(epName: string): Promise => {\n if (!BUILD_DEFS.DISABLE_WASM_PROXY && isProxy()) {\n ensureWorker();\n return new Promise((resolve, reject) => {\n enqueueCallbacks('init-ep', [resolve, reject]);\n const message: OrtWasmMessage = {type: 'init-ep', in : {epName, env}};\n proxyWorker!.postMessage(message);\n });\n } else {\n await core.initEp(env, epName);\n }\n};\n\nexport const copyFromExternalBuffer = async(buffer: Uint8Array): Promise => {\n if (!BUILD_DEFS.DISABLE_WASM_PROXY && isProxy()) {\n ensureWorker();\n return new Promise((resolve, reject) => {\n enqueueCallbacks('copy-from', [resolve, reject]);\n const message: OrtWasmMessage = {type: 'copy-from', in : {buffer}};\n proxyWorker!.postMessage(message, [buffer.buffer]);\n });\n } else {\n return core.copyFromExternalBuffer(buffer);\n }\n};\n\nexport const createSession =\n async(model: SerializableInternalBuffer|Uint8Array, options?: InferenceSession.SessionOptions):\n Promise => {\n if (!BUILD_DEFS.DISABLE_WASM_PROXY && isProxy()) {\n // check unsupported options\n if (options?.preferredOutputLocation) {\n throw new Error('session option \"preferredOutputLocation\" is not supported for proxy.');\n }\n ensureWorker();\n return new Promise((resolve, reject) => {\n enqueueCallbacks('create', [resolve, reject]);\n const message: OrtWasmMessage = {type: 'create', in : {model, options: {...options}}};\n const transferable: Transferable[] = [];\n if (model instanceof Uint8Array) {\n transferable.push(model.buffer);\n }\n proxyWorker!.postMessage(message, transferable);\n });\n } else {\n return core.createSession(model, options);\n }\n };\n\nexport const releaseSession = async(sessionId: number): Promise => {\n if (!BUILD_DEFS.DISABLE_WASM_PROXY && isProxy()) {\n ensureWorker();\n return new Promise((resolve, reject) => {\n enqueueCallbacks('release', [resolve, reject]);\n const message: OrtWasmMessage = {type: 'release', in : sessionId};\n proxyWorker!.postMessage(message);\n });\n } else {\n core.releaseSession(sessionId);\n }\n};\n\nexport const run = async(\n sessionId: number, inputIndices: number[], inputs: TensorMetadata[], outputIndices: number[],\n outputs: Array, options: InferenceSession.RunOptions): Promise => {\n if (!BUILD_DEFS.DISABLE_WASM_PROXY && isProxy()) {\n // check inputs location\n if (inputs.some(t => t[3] !== 'cpu')) {\n throw new Error('input tensor on GPU is not supported for proxy.');\n }\n // check outputs location\n if (outputs.some(t => t)) {\n throw new Error('pre-allocated output tensor is not supported for proxy.');\n }\n ensureWorker();\n return new Promise((resolve, reject) => {\n enqueueCallbacks('run', [resolve, reject]);\n const serializableInputs = inputs as SerializableTensorMetadata[]; // every input is on CPU.\n const message: OrtWasmMessage =\n {type: 'run', in : {sessionId, inputIndices, inputs: serializableInputs, outputIndices, options}};\n proxyWorker!.postMessage(message, core.extractTransferableBuffers(serializableInputs));\n });\n } else {\n return core.run(sessionId, inputIndices, inputs, outputIndices, outputs, options);\n }\n};\n\nexport const endProfiling = async(sessionId: number): Promise => {\n if (!BUILD_DEFS.DISABLE_WASM_PROXY && isProxy()) {\n ensureWorker();\n return new Promise((resolve, reject) => {\n enqueueCallbacks('end-profiling', [resolve, reject]);\n const message: OrtWasmMessage = {type: 'end-profiling', in : sessionId};\n proxyWorker!.postMessage(message);\n });\n } else {\n core.endProfiling(sessionId);\n }\n};\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {InferenceSession, InferenceSessionHandler, SessionHandler, Tensor, TRACE_FUNC_BEGIN, TRACE_FUNC_END} from 'onnxruntime-common';\n\nimport {SerializableInternalBuffer, TensorMetadata} from './proxy-messages';\nimport {copyFromExternalBuffer, createSession, endProfiling, releaseSession, run} from './proxy-wrapper';\nimport {isGpuBufferSupportedType} from './wasm-common';\nimport {isNode} from './wasm-utils-env';\nimport {loadFile} from './wasm-utils-load-file';\n\nexport const encodeTensorMetadata = (tensor: Tensor, getName: () => string): TensorMetadata => {\n switch (tensor.location) {\n case 'cpu':\n return [tensor.type, tensor.dims, tensor.data, 'cpu'];\n case 'gpu-buffer':\n return [tensor.type, tensor.dims, {gpuBuffer: tensor.gpuBuffer}, 'gpu-buffer'];\n default:\n throw new Error(`invalid data location: ${tensor.location} for ${getName()}`);\n }\n};\n\nexport const decodeTensorMetadata = (tensor: TensorMetadata): Tensor => {\n switch (tensor[3]) {\n case 'cpu':\n return new Tensor(tensor[0], tensor[2], tensor[1]);\n case 'gpu-buffer': {\n const dataType = tensor[0];\n if (!isGpuBufferSupportedType(dataType)) {\n throw new Error(`not supported data type: ${dataType} for deserializing GPU tensor`);\n }\n const {gpuBuffer, download, dispose} = tensor[2];\n return Tensor.fromGpuBuffer(gpuBuffer, {dataType, dims: tensor[1], download, dispose});\n }\n default:\n throw new Error(`invalid data location: ${tensor[3]}`);\n }\n};\n\nexport class OnnxruntimeWebAssemblySessionHandler implements InferenceSessionHandler {\n private sessionId: number;\n\n inputNames: string[];\n outputNames: string[];\n\n async fetchModelAndCopyToWasmMemory(path: string): Promise {\n // fetch model from url and move to wasm heap.\n return copyFromExternalBuffer(await loadFile(path));\n }\n\n async loadModel(pathOrBuffer: string|Uint8Array, options?: InferenceSession.SessionOptions): Promise {\n TRACE_FUNC_BEGIN();\n let model: Parameters[0];\n\n if (typeof pathOrBuffer === 'string') {\n if (isNode) {\n // node\n model = await loadFile(pathOrBuffer);\n } else {\n // browser\n // fetch model and copy to wasm heap.\n model = await this.fetchModelAndCopyToWasmMemory(pathOrBuffer);\n }\n } else {\n model = pathOrBuffer;\n }\n\n [this.sessionId, this.inputNames, this.outputNames] = await createSession(model, options);\n TRACE_FUNC_END();\n }\n\n async dispose(): Promise {\n return releaseSession(this.sessionId);\n }\n\n async run(feeds: SessionHandler.FeedsType, fetches: SessionHandler.FetchesType, options: InferenceSession.RunOptions):\n Promise {\n TRACE_FUNC_BEGIN();\n const inputArray: Tensor[] = [];\n const inputIndices: number[] = [];\n Object.entries(feeds).forEach(kvp => {\n const name = kvp[0];\n const tensor = kvp[1];\n const index = this.inputNames.indexOf(name);\n if (index === -1) {\n throw new Error(`invalid input '${name}'`);\n }\n inputArray.push(tensor);\n inputIndices.push(index);\n });\n\n const outputArray: Array = [];\n const outputIndices: number[] = [];\n Object.entries(fetches).forEach(kvp => {\n const name = kvp[0];\n const tensor = kvp[1];\n const index = this.outputNames.indexOf(name);\n if (index === -1) {\n throw new Error(`invalid output '${name}'`);\n }\n outputArray.push(tensor);\n outputIndices.push(index);\n });\n\n const inputs =\n inputArray.map((t, i) => encodeTensorMetadata(t, () => `input \"${this.inputNames[inputIndices[i]]}\"`));\n const outputs = outputArray.map(\n (t, i) => t ? encodeTensorMetadata(t, () => `output \"${this.outputNames[outputIndices[i]]}\"`) : null);\n\n const results = await run(this.sessionId, inputIndices, inputs, outputIndices, outputs, options);\n\n const resultMap: SessionHandler.ReturnType = {};\n for (let i = 0; i < results.length; i++) {\n resultMap[this.outputNames[outputIndices[i]]] = outputArray[i] ?? decodeTensorMetadata(results[i]);\n }\n TRACE_FUNC_END();\n return resultMap;\n }\n\n startProfiling(): void {\n // TODO: implement profiling\n }\n\n endProfiling(): void {\n void endProfiling(this.sessionId);\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {Backend, env, InferenceSession, InferenceSessionHandler} from 'onnxruntime-common';\n\nimport {initializeOrtEp, initializeWebAssemblyAndOrtRuntime} from './wasm/proxy-wrapper';\nimport {OnnxruntimeWebAssemblySessionHandler} from './wasm/session-handler-inference';\nimport {scriptSrc} from './wasm/wasm-utils-import';\n\n/**\n * This function initializes all flags for WebAssembly.\n *\n * Those flags are accessible from `ort.env.wasm`. Users are allow to set those flags before the first inference session\n * being created, to override default value.\n */\nexport const initializeFlags = (): void => {\n if (typeof env.wasm.initTimeout !== 'number' || env.wasm.initTimeout < 0) {\n env.wasm.initTimeout = 0;\n }\n\n if (env.wasm.simd === false) {\n // eslint-disable-next-line no-console\n console.warn(\n 'Deprecated property \"env.wasm.simd\" is set to false. ' +\n 'non-SIMD build is no longer provided, and this setting will be ignored.');\n }\n\n if (typeof env.wasm.proxy !== 'boolean') {\n env.wasm.proxy = false;\n }\n\n if (typeof env.wasm.trace !== 'boolean') {\n env.wasm.trace = false;\n }\n\n if (typeof env.wasm.numThreads !== 'number' || !Number.isInteger(env.wasm.numThreads) || env.wasm.numThreads <= 0) {\n // The following logic only applies when `ort.env.wasm.numThreads` is not set by user. We will always honor user's\n // setting if it is provided.\n\n // Browser: when crossOriginIsolated is false, SharedArrayBuffer is not available so WebAssembly threads will not\n // work. In this case, we will set numThreads to 1.\n //\n // There is an exception: when the browser is configured to force-enable SharedArrayBuffer (e.g. Chromuim with\n // --enable-features=SharedArrayBuffer), it is possible that `self.crossOriginIsolated` is false and\n // SharedArrayBuffer is available at the same time. This is usually for testing. In this case, we will still set\n // numThreads to 1 here. If we want to enable multi-threading in test, we should set `ort.env.wasm.numThreads` to a\n // value greater than 1.\n if (typeof self !== 'undefined' && !self.crossOriginIsolated) {\n env.wasm.numThreads = 1;\n } else {\n const numCpuLogicalCores =\n typeof navigator === 'undefined' ? require('node:os').cpus().length : navigator.hardwareConcurrency;\n env.wasm.numThreads = Math.min(4, Math.ceil((numCpuLogicalCores || 1) / 2));\n }\n }\n\n if (!BUILD_DEFS.DISABLE_DYNAMIC_IMPORT) {\n // overwrite wasm paths override if not set\n if (env.wasm.wasmPaths === undefined && scriptSrc && scriptSrc.indexOf('blob:') !== 0) {\n env.wasm.wasmPaths = scriptSrc.substring(0, scriptSrc.lastIndexOf('/') + 1);\n }\n }\n};\n\nexport class OnnxruntimeWebAssemblyBackend implements Backend {\n /**\n * This function initializes the WebAssembly backend.\n *\n * This function will be called only once for each backend name. It will be called the first time when\n * `ort.InferenceSession.create()` is called with a registered backend name.\n *\n * @param backendName - the registered backend name.\n */\n async init(backendName: string): Promise {\n // populate wasm flags\n initializeFlags();\n\n // init wasm\n await initializeWebAssemblyAndOrtRuntime();\n\n // performe EP specific initialization\n await initializeOrtEp(backendName);\n }\n createInferenceSessionHandler(path: string, options?: InferenceSession.SessionOptions):\n Promise;\n createInferenceSessionHandler(buffer: Uint8Array, options?: InferenceSession.SessionOptions):\n Promise;\n async createInferenceSessionHandler(pathOrBuffer: string|Uint8Array, options?: InferenceSession.SessionOptions):\n Promise {\n const handler = new OnnxruntimeWebAssemblySessionHandler();\n await handler.loadModel(pathOrBuffer, options);\n return Promise.resolve(handler);\n }\n}\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\nimport {OnnxruntimeWebAssemblyBackend} from './backend-wasm';\nexport const wasmBackend = new OnnxruntimeWebAssemblyBackend();\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\n/* eslint-disable @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports */\n\n// We use \"require\" instead of \"import\" here because import statement must be put in top level. Our current code does\n// not allow bundler to tree-shaking code as expected because some codes are treated as having side effects.\n// So we import code inside the if-clause to allow bundler remove the code safely.\n\nexport * from 'onnxruntime-common';\nimport * as ort from 'onnxruntime-common';\nexport default ort;\n\nimport {registerBackend, env} from 'onnxruntime-common';\nimport {version} from './version';\n\nif (!BUILD_DEFS.DISABLE_WEBGL) {\n const onnxjsBackend = require('./backend-onnxjs').onnxjsBackend;\n registerBackend('webgl', onnxjsBackend, -10);\n}\n\nif (!BUILD_DEFS.DISABLE_WASM) {\n const wasmBackend = BUILD_DEFS.DISABLE_TRAINING ? require('./backend-wasm-inference').wasmBackend :\n require('./backend-wasm-training').wasmBackend;\n if (!BUILD_DEFS.DISABLE_JSEP) {\n registerBackend('webgpu', wasmBackend, 5);\n registerBackend('webnn', wasmBackend, 5);\n }\n registerBackend('cpu', wasmBackend, 10);\n registerBackend('wasm', wasmBackend, 10);\n}\n\nObject.defineProperty(env.versions, 'web', {value: version, enumerable: true});\n","// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n\n// This file is generated by /js/scripts/update-version.ts\n// Do not modify file content manually.\n\nexport const version = '1.19.0';\n"]}