/**
 * @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tensorflow/tfjs-core")):"function"==typeof define&&define.amd?define(["exports","@tensorflow/tfjs-core"],t):t(e.tf=e.tf||{},e.tf)}(this,function(e,t){"use strict";var a,r,n=function(){return(n=Object.assign||function(e){for(var t,a=1,r=arguments.length;a<r;a++)for(var n in t=arguments[a])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function s(e,t,a,r){return new(a||(a=Promise))(function(n,s){function o(e){try{i(r.next(e))}catch(e){s(e)}}function p(e){try{i(r.throw(e))}catch(e){s(e)}}function i(e){e.done?n(e.value):new a(function(t){t(e.value)}).then(o,p)}i((r=r.apply(e,t||[])).next())})}function o(e,t){var a,r,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:p(0),throw:p(1),return:p(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function p(s){return function(p){return function(s){if(a)throw new TypeError("Generator is already executing.");for(;o;)try{if(a=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{a=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,p])}}}!function(e){e[e.DT_INVALID=0]="DT_INVALID",e[e.DT_FLOAT=1]="DT_FLOAT",e[e.DT_DOUBLE=2]="DT_DOUBLE",e[e.DT_INT32=3]="DT_INT32",e[e.DT_UINT8=4]="DT_UINT8",e[e.DT_INT16=5]="DT_INT16",e[e.DT_INT8=6]="DT_INT8",e[e.DT_STRING=7]="DT_STRING",e[e.DT_COMPLEX64=8]="DT_COMPLEX64",e[e.DT_INT64=9]="DT_INT64",e[e.DT_BOOL=10]="DT_BOOL",e[e.DT_QINT8=11]="DT_QINT8",e[e.DT_QUINT8=12]="DT_QUINT8",e[e.DT_QINT32=13]="DT_QINT32",e[e.DT_BFLOAT16=14]="DT_BFLOAT16",e[e.DT_FLOAT_REF=101]="DT_FLOAT_REF",e[e.DT_DOUBLE_REF=102]="DT_DOUBLE_REF",e[e.DT_INT32_REF=103]="DT_INT32_REF",e[e.DT_UINT8_REF=104]="DT_UINT8_REF",e[e.DT_INT16_REF=105]="DT_INT16_REF",e[e.DT_INT8_REF=106]="DT_INT8_REF",e[e.DT_STRING_REF=107]="DT_STRING_REF",e[e.DT_COMPLEX64_REF=108]="DT_COMPLEX64_REF",e[e.DT_INT64_REF=109]="DT_INT64_REF",e[e.DT_BOOL_REF=110]="DT_BOOL_REF",e[e.DT_QINT8_REF=111]="DT_QINT8_REF",e[e.DT_QUINT8_REF=112]="DT_QUINT8_REF",e[e.DT_QINT32_REF=113]="DT_QINT32_REF",e[e.DT_BFLOAT16_REF=114]="DT_BFLOAT16_REF"}(a||(a={})),function(e){!function(e){e[e.LEGACY=0]="LEGACY",e[e.V1=1]="V1",e[e.V2=2]="V2"}(e.CheckpointFormatVersion||(e.CheckpointFormatVersion={}))}(r||(r={}));var p={};function i(e){return p[e]}function u(e,t,a,r){var n=t.inputParams[e];if(n&&void 0!==n.inputIndexStart){var s=n.inputIndexStart,o=0===n.inputIndexEnd?void 0:void 0===n.inputIndexEnd?s+1:n.inputIndexEnd;if("tensor"===n.type)return m(t.inputNames[n.inputIndexStart],a,r);if("tensors"===n.type)return t.inputNames.slice(s,o).map(function(e){return m(e,a,r)});var p=Array.prototype.slice.call(m(t.inputNames.slice(s)[0],a,r).dataSync());return"number"===n.type?p[0]:p}var i=t.attrParams[e];return i&&i.value}function m(e,t,a){var r=y(e),n=r[0],s=r[1],o=a.currentContextIds.find(function(e){return!!t[d(n,e)]});return void 0!==o?t[d(n,o)][s]:void 0}function c(e,t){var a=y(e),r=a[0],n=a[1];return[d(r,t&&t.currentContextId),n]}function d(e,t){return t?e+"-"+t:e}function y(e){var t=e.lastIndexOf(":");return-1===t?[e,0]:[e.substring(0,t),Number(e.substring(t+1))]}function l(e,t){for(var a=[],r=0;r<e.length;r+=t)a.push(e.slice(r,r+t));return a}var f=Object.freeze({json:[{tfOpName:"Add",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddV2",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AddN",category:"arithmetic",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"BiasAdd",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sub",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"RealDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Div",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"DivNoNan",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorDiv",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mul",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Maximum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}]},{tfOpName:"Minimum",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}]},{tfOpName:"Pow",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SquaredDifference",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Mod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"FloorMod",category:"arithmetic",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]}),h=Object.freeze({json:[{tfOpName:"Abs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atan2",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ceil",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ClipByValue",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"clip_value_min",name:"clipValueMin",type:"number"},{tfName:"clip_value_max",name:"clipValueMax",type:"number"}]},{tfOpName:"Complex",category:"basic_math",inputs:[{start:0,name:"real",type:"tensor"},{start:1,name:"imag",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ComplexAbs",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cos",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Cosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Elu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Exp",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Floor",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Imag",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Neg",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Real",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"Tout",name:"outputType",type:"dtype",notSupported:!0}]},{tfOpName:"Prelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"alpha",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Relu6",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"clipValueMin",name:"clipValueMin",type:"number",defaultValue:0},{tfName:"clipValueMax",name:"clipValueMax",type:"number",defaultValue:6}]},{tfOpName:"Selu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sigmoid",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sin",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Rsqrt",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Square",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tan",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Tanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Sign",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Round",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Expm1",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Log1p",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Reciprocal",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Softplus",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Asinh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Acosh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Atanh",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Erf",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Prod",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axes",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LeakyRelu",category:"basic_math",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"alpha",name:"alpha",type:"number",defaultValue:.2},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]}),N=Object.freeze({json:[{tfOpName:"LoopCond",category:"control",inputs:[{start:0,name:"pred",type:"tensor"}]},{tfOpName:"Switch",category:"control",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"pred",type:"tensor"}]},{tfOpName:"Merge",category:"control",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}]},{tfOpName:"Enter",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"frame_name",name:"frameName",type:"string"},{tfName:"is_constant",name:"isConstant",type:"bool"}]},{tfOpName:"Exit",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NextIteration",category:"control",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayV3",category:"control",inputs:[{start:0,name:"size",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"},{tfName:"dynamic_size",name:"dynamicSize",type:"bool"},{tfName:"clear_after_read",name:"clearAfterRead",type:"bool"},{tfName:"identical_element_shapes",name:"identicalElementShapes",type:"bool"},{tfName:"tensor_array_name",name:"name",type:"string"}]},{tfOpName:"TensorArrayWriteV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"index",type:"number"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayReadV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"index",type:"number"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"TensorArrayGatherV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"indices",type:"number[]"},{start:2,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape",name:"elementShape",type:"shape"}]},{tfOpName:"TensorArrayScatterV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"indices",type:"number[]"},{start:2,name:"tensor",type:"tensor"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArrayConcatV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"flowIn",type:"number"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"element_shape_except0",name:"elementShapeExcept0",type:"shape",notSupported:!0}]},{tfOpName:"TensorArraySplitV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"tensor",type:"tensor"},{start:2,name:"lengths",type:"number[]"},{start:3,name:"flowIn",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"TensorArraySizeV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"},{start:1,name:"flowIn",type:"number"}]},{tfOpName:"TensorArrayCloseV3",category:"control",inputs:[{start:0,name:"tensorArrayId",type:"number"}]}]}),g=Object.freeze({json:[{tfOpName:"AvgPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"AvgPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MaxPool3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0},{tfName:"ksize",name:"kernelSize",type:"number[]"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Conv1D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"stride",name:"stride",type:"number"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NWC"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"dilation",name:"dilation",type:"number",defaultValue:1}]},{tfOpName:"Conv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"useCudnnOnGpu",name:"useCudnnOnGpu",type:"bool"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"_FusedConv2D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"explicit_paddings",name:"explicitPaddings",type:"number[]",defaultValue:[]},{tfName:"use_cudnn_on_gpu",name:"useCudnnOnGpu",type:"bool",defaultValue:!0},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4}]},{tfOpName:"Conv2DBackpropInput",category:"convolution",inputs:[{start:2,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:0,name:"outputShape",type:"number[]"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"DepthwiseConv2d",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"DepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]},{tfOpName:"FusedDepthwiseConv2dNative",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0},{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]",defaultValue:[1,1,1,1]},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]}]},{tfOpName:"Conv3D",category:"convolution",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"filter",type:"tensor"}],attrs:[{tfName:"strides",name:"strides",type:"number[]"},{tfName:"padding",name:"pad",type:"string"},{tfName:"data_format",name:"dataFormat",type:"string",defaultValue:"NHWC"},{tfName:"dilations",name:"dilations",type:"number[]"}]}]}),b=Object.freeze({json:[{tfOpName:"Fill",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"},{start:1,name:"value",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"LinSpace",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"num",type:"number"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"OneHot",category:"creation",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"depth",type:"number"},{start:2,name:"onValue",type:"number",defaultValue:1},{start:3,name:"offValue",type:"number",defaultValue:0}],attrs:[{tfName:"axis",name:"axis",type:"number",notSupported:!0},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Ones",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"OnesLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"RandomUniform",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"minval",name:"minval",type:"number",defaultValue:0},{tfName:"maxval",name:"maxval",type:"number",defaultValue:1},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"seed",name:"seed",type:"number",defaultValue:0},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Range",category:"creation",inputs:[{start:0,name:"start",type:"number"},{start:1,name:"stop",type:"number"},{start:2,name:"step",type:"number",defaultValue:0}],attrs:[{tfName:"Tidx",name:"dtype",type:"dtype"}]},{tfOpName:"TruncatedNormal",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"means",name:"mean",type:"number",defaultValue:0},{tfName:"stddev",name:"stdDev",type:"number",defaultValue:1},{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number",defaultValue:0,notSupported:!0},{tfName:"dtype",name:"dtype",type:"dtype"},{tfName:"T",name:"T",type:"number",notSupported:!0}]},{tfOpName:"Zeros",category:"creation",inputs:[{start:0,name:"shape",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"ZerosLike",category:"creation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype"}]},{tfOpName:"Multinomial",category:"creation",inputs:[{start:0,name:"logits",type:"tensor"},{start:1,name:"numSamples",type:"number"}],attrs:[{tfName:"seed",name:"seed",type:"number"},{tfName:"seed2",name:"seed2",type:"number"},{tfName:"T",name:"dtype",type:"dtype"},{tfName:"output_dtype",name:"output_dtype",type:"dtype"}]}]}),x=Object.freeze({json:[{tfOpName:"NonMaxSuppressionV2",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"}]},{tfOpName:"NonMaxSuppressionV3",category:"dynamic",inputs:[{start:0,name:"boxes",type:"tensor"},{start:1,name:"scores",type:"tensor"},{start:2,name:"maxOutputSize",type:"number"},{start:3,name:"iouThreshold",type:"number"},{start:4,name:"scoreThreshold",type:"number"}]},{tfOpName:"Where",category:"dynamic",inputs:[{start:0,name:"condition",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ListDiff",category:"dynamic",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"y",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]}),T=Object.freeze({json:[{tfOpName:"TopKV2",category:"evaluation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"k",type:"number"}],attrs:[{tfName:"sorted",name:"sorted",type:"bool"}]}]}),v=Object.freeze({json:[{tfOpName:"PlaceholderWithDefault",category:"graph",inputs:[{start:0,name:"default",type:"tensor"}],attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Placeholder",category:"graph",attrs:[{tfName:"shape",name:"shape",type:"shape"},{tfName:"dtype",name:"dtype",type:"dtype"}]},{tfOpName:"Const",category:"graph"},{tfOpName:"Identity",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IdentityN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Snapshot",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Rank",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Size",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"Shape",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"ShapeN",category:"graph",inputs:[{start:0,end:0,name:"x",type:"tensors"}]},{tfOpName:"Print",category:"graph",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"data",type:"tensors"}],attrs:[{tfName:"message",name:"message",type:"string"},{tfName:"first_n",name:"firstN",type:"number",notSupported:!0},{tfName:"summarize",name:"summarize",type:"number",defaultValue:3}]},{tfOpName:"NoOp",category:"graph",inputs:[]},{tfOpName:"StopGradient",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"FakeQuantWithMinMaxVars",category:"graph",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"min",name:"min",type:"number"},{tfName:"max",name:"max",type:"number"}]}]}),O=Object.freeze({json:[{tfOpName:"ResizeBilinear",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"ResizeNearestNeighbor",category:"image",inputs:[{start:0,name:"images",type:"tensor"},{start:1,name:"size",type:"number[]"}],attrs:[{tfName:"align_corners",name:"alignCorners",type:"bool"},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"CropAndResize",category:"image",inputs:[{start:0,name:"image",type:"tensor"},{start:1,name:"boxes",type:"tensor"},{start:2,name:"boxInd",type:"tensor"},{start:3,name:"cropSize",type:"number[]"}],attrs:[{tfName:"method",name:"method",type:"string"},{tfName:"extrapolation_value",name:"extrapolationValue",type:"number"}]}]}),S=Object.freeze({json:[{tfOpName:"Equal",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"NotEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Greater",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"GreaterEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Less",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LessEqual",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalAnd",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalNot",category:"logical",inputs:[{start:0,name:"a",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"LogicalOr",category:"logical",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Select",category:"logical",inputs:[{start:0,name:"condition",type:"tensor"},{start:1,name:"a",type:"tensor"},{start:2,name:"b",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]}),_=Object.freeze({json:[{tfOpName:"_FusedMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMulV2",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Transpose",category:"matrices",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"perm",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]}]}),w=Object.freeze({json:[{tfOpName:"FusedBatchNorm",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV2",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"FusedBatchNormV3",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"scale",type:"tensor"},{start:2,name:"offset",type:"tensor"},{start:3,name:"mean",type:"tensor"},{start:4,name:"variance",type:"tensor"}],attrs:[{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:.001},{tfName:"data_format",name:"dataFormat",type:"string",notSupported:!0}]},{tfOpName:"LRN",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"depth_radius",name:"radius",type:"number",defaultValue:5},{tfName:"bias",name:"bias",type:"number",defaultValue:1},{tfName:"alpha",name:"alpha",type:"number",defaultValue:1},{tfName:"beta",name:"beta",type:"number",defaultValue:.5}]},{tfOpName:"Softmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"LogSoftmax",category:"normalization",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"SparseToDense",category:"normalization",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!0,notSupported:!0}]}]}),A=Object.freeze({json:[{tfOpName:"Max",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Mean",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Min",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Sum",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"All",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"Any",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]},{tfOpName:"ArgMax",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"ArgMin",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"Prod",category:"reduction",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}],attrs:[{tfName:"keep_dims",name:"keepDims",type:"bool"}]}]}),D=Object.freeze({json:[{tfOpName:"ConcatV2",category:"slice_join",inputs:[{start:0,end:-1,name:"tensors",type:"tensors"},{start:-1,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"Concat",category:"slice_join",inputs:[{start:1,end:0,name:"tensors",type:"tensors"},{start:0,name:"axis",type:"number"}],attrs:[{tfName:"N",name:"n",type:"number",defaultValue:2}]},{tfOpName:"GatherV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"axis",type:"number",defaultValue:0}]},{tfOpName:"Gather",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0},{tfName:"validate_indices",name:"validateIndices",type:"bool",notSupported:!0}]},{tfOpName:"Reverse",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"dims",type:"bool",notSupported:!0}]},{tfOpName:"ReverseV2",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number[]"}]},{tfOpName:"Slice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"size",type:"number[]"}]},{tfOpName:"StridedSlice",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"begin",type:"number[]"},{start:2,name:"end",type:"number[]"},{start:3,name:"strides",type:"number[]"}],attrs:[{tfName:"begin_mask",name:"beginMask",type:"number",defaultValue:0},{tfName:"end_mask",name:"endMask",type:"number",defaultValue:0},{tfName:"new_axis_mask",name:"newAxisMask",type:"number",defaultValue:0},{tfName:"ellipsis_mask",name:"ellipsisMask",type:"number",defaultValue:0},{tfName:"shrink_axis_mask",name:"shrinkAxisMask",type:"number",defaultValue:0}]},{tfOpName:"Pack",category:"slice_join",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0}]},{tfOpName:"Unpack",category:"slice_join",inputs:[{start:0,name:"tensor",type:"tensor"}],attrs:[{tfName:"axis",name:"axis",type:"number",defaultValue:0},{tfName:"num",name:"num",type:"number",defaultValue:0,notSupported:!0}]},{tfOpName:"Tile",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"reps",type:"number[]"}]},{tfOpName:"Split",category:"slice_join",inputs:[{start:0,name:"axis",type:"number",defaultValue:0},{start:1,name:"x",type:"tensor"}],attrs:[{tfName:"num_split",name:"numOrSizeSplits",type:"number",defaultValue:1}]},{tfOpName:"SplitV",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"numOrSizeSplits",type:"number[]"},{start:2,name:"axis",type:"number",defaultValue:0}]},{tfOpName:"ScatterNd",category:"slice_join",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"shape",type:"number[]"}]},{tfOpName:"GatherNd",category:"slice_join",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"indices",type:"tensor"}]},{tfOpName:"SparseToDense",category:"slice_join",inputs:[{start:0,name:"sparseIndices",type:"tensor"},{start:1,name:"outputShape",type:"number[]"},{start:2,name:"sparseValues",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"validate_indices",name:"validateIndices",type:"bool",defaultValue:!1,notSupported:!0}]}]}),E=Object.freeze({json:[{tfOpName:"FFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"IFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"}]},{tfOpName:"RFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]},{tfOpName:"IRFFT",category:"spectral",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"fft_length",type:"number",notSupported:!0}]}]}),V=Object.freeze({json:[{tfOpName:"Cast",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"SrcT",name:"sdtype",type:"dtype",notSupported:!0},{tfName:"DstT",name:"dtype",type:"dtype"}]},{tfOpName:"ExpandDims",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"Pad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"constant_value",name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"PadV2",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"},{start:2,name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"Reshape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"Squeeze",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"axis",tfDeprecatedName:"squeeze_dims",name:"axis",type:"number[]"}]},{tfOpName:"SpaceToBatchND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"paddings",type:"number[]"}]},{tfOpName:"BatchToSpaceND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"crops",type:"number[]"}]},{tfOpName:"DepthToSpace",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"block_size",name:"blockSize",type:"number"},{tfName:"data_format",name:"dataFormat",type:"string"}]}]}),I=function(){function e(){var e=[f,h,N,g,b,x,T,S,O,v,_,w,A,D,E,V],t=[].concat.apply([],e.map(function(e){return e.json}));this.opMappers=t.reduce(function(e,t){return e[t.tfOpName]=t,e},{})}return Object.defineProperty(e,"Instance",{get:function(){return this._instance||(this._instance=new this)},enumerable:!0,configurable:!0}),e.prototype.transformGraph=function(e,t){var a=this;void 0===t&&(t={});var r=[],n=[],s=e.node.reduce(function(e,t){return e[t.name]=a.mapNode(t),t.op.startsWith("Placeholder")&&r.push(e[t.name]),"Const"===t.op&&n.push(e[t.name]),e},{}),o=[],p=[],i={},u={};null!=t&&(i=this.mapSignatureEntries(t.inputs),u=this.mapSignatureEntries(t.outputs));var m=Object.keys(s);return m.forEach(function(e){var t=s[e];t.inputNames.forEach(function(e){var a=c(e)[0];t.inputs.push(s[a]),s[a].children.push(t)})}),0===Object.keys(u).length?m.forEach(function(e){var t=s[e];0===t.children.length&&p.push(t)}):Object.keys(u).forEach(function(e){var t=c(e)[0],a=s[t];null!=a&&(a.signatureKey=u[e],p.push(a))}),Object.keys(i).length>0?Object.keys(i).forEach(function(e){var t=c(e)[0],a=s[t];a&&(a.signatureKey=i[e],o.push(a))}):o=r,{nodes:s,inputs:o,outputs:p,weights:n,placeholders:r,signature:t}},e.prototype.mapSignatureEntries=function(e){return Object.keys(e||{}).reduce(function(t,a){return t[e[a].name]=a,t},{})},e.prototype.mapNode=function(e){var t=i(e.op)||this.opMappers[e.op]||{};null==e.attr&&(e.attr={});var a={name:e.name,op:e.op,category:t.category,inputNames:(e.input||[]).map(function(e){return e.startsWith("^")?e.substr(1):e}),inputs:[],children:[],inputParams:{},attrParams:{},rawAttrs:e.attr};return null!=t.inputs&&(a.inputParams=t.inputs.reduce(function(e,t){return e[t.name]={type:t.type,inputIndexStart:t.start,inputIndexEnd:t.end},e},{})),null!=t.attrs&&(a.attrParams=t.attrs.reduce(function(t,a){var r=a.type,n=void 0;switch(a.type){case"string":void 0===(n=C(e.attr,a.tfName,a.defaultValue))&&a.tfDeprecatedName&&(n=C(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"string[]":void 0===(n=q(e.attr,a.tfName,a.defaultValue))&&a.tfDeprecatedName&&(n=q(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"number":void 0===(n=z(e.attr,a.tfName,a.defaultValue||0))&&a.tfDeprecatedName&&(n=z(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"number[]":void 0===(n=B(e.attr,a.tfName,a.defaultValue))&&a.tfDeprecatedName&&(n=B(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"bool":void 0===(n=M(e.attr,a.tfName,a.defaultValue))&&a.tfDeprecatedName&&(n=M(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"bool[]":void 0===(n=G(e.attr,a.tfName,a.defaultValue))&&a.tfDeprecatedName&&(n=G(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"shape":void 0===(n=L(e.attr,a.tfName,a.defaultValue))&&a.tfDeprecatedName&&(n=L(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"shape[]":void 0===(n=U(e.attr,a.tfName,a.defaultValue))&&a.tfDeprecatedName&&(n=U(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"dtype":void 0===(n=j(e.attr,a.tfName,a.defaultValue))&&a.tfDeprecatedName&&(n=j(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"dtype[]":void 0===(n=P(e.attr,a.tfName,a.defaultValue))&&a.tfDeprecatedName&&(n=P(e.attr,a.tfDeprecatedName,a.defaultValue));break;case"tensor":case"tensors":break;default:throw new Error("Unsupported param type: "+a.type+" for op: "+e.op)}return t[a.name]={value:n,type:r},t},{})),a},e}();function k(e,a){var r=Array.isArray(e)?String.fromCharCode.apply(null,e):function(e){var a=t.env().global;if(void 0!==a.atob)return a.atob(e);if("undefined"!=typeof Buffer)return new Buffer(e,"base64").toString();throw new Error("Unable to decode base64 in this environment. Missing built-in atob() or Buffer()")}(e);return a?r:r.toLowerCase()}function C(e,t,a,r){void 0===r&&(r=!1);var n=e[t];return null!=n?k(n.s,r):a}function M(e,t,a){var r=e[t];return r?r.b:a}function z(e,t,a){var r=e[t]||{},n=null!=r.i?r.i:null!=r.f?r.f:a;return"number"==typeof n?n:parseInt(n,10)}function F(e){switch("string"==typeof e&&(e=a[e]),e){case a.DT_FLOAT:return"float32";case a.DT_INT32:case a.DT_INT64:return"int32";case a.DT_BOOL:return"bool";case a.DT_DOUBLE:return"float32";case a.DT_STRING:return"string";default:return null}}function j(e,t,a){var r=e[t];return r&&r.type?F(r.type):a}function P(e,t,a){var r=e[t];return r&&r.list&&r.list.type?r.list.type.map(function(e){return F(e)}):a}function R(e){if(!e.unknownRank)return null!=e.dim?e.dim.map(function(e){return"number"==typeof e.size?e.size:parseInt(e.size,10)}):[]}function L(e,t,a){var r=e[t];return r&&r.shape?R(r.shape):a}function B(e,t,a){var r=e[t];return r?((r.list.f&&r.list.f.length?r.list.f:r.list.i)||[]).map(function(e){return"number"==typeof e?e:parseInt(e,10)}):a}function q(e,t,a,r){void 0===r&&(r=!1);var n=e[t];return n&&n.list&&n.list.s?n.list.s.map(function(e){return k(e,r)}):a}function U(e,t,a){var r=e[t];return r&&r.list&&r.list.shape?r.list.shape.map(function(e){return R(e)}):a}function G(e,t,a){var r=e[t];return r&&r.list&&r.list.b?r.list.b:a}var W=function(){function e(e,t,a){var r=this;this.node=e,this.tensorMap=t,this.context=a,this.inputs=[],this.attrs={},this.inputs=e.inputNames.map(function(e){return r.getInput(e)}),null!=e.rawAttrs&&(this.attrs=Object.keys(e.rawAttrs).reduce(function(e,t){return e[t]=r.getAttr(t),e},{}))}return e.prototype.getInput=function(e){return m(e,this.tensorMap,this.context)},e.prototype.getAttr=function(e,t){var a=this.node.rawAttrs[e];if(null!=a.tensor)return m(e,this.tensorMap,this.context);if(null!=a.i||null!=a.f)return z(this.node.rawAttrs,e,t);if(null!=a.s)return C(this.node.rawAttrs,e,t);if(null!=a.b)return M(this.node.rawAttrs,e,t);if(null!=a.shape)return L(this.node.rawAttrs,e,t);if(null!=a.type)return j(this.node.rawAttrs,e,t);if(null!=a.list){if(null!=a.list.i||null!=a.list.f)return B(this.node.rawAttrs,e,t);if(null!=a.list.s)return q(this.node.rawAttrs,e,t);if(null!=a.list.shape)return U(this.node.rawAttrs,e,t);if(null!=a.list.b)return G(this.node.rawAttrs,e,t);if(null!=a.list.type)return P(this.node.rawAttrs,e,t)}return t},e}(),H=function(e,a,r){switch(e.op){case"BiasAdd":case"AddV2":case"Add":return[t.add(u("a",e,a,r),u("b",e,a,r))];case"AddN":return[t.addN(u("tensors",e,a,r))];case"FloorMod":case"Mod":return[t.mod(u("a",e,a,r),u("b",e,a,r))];case"Mul":return[t.mul(u("a",e,a,r),u("b",e,a,r))];case"RealDiv":case"Div":return[t.div(u("a",e,a,r),u("b",e,a,r))];case"DivNoNan":return[t.divNoNan(u("a",e,a,r),u("b",e,a,r))];case"FloorDiv":return[t.floorDiv(u("a",e,a,r),u("b",e,a,r))];case"Sub":return[t.sub(u("a",e,a,r),u("b",e,a,r))];case"Minimum":return[t.minimum(u("a",e,a,r),u("b",e,a,r))];case"Maximum":return[t.maximum(u("a",e,a,r),u("b",e,a,r))];case"Pow":return[t.pow(u("a",e,a,r),u("b",e,a,r))];case"SquaredDifference":return[t.squaredDifference(u("a",e,a,r),u("b",e,a,r))];default:throw TypeError("Node type "+e.op+" is not implemented")}},Q=function(e,a,r){switch(e.op){case"Abs":case"ComplexAbs":return[t.abs(u("x",e,a,r))];case"Acos":return[t.acos(u("x",e,a,r))];case"Acosh":return[t.acosh(u("x",e,a,r))];case"Asin":return[t.asin(u("x",e,a,r))];case"Asinh":return[t.asinh(u("x",e,a,r))];case"Atan":return[t.atan(u("x",e,a,r))];case"Atan2":return[t.atan2(u("x",e,a,r),u("y",e,a,r))];case"Atanh":return[t.atanh(u("x",e,a,r))];case"Ceil":return[t.ceil(u("x",e,a,r))];case"Complex":return[t.complex(u("real",e,a,r),u("imag",e,a,r))];case"Cos":return[t.cos(u("x",e,a,r))];case"Cosh":return[t.cosh(u("x",e,a,r))];case"Elu":return[t.elu(u("x",e,a,r))];case"Erf":return[t.erf(u("x",e,a,r))];case"Exp":return[t.exp(u("x",e,a,r))];case"Expm1":return[t.expm1(u("x",e,a,r))];case"Floor":return[t.floor(u("x",e,a,r))];case"Log":return[t.log(u("x",e,a,r))];case"Log1p":return[t.log1p(u("x",e,a,r))];case"Imag":return[t.imag(u("x",e,a,r))];case"Neg":return[t.neg(u("x",e,a,r))];case"Reciprocal":return[t.reciprocal(u("x",e,a,r))];case"Real":return[t.real(u("x",e,a,r))];case"Relu":return[t.relu(u("x",e,a,r))];case"Round":return[t.round(u("x",e,a,r))];case"Selu":return[t.selu(u("x",e,a,r))];case"Sigmoid":return[t.sigmoid(u("x",e,a,r))];case"Sin":return[t.sin(u("x",e,a,r))];case"Sign":return[t.sign(u("x",e,a,r))];case"Sinh":return[t.sinh(u("x",e,a,r))];case"Softplus":return[t.softplus(u("x",e,a,r))];case"Sqrt":return[t.sqrt(u("x",e,a,r))];case"Square":return[t.square(u("x",e,a,r))];case"Tanh":return[t.tanh(u("x",e,a,r))];case"Tan":return[t.tan(u("x",e,a,r))];case"Relu6":case"ClipByValue":return[t.clipByValue(u("x",e,a,r),u("clipValueMin",e,a,r),u("clipValueMax",e,a,r))];case"Rsqrt":return[t.rsqrt(m(e.inputNames[0],a,r))];case"Prod":return[t.prod(u("x",e,a,r),u("axes",e,a,r))];case"LeakyRelu":return[t.leakyRelu(u("x",e,a,r),u("alpha",e,a,r))];case"Prelu":return[t.prelu(u("x",e,a,r),u("alpha",e,a,r))];default:throw TypeError("Node type "+e.op+" is not implemented")}},K=function(){function e(t,a,r,n,s,o,p){this.name=t,this.dtype=a,this.maxSize=r,this.elementShape=n,this.identicalElementShapes=s,this.dynamicSize=o,this.clearAfterRead=p,this.tensors=[],this.closed_=!1,this.id=e.nextId++}return Object.defineProperty(e.prototype,"closed",{get:function(){return this.closed_},enumerable:!0,configurable:!0}),e.prototype.clearAndClose=function(){this.tensors.forEach(function(e){return e.tensor.dispose()}),this.tensors=[],this.closed_=!0},e.prototype.size=function(){return this.tensors.length},e.prototype.read=function(e){if(this.closed_)throw new Error("TensorArray "+this.name+" has already been closed.");if(e<0||e>=this.tensors.length)throw new Error("Tried to read from index "+e+", but array size is: "+this.tensors.length);var t=this.tensors[e];if(t.cleared)throw new Error("TensorArray "+this.name+": Could not read index "+e+" twice because it was cleared after a previous read (perhaps try setting clear_after_read = false?).");return this.clearAfterRead&&(t.cleared=!0),t.read=!0,t.tensor},e.prototype.readMany=function(e){var t=this;return e.map(function(e){return t.read(e)})},e.prototype.write=function(e,t){if(this.closed_)throw new Error("TensorArray "+this.name+" has already been closed.");if(e<0||!this.dynamicSize&&e>=this.maxSize)throw new Error("Tried to write to index "+e+", but array is not resizeable and size is: "+this.maxSize);var a=this.tensors[e]||{};if(t.dtype!==this.dtype)throw new Error("TensorArray "+this.name+": Could not write to TensorArray index "+e+",\n          because the value dtype is "+t.dtype+", but TensorArray dtype is "+this.dtype+".");if(0!==this.size()||null!=this.elementShape&&0!==this.elementShape.length||(this.elementShape=t.shape),this.assertShapesMatchAllowUndefinedSize(this.elementShape,t.shape,"TensorArray "+this.name+": Could not write to TensorArray index "+e+"."),a&&a.read)throw new Error("TensorArray "+this.name+": Could not write to TensorArray index "+e+", because it has already been read.");if(a&&a.written)throw new Error("TensorArray "+this.name+": Could not write to TensorArray index "+e+", because it has already been written.");a.tensor=t,a.written=!0,this.tensors[e]=a},e.prototype.writeMany=function(e,t){var a=this;if(e.length!==t.length)throw new Error("TensorArray "+this.name+": could not write multiple tensors,because the index size: "+e.length+" is not the same as tensors size: "+t.length+".");e.forEach(function(e,r){return a.write(e,t[r])})},e.prototype.gather=function(e,a){if(a&&a!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but gather requested dtype "+a);if(!e){e=[];for(var r=0;r<this.size();r++)e.push(r)}if(0===e.length)return t.tensor([],[0].concat(this.elementShape));var n=this.readMany(e);return this.assertShapesMatchAllowUndefinedSize(this.elementShape,n[0].shape,"TensorArray shape mismatch: "),t.stack(n,0)},e.prototype.concat=function(e){if(e&&e!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but concat requested dtype "+e);if(0===this.size())return t.tensor([],[0].concat(this.elementShape));for(var a=[],r=0;r<this.size();r++)a.push(r);var n=this.readMany(a);return this.assertShapesMatchAllowUndefinedSize(this.elementShape,n[0].shape,"TensorArray shape mismatch: tensor array shape ("+this.elementShape+") vs first tensor shape ("+n[0].shape+")"),t.concat(n,0)},e.prototype.scatter=function(e,a){if(a.dtype!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but tensor has dtype "+a.dtype);if(e.length!==a.shape[0])throw new Error("Expected len(indices) == tensor.shape[0], but saw: "+e.length+" vs. "+a.shape[0]);var r=Math.max.apply(Math,e);if(!this.dynamicSize&&r>=this.maxSize)throw new Error("Max index must be < array size ("+r+"  vs. "+this.maxSize+")");this.writeMany(e,t.unstack(a,0))},e.prototype.split=function(e,a){var r=this;if(a.dtype!==this.dtype)throw new Error("TensorArray dtype is "+this.dtype+" but tensor has dtype "+a.dtype);var n=0,s=e.map(function(e){return n+=e});if(n!==a.shape[0])throw new Error("Expected sum of lengths to be equal to\n          tensor.shape[0], but sum of lengths is\n        "+n+", and tensor's shape is: "+a.shape);if(!this.dynamicSize&&e.length!==this.maxSize)throw new Error("TensorArray's size is not equal to the size of lengths ("+this.maxSize+" vs. "+e.length+"), and the TensorArray is not marked as dynamically resizeable");var o=0===n?0:a.size/n,p=[];t.tidy(function(){a=a.reshape([1,n,o]);for(var i=0;i<e.length;++i){var u=[0,0===i?0:s[i-1],0],m=[1,e[i],o];p[i]=t.slice(a,u,m).reshape(r.elementShape)}return p});for(var i=[],u=0;u<e.length;u++)i[u]=u;this.writeMany(i,p)},e.prototype.assertShapesMatchAllowUndefinedSize=function(e,a,r){void 0===r&&(r=""),t.util.assert(this.shapesEqualAllowUndefinedSize(e,a),function(){return r+" Shapes "+e+" and "+a+" must match"})},e.prototype.shapesEqualAllowUndefinedSize=function(e,t){if(e.length!==t.length)return!1;for(var a=0;a<e.length;a++)if(-1!==e[a]&&-1!==t[a]&&e[a]!==t[a])return!1;return!0},e.nextId=0,e}();var X=function(e,a,r){switch(e.op){case"Conv1D":var n=u("stride",e,a,r),s=u("pad",e,a,r),o=u("dataFormat",e,a,r).toUpperCase(),p=u("dilation",e,a,r);return[t.conv1d(u("x",e,a,r),u("filter",e,a,r),n,s,o,p)];case"Conv2D":n=u("strides",e,a,r),s=u("pad",e,a,r),o=u("dataFormat",e,a,r).toUpperCase();var i=u("dilations",e,a,r);return[t.conv2d(u("x",e,a,r),u("filter",e,a,r),[n[1],n[2]],s,o,[i[1],i[2]])];case"_FusedConv2D":case"FusedDepthwiseConv2dNative":var m=u("fusedOps",e,a,r),c=m[0],d=m[1],y="biasadd"===c,l="prelu"===d,f="fusedbatchnorm"===c,h=u("numArgs",e,a,r);if(y){if(l&&2!==h)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!l&&1!==h)throw new Error("FusedConv2d and DepthwiseConv2d with BiasAdd must have one extra argument: bias.")}if(f)throw new Error("FusedConv2d and DepthwiseConv2d with FusedBatchNorm is not supported.");n=u("strides",e,a,r),s=u("pad",e,a,r),o=u("dataFormat",e,a,r).toUpperCase(),i=u("dilations",e,a,r);var N=u("args",e,a,r),g=N[0],b=N[1];return[("_FusedConv2D"===e.op?t.fused.conv2d:t.fused.depthwiseConv2d)({x:u("x",e,a,r),filter:u("filter",e,a,r),strides:[n[1],n[2]],pad:s,dataFormat:o,dilations:[i[1],i[2]],bias:g,activation:d,preluActivationWeights:b})];case"Conv2DBackpropInput":case"Conv2dTranspose":var x=u("outputShape",e,a,r);n=u("strides",e,a,r),s=u("pad",e,a,r);return[t.conv2dTranspose(u("x",e,a,r),u("filter",e,a,r),x,[n[1],n[2]],s)];case"DepthwiseConv2dNative":case"DepthwiseConv2d":n=u("strides",e,a,r),s=u("pad",e,a,r),i=u("dilations",e,a,r),o=u("dataFormat",e,a,r).toUpperCase();return[t.depthwiseConv2d(u("input",e,a,r),u("filter",e,a,r),[n[1],n[2]],s,o,[i[1],i[2]])];case"Conv3D":n=u("strides",e,a,r),s=u("pad",e,a,r),o=u("dataFormat",e,a,r).toUpperCase(),i=u("dilations",e,a,r);return[t.conv3d(u("x",e,a,r),u("filter",e,a,r),[n[1],n[2],n[3]],s,o,[i[1],i[2],i[3]])];case"AvgPool":n=u("strides",e,a,r),s=u("pad",e,a,r);var T=u("kernelSize",e,a,r);return[t.avgPool(u("x",e,a,r),[T[1],T[2]],[n[1],n[2]],s)];case"MaxPool":n=u("strides",e,a,r),s=u("pad",e,a,r),T=u("kernelSize",e,a,r);return[t.maxPool(u("x",e,a,r),[T[1],T[2]],[n[1],n[2]],s)];case"AvgPool3D":n=u("strides",e,a,r),s=u("pad",e,a,r),T=u("kernelSize",e,a,r);return[t.avgPool3d(u("x",e,a,r),[T[1],T[2],T[3]],[n[1],n[2],n[3]],s)];case"MaxPool3D":n=u("strides",e,a,r),s=u("pad",e,a,r),T=u("kernelSize",e,a,r);return[t.maxPool3d(u("x",e,a,r),[T[1],T[2],T[3]],[n[1],n[2],n[3]],s)];default:throw TypeError("Node type "+e.op+" is not implemented")}},Z=function(e,a,r){switch(e.op){case"Fill":var n=u("shape",e,a,r),s=u("dtype",e,a,r),o=u("value",e,a,r);return[t.fill(n,o,s)];case"LinSpace":var p=u("start",e,a,r),i=u("stop",e,a,r),m=u("num",e,a,r);return[t.linspace(p,i,m)];case"Multinomial":var c=u("logits",e,a,r),d=u("numSamples",e,a,r),y=u("seed",e,a,r);return[t.multinomial(c,d,y)];case"OneHot":var l=u("indices",e,a,r),f=u("depth",e,a,r),h=u("onValue",e,a,r),N=u("offValue",e,a,r);return[t.oneHot(l,f,h,N)];case"Ones":return[t.ones(u("shape",e,a,r),u("dtype",e,a,r))];case"OnesLike":return[t.onesLike(u("x",e,a,r))];case"RandomUniform":return[t.randomUniform(u("shape",e,a,r),u("minval",e,a,r),u("maxval",e,a,r),u("dtype",e,a,r))];case"Range":p=u("start",e,a,r);var g=u("stop",e,a,r),b=u("step",e,a,r);return[t.range(p,g,b,u("dtype",e,a,r))];case"TruncatedNormal":n=u("shape",e,a,r);var x=u("mean",e,a,r),T=u("stdDev",e,a,r);y=u("seed",e,a,r);return[t.truncatedNormal(n,x,T,u("dtype",e,a,r),y)];case"Zeros":return[t.zeros(u("shape",e,a,r),u("dtype",e,a,r))];case"ZerosLike":return[t.zerosLike(u("x",e,a,r))];default:throw TypeError("Node type "+e.op+" is not implemented")}};var Y=function(e,a,r){switch(e.op){case"TopKV2":var n=u("x",e,a,r),s=u("k",e,a,r),o=u("sorted",e,a,r),p=t.topk(n,s,o);return[p.values,p.indices];default:throw TypeError("Node type "+e.op+" is not implemented")}},J=function(e,a,r){switch(e.op){case"Const":return a[e.name];case"PlaceholderWithDefault":var n=u("default",e,a,r);return[m(e.name,a,r)||n];case"Placeholder":return[m(e.name,a,r)];case"Identity":case"StopGradient":case"FakeQuantWithMinMaxVars":return[u("x",e,a,r).clone()];case"IdentityN":return u("x",e,a,r).map(function(e){return e.clone()});case"Snapshot":return[u("x",e,a,r).clone()];case"Shape":return[t.tensor1d(u("x",e,a,r).shape,"int32")];case"ShapeN":return u("x",e,a,r).map(function(e){return t.tensor1d(e.shape)});case"Size":return[t.scalar(u("x",e,a,r).size,"int32")];case"Rank":return[t.scalar(u("x",e,a,r).rank,"int32")];case"NoOp":return[t.scalar(1)];case"Print":var s=u("x",e,a,r),o=u("data",e,a,r),p=u("message",e,a,r),i=u("summarize",e,a,r);console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."),console.log(p);for(var c=0;c<o.length;c++)console.log(Array.prototype.slice.call(o[c].dataSync()).slice(0,i));return[s];default:throw TypeError("Node type "+e.op+" is not implemented")}},$=function(e,a,r){switch(e.op){case"ResizeBilinear":var n=u("images",e,a,r),s=u("size",e,a,r),o=u("alignCorners",e,a,r);return[t.image.resizeBilinear(n,[s[0],s[1]],o)];case"ResizeNearestNeighbor":n=u("images",e,a,r),s=u("size",e,a,r),o=u("alignCorners",e,a,r);return[t.image.resizeNearestNeighbor(n,[s[0],s[1]],o)];case"CropAndResize":var p=u("image",e,a,r),i=u("boxes",e,a,r),m=u("boxInd",e,a,r),c=u("cropSize",e,a,r),d=u("method",e,a,r),y=u("extrapolationValue",e,a,r);return[t.image.cropAndResize(p,i,m,c,d,y)];default:throw TypeError("Node type "+e.op+" is not implemented")}},ee=function(e,a,r){switch(e.op){case"Equal":return[t.equal(u("a",e,a,r),u("b",e,a,r))];case"NotEqual":return[t.notEqual(u("a",e,a,r),u("b",e,a,r))];case"Greater":return[t.greater(u("a",e,a,r),u("b",e,a,r))];case"GreaterEqual":return[t.greaterEqual(u("a",e,a,r),u("b",e,a,r))];case"Less":return[t.less(u("a",e,a,r),u("b",e,a,r))];case"LessEqual":return[t.lessEqual(u("a",e,a,r),u("b",e,a,r))];case"LogicalAnd":return[t.logicalAnd(u("a",e,a,r),u("b",e,a,r))];case"LogicalNot":return[t.logicalNot(u("a",e,a,r))];case"LogicalOr":return[t.logicalOr(u("a",e,a,r),u("b",e,a,r))];case"Select":return[t.where(u("condition",e,a,r),u("a",e,a,r),u("b",e,a,r))];default:throw TypeError("Node type "+e.op+" is not implemented")}},te=function(e,a,r){switch(e.op){case"BatchMatMul":case"BatchMatMulV2":case"MatMul":return[t.matMul(u("a",e,a,r),u("b",e,a,r),u("transposeA",e,a,r),u("transposeB",e,a,r))];case"Transpose":return[t.transpose(u("x",e,a,r),u("perm",e,a,r))];case"_FusedMatMul":var n=u("fusedOps",e,a,r),s=n[0],o=n[1],p="biasadd"===s,i="prelu"===o,m=u("numArgs",e,a,r);if(p){if(i&&2!==m)throw new Error("Fused MatMul with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!i&&1!==m)throw new Error("Fused MatMul with BiasAdd must have one extra argument: bias.")}var c=u("args",e,a,r),d=c[0],y=c[1];return[t.fused.matMul({a:u("a",e,a,r),b:u("b",e,a,r),transposeA:u("transposeA",e,a,r),transposeB:u("transposeB",e,a,r),bias:d,activation:o,preluActivationWeights:y})];default:throw TypeError("Node type "+e.op+" is not implemented")}},ae=function(e,a,r){switch(e.op){case"FusedBatchNorm":case"FusedBatchNormV2":case"FusedBatchNormV3":return[t.batchNorm(u("x",e,a,r),u("mean",e,a,r),u("variance",e,a,r),u("offset",e,a,r),u("scale",e,a,r),u("epsilon",e,a,r))];case"LRN":return[t.localResponseNormalization(u("x",e,a,r),u("radius",e,a,r),u("bias",e,a,r),u("alpha",e,a,r),u("beta",e,a,r))];case"Softmax":return[t.softmax(u("x",e,a,r))];case"LogSoftmax":return[t.logSoftmax(u("x",e,a,r))];case"SparseToDense":return[t.sparseToDense(u("sparseIndices",e,a,r),u("outputShape",e,a,r),u("sparseValues",e,a,r),u("defaultValue",e,a,r))];default:throw TypeError("Node type "+e.op+" is not implemented")}},re=function(e,a,r){switch(e.op){case"Max":var n=u("axis",e,a,r),s=u("keepDims",e,a,r);return[t.max(u("x",e,a,r),n,s)];case"Mean":n=u("axis",e,a,r),s=u("keepDims",e,a,r);return[t.mean(u("x",e,a,r),n,s)];case"Min":n=u("axis",e,a,r),s=u("keepDims",e,a,r);return[t.min(u("x",e,a,r),n,s)];case"Sum":n=u("axis",e,a,r),s=u("keepDims",e,a,r);return[t.sum(u("x",e,a,r),n,s)];case"All":n=u("axis",e,a,r),s=u("keepDims",e,a,r);return[t.all(u("x",e,a,r),n,s)];case"Any":n=u("axis",e,a,r),s=u("keepDims",e,a,r);return[t.any(u("x",e,a,r),n,s)];case"ArgMax":n=u("axis",e,a,r);return[t.argMax(u("x",e,a,r),n)];case"ArgMin":n=u("axis",e,a,r);return[t.argMin(u("x",e,a,r),n)];case"Prod":n=u("axis",e,a,r),s=u("keepDims",e,a,r);return[t.prod(u("x",e,a,r),n,s)];default:throw TypeError("Node type "+e.op+" is not implemented")}},ne=function(e,a,r){switch(e.op){case"ConcatV2":case"Concat":var n=u("n",e,a,r),s=u("axis",e,a,r),o=u("tensors",e,a,r);return o=o.slice(0,n),[t.concat(o,s)];case"GatherV2":case"Gather":s=u("axis",e,a,r);var p=u("x",e,a,r),i=u("indices",e,a,r);return[t.gather(p,i.asType("int32"),s)];case"ReverseV2":case"Reverse":s=u("axis",e,a,r),p=u("x",e,a,r);return[t.reverse(p,s)];case"Slice":var m=u("begin",e,a,r),c=u("size",e,a,r);return[t.slice(u("x",e,a,r),m,c)];case"StridedSlice":m=u("begin",e,a,r);var d=u("end",e,a,r),y=u("strides",e,a,r),l=u("beginMask",e,a,r),f=u("endMask",e,a,r),h=u("ellipsisMask",e,a,r),N=u("newAxisMask",e,a,r),g=u("shrinkAxisMask",e,a,r),b=u("x",e,a,r);if(1===m.length&&b.shape.length>1)for(var x=1;x<b.shape.length;x++)m.push(0),d.push(b.shape[x]),y.push(y[0]);return[t.stridedSlice(b,m,d,y,l,f,h,N,g)];case"Pack":return t.tidy(function(){var n=u("axis",e,a,r),s=u("tensors",e,a,r),o=s[0].shape,p=s[0].squeeze().shape,i=s.map(function(e){var a=t.util.arraysEqual(e.shape,o);if(!a&&!t.util.arraysEqual(e.squeeze().shape,p))throw new Error("the input tensors shape does not match");return a?e:e.reshape(o)});return[t.stack(i,n)]});case"Unpack":return t.tidy(function(){var n=u("axis",e,a,r),s=u("tensor",e,a,r);return t.unstack(s,n)});case"Tile":var T=u("reps",e,a,r);return[t.tile(u("x",e,a,r),T)];case"Split":case"SplitV":s=u("axis",e,a,r);var v=u("numOrSizeSplits",e,a,r);return t.split(u("x",e,a,r),v,s);case"ScatterNd":i=u("indices",e,a,r);var O=u("values",e,a,r),S=u("shape",e,a,r);return[t.scatterND(i,O,S)];case"GatherNd":var _=u("x",e,a,r);i=u("indices",e,a,r);return[t.gatherND(_,i)];case"SparseToDense":i=u("sparseIndices",e,a,r),S=u("outputShape",e,a,r);var w=u("sparseValues",e,a,r),A=u("defaultValue",e,a,r);return[t.sparseToDense(i,w,S,w.dtype===A.dtype?A:A.asType(w.dtype))];default:throw TypeError("Node type "+e.op+" is not implemented")}},se=function(e,a,r){switch(e.op){case"FFT":return[t.fft(u("x",e,a,r))];case"IFFT":return[t.ifft(u("x",e,a,r))];case"RFFT":return[t.rfft(u("x",e,a,r))];case"IRFFT":return[t.irfft(u("x",e,a,r))];default:throw TypeError("Node type "+e.op+" is not implemented")}},oe=function(e,a,r){switch(e.op){case"Cast":return[t.cast(u("x",e,a,r),u("dtype",e,a,r))];case"ExpandDims":var n=u("axis",e,a,r);return[t.expandDims(u("x",e,a,r),n)];case"Squeeze":n=u("axis",e,a,r);return[t.squeeze(u("x",e,a,r),n)];case"Reshape":return[t.reshape(u("x",e,a,r),u("shape",e,a,r))];case"PadV2":case"Pad":return[t.pad(u("x",e,a,r),l(u("padding",e,a,r),2),u("constantValue",e,a,r))];case"SpaceToBatchND":var s=u("blockShape",e,a,r),o=l(u("paddings",e,a,r),2);return[t.spaceToBatchND(u("x",e,a,r),s,o)];case"BatchToSpaceND":s=u("blockShape",e,a,r);var p=l(u("crops",e,a,r),2);return[t.batchToSpaceND(u("x",e,a,r),s,p)];case"DepthToSpace":var i=u("blockSize",e,a,r),m=u("dataFormat",e,a,r).toUpperCase();return[t.depthToSpace(u("x",e,a,r),i,m)];default:throw TypeError("Node type "+e.op+" is not implemented")}};function pe(e,a,r){var n=function(e,a,r){switch(e.category){case"arithmetic":return H(e,a,r);case"basic_math":return Q(e,a,r);case"control":return function(e,a,r){return s(this,void 0,void 0,function(){var n,s,p,i,c,d,y,l,f,h,N,g,b,x,T,v,O,S,_,w,A,D,E,V,I,k,C,M,z,F,j,P,R,L,B;return o(this,function(o){switch(o.label){case 0:switch(e.op){case"LoopCond":return[3,1];case"Switch":return[3,2];case"Merge":return[3,4];case"Enter":return[3,5];case"Exit":return[3,6];case"NextIteration":return[3,7];case"TensorArrayV3":return[3,8];case"TensorArrayWriteV3":return[3,9];case"TensorArrayReadV3":return[3,10];case"TensorArrayGatherV3":return[3,11];case"TensorArrayScatterV3":return[3,12];case"TensorArrayConcatV3":return[3,13];case"TensorArraySplitV3":return[3,14];case"TensorArraySizeV3":return[3,15];case"TensorArrayCloseV3":return[3,16]}return[3,17];case 1:return[2,[u("pred",e,a,r).clone()]];case 2:return n=u("pred",e,a,r),s=u("data",e,a,r),[4,n.data()];case 3:return[2,o.sent()[0]?[void 0,s.clone()]:[s.clone(),void 0]];case 4:return[2,(p=e.inputNames.find(function(e){return void 0!==m(e,a,r)}))?[m(p,a,r).clone()]:void 0];case 5:return i=u("frameName",e,a,r),c=u("tensor",e,a,r),r.enterFrame(i),[2,[c.clone()]];case 6:return d=u("tensor",e,a,r),r.exitFrame(),[2,[d.clone()]];case 7:return y=u("tensor",e,a,r),r.nextIteration(),[2,[y.clone()]];case 8:return l=u("size",e,a,r),f=u("dtype",e,a,r),h=u("elementShape",e,a,r),N=u("dynamicSize",e,a,r),g=u("clearAfterRead",e,a,r),b=u("identicalElementShapes",e,a,r),x=u("name",e,a,r),T=new K(x,f,l,h,b,N,g),r.addTensorArray(T),[2,[t.scalar(T.id),t.scalar(1)]];case 9:return v=u("tensorArrayId",e,a,r),O=u("index",e,a,r),S=u("tensor",e,a,r),r.getTensorArray(v).write(O,S),[2,[t.scalar(1)]];case 10:return _=u("tensorArrayId",e,a,r),w=u("index",e,a,r),[2,[r.getTensorArray(_).read(w)]];case 11:return A=u("tensorArrayId",e,a,r),D=u("indices",e,a,r),E=u("dtype",e,a,r),[2,[r.getTensorArray(A).gather(D,E)]];case 12:return V=u("tensorArrayId",e,a,r),I=u("indices",e,a,r),k=u("tensor",e,a,r),r.getTensorArray(V).scatter(I,k),[2,[t.scalar(1)]];case 13:return C=u("tensorArrayId",e,a,r),M=r.getTensorArray(C),z=u("dtype",e,a,r),[2,[M.concat(z)]];case 14:return F=u("tensorArrayId",e,a,r),j=u("tensor",e,a,r),P=u("lengths",e,a,r),r.getTensorArray(F).split(P,j),[2,[t.scalar(1)]];case 15:return R=u("tensorArrayId",e,a,r),L=r.getTensorArray(R),[2,[t.scalar(L.size(),"int32")]];case 16:return B=u("tensorArrayId",e,a,r),r.getTensorArray(B).clearAndClose(),[2,[t.scalar(0)]];case 17:throw TypeError("Node type "+e.op+" is not implemented")}})})}(e,a,r);case"convolution":return X(e,a,r);case"creation":return Z(e,a,r);case"dynamic":return function(e,a,r){return s(this,void 0,void 0,function(){var n,s,p,i,m;return o(this,function(o){switch(o.label){case 0:switch(e.op){case"NonMaxSuppressionV3":case"NonMaxSuppressionV2":return[3,1];case"Where":return[3,3];case"ListDiff":return[3,5]}return[3,6];case 1:return n=u("boxes",e,a,r),s=u("scores",e,a,r),p=u("maxOutputSize",e,a,r),i=u("iouThreshold",e,a,r),m=u("scoreThreshold",e,a,r),[4,t.image.nonMaxSuppressionAsync(n,s,p,i,m)];case 2:return[2,[o.sent()]];case 3:return[4,t.whereAsync(u("condition",e,a,r).asType("bool"))];case 4:return[2,[o.sent()]];case 5:return[2,t.setdiff1dAsync(u("x",e,a,r),u("y",e,a,r))];case 6:throw TypeError("Node type "+e.op+" is not implemented")}})})}(e,a,r);case"evaluation":return Y(e,a,r);case"image":return $(e,a,r);case"graph":return J(e,a,r);case"logical":return ee(e,a,r);case"matrices":return te(e,a,r);case"normalization":return ae(e,a,r);case"reduction":return re(e,a,r);case"slice_join":return ne(e,a,r);case"spectral":return se(e,a,r);case"transformation":return oe(e,a,r);case"custom":var n=i(e.op);if(n&&n.customExecutor)return n.customExecutor(new W(e,a,r));throw TypeError("Custom op "+e.op+" is not registered.");default:throw TypeError("Unknown op '"+e.op+"'. File an issue at https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()")}}(e,a,r);return n instanceof Promise?n.then(function(e){return[].concat(e)}):[].concat(n)}var ie=function(){function e(e,t){this.weightMap=e,this.tensorArrayMap=t,this.rootContext={id:0,frameName:"",iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}return e.prototype.newFrame=function(e,t){return{id:e,frameName:t,iterationId:0}},Object.defineProperty(e.prototype,"currentContext",{get:function(){return this.contexts},set:function(e){this.contexts!==e&&(this.contexts=e,this.generateCurrentContextIds())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentContextId",{get:function(){return this._currentContextIds[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentContextIds",{get:function(){return this._currentContextIds},enumerable:!0,configurable:!0}),e.prototype.generateCurrentContextIds=function(){for(var e=[],t=0;t<this.contexts.length-1;t++){var a=this.contexts.slice(0,this.contexts.length-t);e.push(this.contextIdforContexts(a))}e.push(""),this._currentContextIds=e},e.prototype.contextIdforContexts=function(e){return e?e.map(function(e){return 0===e.id&&0===e.iterationId?"":e.frameName+"-"+e.iterationId}).join("/"):""},e.prototype.enterFrame=function(e){this.contexts&&(this.lastId++,this.contexts=this.contexts.slice(),this.contexts.push(this.newFrame(this.lastId,e)),this._currentContextIds.unshift(this.contextIdforContexts(this.contexts)))},e.prototype.exitFrame=function(){if(!(this.contexts&&this.contexts.length>1))throw new Error("Cannot exit frame, the context is empty");this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift()},e.prototype.nextIteration=function(){if(!(this.contexts&&this.contexts.length>0))throw new Error("Cannot increase frame iteration, the context is empty");this.contexts=this.contexts.slice(),this.lastId++;var e=Object.assign({},this.contexts[this.contexts.length-1]);e.iterationId+=1,e.id=this.lastId,this.contexts.splice(-1,1,e),this._currentContextIds.splice(0,1,this.contextIdforContexts(this.contexts))},e.prototype.getWeight=function(e){return this.weightMap[e]},e.prototype.addTensorArray=function(e){this.tensorArrayMap[e.id]=e},e.prototype.getTensorArray=function(e){return this.tensorArrayMap[e]},e}();function ue(e,t,a){for(var r=new Set,n=[],s=null,o=null,p=new Set,i=Object.keys(e).map(function(e){return y(e)[0]}),u=t.slice();u.length>0;){var m=u.pop();(de(m)||ye(m))&&null==s&&(o=(s=m).children.map(function(e){return e.name}).filter(function(e){return r.has(e)})),r.add(m.name),null==a[m.name]&&(-1===i.indexOf(m.name)&&(0!==m.inputs.length?m.inputs.forEach(function(e){p.has(e.name)||(p.add(e.name),u.push(e))}):n.push(m.name)))}return{inputs:e,outputs:t,usedNodes:r,missingInputs:n,dynamicNode:s,syncInputs:o}}var me=["Switch","Merge","Enter","Exit","NextIteration"],ce=["NonMaxSuppressionV2","NonMaxSuppressionV3","Where"];function de(e){return me.indexOf(e.op)>=0}function ye(e){return ce.indexOf(e.op)>=0}var le=function(){function e(e){this.graph=e,this.compiledMap=new Map,this._weightMap={},this.SEPERATOR=",",this._outputs=e.outputs,this._inputs=e.inputs,this._signature=e.signature}return Object.defineProperty(e.prototype,"weightMap",{get:function(){return this._weightMap},set:function(e){var t=Object.keys(e).map(function(t){return e[t].map(function(e){return e.id})});this.weightIds=[].concat.apply([],t),this._weightMap=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputs",{get:function(){return this._inputs.map(function(e){return{name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0}})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputs",{get:function(){return this._outputs.map(function(e){return{name:e.name,shape:e.attrParams.shape?e.attrParams.shape.value:void 0,dtype:e.attrParams.dtype?e.attrParams.dtype.value:void 0}})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputNodes",{get:function(){return this._inputs.map(function(e){return e.signatureKey||e.name})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputNodes",{get:function(){return this._outputs.map(function(e){return e.signatureKey||e.name})},enumerable:!0,configurable:!0}),e.prototype.getCompilationKey=function(e,t){var a=e.map(function(e){return e.name}).sort(),r=t.map(function(e){return e.name}).sort();return a.join(this.SEPERATOR)+"--"+r.join(this.SEPERATOR)},e.prototype.compile=function(e,t){var a=ue(e,t,this.weightMap),r=a.missingInputs,n=a.dynamicNode,s=a.syncInputs;if(null!=n)throw new Error("This execution contains the node '"+n.name+"', which has the dynamic op '"+n.op+"'. Please use model.executeAsync() instead. Alternatively, to avoid the dynamic ops, specify the inputs ["+s+"]");if(r.length>0){var o=t.map(function(e){return e.name}),p=Object.keys(e);throw new Error("Cannot compute the outputs ["+o+"] from the provided inputs ["+p+"]. Missing the following inputs: ["+r+"]")}return function(e,t,a){var r=a.usedNodes,n=a.inputs,s=[];Object.keys(n).map(function(e){return y(e)[0]}).map(function(t){return e.nodes[t]}).forEach(function(e){r.has(e.name)&&s.push(e)}),e.weights.forEach(function(e){r.has(e.name)&&s.push(e)});for(var o=new Set,p=[];s.length>0;){var i=s.pop();o.add(i.name),t[i.name]||p.push(i),i.children.forEach(function(e){!o.has(e.name)&&r.has(e.name)&&e.inputs.every(function(e){return o.has(e.name)})&&s.push(e)})}return p}(this.graph,this.weightMap,a)},e.prototype.execute=function(e,a){var r=this;e=this.mapInputs(e);var s=Object.keys(e).sort();this.checkInputs(e),this.checkInputShapeAndType(e),a=this.mapOutputs(a),this.checkOutputs(a);var o=s.map(function(e){return r.graph.nodes[y(e)[0]]}),p=a.map(function(e){return r.graph.nodes[y(e)[0]]}),i=this.getCompilationKey(o,p),u=this.compiledMap.get(i);null==u&&(u=this.compile(e,p),this.compiledMap.set(i,u));var c={};return t.tidy(function(){var t=new ie(r._weightMap,c),s=n({},r.weightMap);Object.keys(e).forEach(function(t){var a=y(t),r=a[0],n=[];n[a[1]]=e[t],s[r]=n});for(var o=r.getFrozenTensorIds(s),p={},i=0;i<u.length;i++){var d=u[i];if(!s[d.name]){var l=pe(d,s,t);if(l instanceof Promise)throw new Error("The execution of the op '"+d.op+"' returned a promise. Please use model.executeAsync() instead.");s[d.name]=l,r.checkTensorForDisposal(d.name,d,s,t,o,a,p)}}return a.map(function(e){return m(e,s,t)})})},e.prototype.getFrozenTensorIds=function(e){var t=[].concat.apply([],Object.keys(e).map(function(t){return e[t]}).map(function(e){return e.map(function(e){return e.id})}));return new Set(t)},e.prototype.checkTensorForDisposal=function(e,t,a,r,n,s,o){"control"!==t.category&&-1===s.indexOf(e)&&(a[e].forEach(function(e){null!=e&&(o[e.id]=(o[e.id]||0)+t.children.length)}),t.inputs.forEach(function(e){if("control"!==e.category){var t=function(e,t,a){return t[d(e,a.currentContextId)]}(e.name,a,r);null!=t&&t.forEach(function(e){if(e&&!n.has(e.id)){var t=o[e.id];1===t?(e.dispose(),delete o[e.id]):null!=t&&o[e.id]--}})}}))},e.prototype.executeAsync=function(e,t){return s(this,void 0,void 0,function(){var a,r,n,s,p,i,u=this;return o(this,function(o){switch(o.label){case 0:return e=this.mapInputs(e),this.checkInputs(e),this.checkInputShapeAndType(e),t=this.mapOutputs(t),this.checkOutputs(t),a={},r=new ie(this._weightMap,a),[4,this.executeWithControlFlow(e,r,t)];case 1:return n=o.sent(),s=t.map(function(e){return m(e,n,r)}),p=new Set(s.map(function(e){return e.id})),i=new Set(Object.keys(e).map(function(t){return e[t].id})),Object.keys(n).forEach(function(e){n[e].forEach(function(e){!e||e.isDisposed||p.has(e.id)||i.has(e.id)||-1!==u.weightIds.indexOf(e.id)||e.dispose()})}),[2,s]}})})},e.prototype.executeWithControlFlow=function(e,t,a){return s(this,void 0,void 0,function(){var r,s,p,i,u,c,d,l,f,h,N,g,b,x,T,v,O=this;return o(this,function(o){switch(o.label){case 0:r=Object.keys(e),s=r.map(function(e){return O.graph.nodes[y(e)[0]]}),p=a.map(function(e){return O.graph.nodes[y(e)[0]]}),i=ue(e,p,this.weightMap),u=i.usedNodes,c=i.missingInputs,d=i.dynamicNode,l=i.syncInputs,f=s.concat(this.graph.weights).map(function(e){return{node:e,contexts:t.currentContext}}),h=n({},this.weightMap),Object.keys(e).forEach(function(t){var a=y(t),r=a[0],n=[];n[a[1]]=e[t],h[r]=n}),N={},g=this.getFrozenTensorIds(h),b={},o.label=1;case 1:return f.length>0?(x=this.processStack(s,f,t,h,b,g,a,N,u),[4,Promise.all(x)]):[3,3];case 2:return o.sent(),[3,1];case 3:if(null==d&&console.warn("This model execution did not contain any nodes with control flow or dynamic output shapes. You can use model.execute() instead."),(T=p.filter(function(e){return!de(e)&&!m(e.name,h,t)}).map(function(e){return e.name})).length>0)throw v="",null!=d&&(v="Alternatively, to avoid the dynamic ops, use model.execute() and specify the inputs ["+l+"]"),new Error("Cannot compute the outputs ["+T+"] from the provided inputs ["+r+"]. Consider providing the following inputs: ["+c+"]. "+v);return[2,h]}})})},e.prototype.processStack=function(e,t,a,r,n,s,o,p,i){for(var m=this,d=[],y=function(){var y=t.pop();a.currentContext=y.contexts;var f="";if("Enter"===y.node.op&&u("isConstant",y.node,r,a)&&(f=c(y.node.name,a)[0]),-1===e.indexOf(y.node)){var h=pe(y.node,r,a);f||(f=c(y.node.name,a)[0]);var N=a.currentContext;h instanceof Promise?d.push(h.then(function(e){return r[f]=e,a.currentContext=N,m.checkTensorForDisposal(f,y.node,r,a,s,o,p),m.processChildNodes(y.node,t,a,r,n,i),e})):(r[f]=h,l.checkTensorForDisposal(f,y.node,r,a,s,o,p),l.processChildNodes(y.node,t,a,r,n,i))}else l.processChildNodes(y.node,t,a,r,n,i)},l=this;t.length>0;)y();return d},e.prototype.processChildNodes=function(e,t,a,r,n,s){e.children.forEach(function(e){var o=c(e.name,a)[0];!n[o]&&s.has(e.name)&&("Merge"===e.op?e.inputNames.some(function(e){return!!m(e,r,a)})&&(n[o]=!0,t.push({contexts:a.currentContext,node:e})):e.inputNames.every(function(e){return!!m(e,r,a)})&&(n[o]=!0,t.push({contexts:a.currentContext,node:e})))})},e.prototype.dispose=function(){var e=this;Object.keys(this.weightMap).forEach(function(t){return e.weightMap[t].forEach(function(e){return e.dispose()})})},e.prototype.checkInputShapeAndType=function(e){var a=this;Object.keys(e).forEach(function(r){var n=e[r],s=y(r)[0],o=a.graph.nodes[s];if(o.attrParams.shape&&o.attrParams.shape.value){var p=o.attrParams.shape.value,i=p.length===n.shape.length&&n.shape.every(function(e,t){return-1===p[t]||p[t]===e});t.util.assert(i,function(){return"The shape of dict['"+o.name+"'] provided in model.execute(dict) must be ["+p+"], but was ["+n.shape+"]"})}o.attrParams.dtype&&o.attrParams.dtype.value&&t.util.assert(n.dtype===o.attrParams.dtype.value,function(){return"The dtype of dict['"+o.name+"'] provided in model.execute(dict) must be "+o.attrParams.dtype.value+", but was "+n.dtype})})},e.prototype.mapInputs=function(e){var t={};for(var a in e){if(null!=this._signature&&null!=this._signature.inputs&&null!=this._signature.inputs[a])t[this._signature.inputs[a].name]=e[a];else t[a]=e[a]}return t},e.prototype.checkInputs=function(e){var t=this,a=Object.keys(e).filter(function(e){var a=y(e)[0];return null==t.graph.nodes[a]});if(a.length>0)throw new Error("The dict provided in model.execute(dict) has keys: ["+a+"] that are not part of graph")},e.prototype.mapOutputs=function(e){var t=this;return e.map(function(e){return null!=t._signature&&null!=t._signature.outputs&&null!=t._signature.outputs[e]?t._signature.outputs[e].name:e},{})},e.prototype.checkOutputs=function(e){var t=this;e.forEach(function(e){var a=y(e)[0];if(!t.graph.nodes[a])throw new Error("The output '"+e+"' is not found in the graph")})},e}(),fe="?tfjs-format=file",he="model.json",Ne=function(){function e(e,t){void 0===t&&(t={}),this.modelUrl=e,this.loadOptions=t,this.version="n/a",null==t&&(this.loadOptions={})}return Object.defineProperty(e.prototype,"modelVersion",{get:function(){return this.version},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputNodes",{get:function(){return this.executor.inputNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputNodes",{get:function(){return this.executor.outputNodes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputs",{get:function(){return this.executor.inputs},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputs",{get:function(){return this.executor.outputs},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"weights",{get:function(){return this.executor.weightMap},enumerable:!0,configurable:!0}),e.prototype.findIOHandler=function(){var e=this.modelUrl;if(null!=e.load)this.handler=e;else if(null!=this.loadOptions.requestInit)this.handler=t.io.browserHTTPRequest(e,this.loadOptions);else{var a=t.io.getLoadHandlers(e,this.loadOptions.onProgress);if(0===a.length)a.push(t.io.browserHTTPRequest(e,this.loadOptions));else if(a.length>1)throw new Error("Found more than one ("+a.length+") load handlers for URL '"+[e]+"'");this.handler=a[0]}},e.prototype.load=function(){return s(this,void 0,void 0,function(){var e,a,r,n;return o(this,function(s){switch(s.label){case 0:if(this.findIOHandler(),null==this.handler.load)throw new Error("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");return[4,this.handler.load()];case 1:return e=s.sent(),a=e.modelTopology,r={},null!=e.userDefinedMetadata&&(r=e.userDefinedMetadata.signature),this.version=a.versions.producer+"."+a.versions.minConsumer,n=t.io.decodeWeights(e.weightData,e.weightSpecs),this.executor=new le(I.Instance.transformGraph(a,r)),this.executor.weightMap=this.convertTensorMapToTensorsMap(n),[2,!0]}})})},e.prototype.predict=function(e,t){return this.execute(e,this.outputNodes)},e.prototype.normalizeInputs=function(e){if(!(e instanceof t.Tensor||Array.isArray(e)))return e;if((e=Array.isArray(e)?e:[e]).length!==this.inputNodes.length)throw new Error("Input tensor count mismatch,the graph model has "+this.inputNodes.length+" placeholders, while there are "+e.length+" input tensors.");return this.inputNodes.reduce(function(t,a,r){return t[a]=e[r],t},{})},e.prototype.normalizeOutputs=function(e){return e=e||this.outputNodes,Array.isArray(e)?e:[e]},e.prototype.execute=function(e,t){e=this.normalizeInputs(e),t=this.normalizeOutputs(t);var a=this.executor.execute(e,t);return a.length>1?a:a[0]},e.prototype.executeAsync=function(e,t){return s(this,void 0,void 0,function(){var a;return o(this,function(r){switch(r.label){case 0:return e=this.normalizeInputs(e),t=this.normalizeOutputs(t),[4,this.executor.executeAsync(e,t)];case 1:return[2,(a=r.sent()).length>1?a:a[0]]}})})},e.prototype.convertTensorMapToTensorsMap=function(e){return Object.keys(e).reduce(function(t,a){return t[a]=[e[a]],t},{})},e.prototype.dispose=function(){this.executor.dispose()},e}();e.GraphModel=Ne,e.loadGraphModel=function(e,t){return void 0===t&&(t={}),s(this,void 0,void 0,function(){var a;return o(this,function(r){switch(r.label){case 0:if(null==e)throw new Error("modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model");return null==t&&(t={}),t.fromTFHub&&null==e.load&&(e.endsWith("/")||(e+="/"),e=""+e+he+fe),[4,(a=new Ne(e,t)).load()];case 1:return r.sent(),[2,a]}})})},e.deregisterOp=function(e){delete p[e]},e.registerOp=function(e,t){var a={tfOpName:e,category:"custom",inputs:[],attrs:[],customExecutor:t};p[e]=a},e.version_converter="1.5.1",Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=tf-converter.min.js.map
