UNPKG

@tensorflow-models/coco-ssd

Version:

Object detection model (coco-ssd) in TensorFlow.js

17 lines 149 kB
/** * @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(exports,tfc){"use strict";var __assign=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};function __awaiter(e,t,a,r){return new(a||(a=Promise))(function(n,o){function s(e){try{p(r.next(e))}catch(e){o(e)}}function i(e){try{p(r.throw(e))}catch(e){o(e)}}function p(e){e.done?n(e.value):new a(function(t){t(e.value)}).then(s,i)}p((r=r.apply(e,t||[])).next())})}function __generator(e,t){var a,r,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(o){return function(i){return function(o){if(a)throw new TypeError("Generator is already executing.");for(;s;)try{if(a=1,r&&(n=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[0,n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=(n=s.trys).length>0&&n[n.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{a=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,i])}}}var commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var aspromise=asPromise;function asPromise(e,t){for(var a=new Array(arguments.length-1),r=0,n=2,o=!0;n<arguments.length;)a[r++]=arguments[n++];return new Promise(function(n,s){a[r]=function(e){if(o)if(o=!1,e)s(e);else{for(var t=new Array(arguments.length-1),a=0;a<t.length;)t[a++]=arguments[a];n.apply(null,t)}};try{e.apply(t||null,a)}catch(e){o&&(o=!1,s(e))}})}var base64_1=createCommonjsModule(function(e,t){var a=t;a.length=function(e){var t=e.length;if(!t)return 0;for(var a=0;--t%4>1&&"="===e.charAt(t);)++a;return Math.ceil(3*e.length)/4-a};for(var r=new Array(64),n=new Array(123),o=0;o<64;)n[r[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;a.encode=function(e,t,a){for(var n,o=null,s=[],i=0,p=0;t<a;){var u=e[t++];switch(p){case 0:s[i++]=r[u>>2],n=(3&u)<<4,p=1;break;case 1:s[i++]=r[n|u>>4],n=(15&u)<<2,p=2;break;case 2:s[i++]=r[n|u>>6],s[i++]=r[63&u],p=0}i>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),i=0)}return p&&(s[i++]=r[n],s[i++]=61,1===p&&(s[i++]=61)),o?(i&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))};a.decode=function(e,t,a){for(var r,o=a,s=0,i=0;i<e.length;){var p=e.charCodeAt(i++);if(61===p&&s>1)break;if(void 0===(p=n[p]))throw Error("invalid encoding");switch(s){case 0:r=p,s=1;break;case 1:t[a++]=r<<2|(48&p)>>4,r=p,s=2;break;case 2:t[a++]=(15&r)<<4|(60&p)>>2,r=p,s=3;break;case 3:t[a++]=(3&r)<<6|p,s=0}}if(1===s)throw Error("invalid encoding");return a-o},a.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}}),eventemitter=EventEmitter;function EventEmitter(){this._listeners={}}EventEmitter.prototype.on=function(e,t,a){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:a||this}),this},EventEmitter.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var a=this._listeners[e],r=0;r<a.length;)a[r].fn===t?a.splice(r,1):++r;return this},EventEmitter.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var a=[],r=1;r<arguments.length;)a.push(arguments[r++]);for(r=0;r<t.length;)t[r].fn.apply(t[r++].ctx,a)}return this};var float_1=factory(factory);function factory(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),a=new Uint8Array(t.buffer),r=128===a[3];function n(e,r,n){t[0]=e,r[n]=a[0],r[n+1]=a[1],r[n+2]=a[2],r[n+3]=a[3]}function o(e,r,n){t[0]=e,r[n]=a[3],r[n+1]=a[2],r[n+2]=a[1],r[n+3]=a[0]}function s(e,r){return a[0]=e[r],a[1]=e[r+1],a[2]=e[r+2],a[3]=e[r+3],t[0]}function i(e,r){return a[3]=e[r],a[2]=e[r+1],a[1]=e[r+2],a[0]=e[r+3],t[0]}e.writeFloatLE=r?n:o,e.writeFloatBE=r?o:n,e.readFloatLE=r?s:i,e.readFloatBE=r?i:s}():function(){function t(e,t,a,r){var n=t<0?1:0;if(n&&(t=-t),0===t)e(1/t>0?0:2147483648,a,r);else if(isNaN(t))e(2143289344,a,r);else if(t>3.4028234663852886e38)e((n<<31|2139095040)>>>0,a,r);else if(t<1.1754943508222875e-38)e((n<<31|Math.round(t/1.401298464324817e-45))>>>0,a,r);else{var o=Math.floor(Math.log(t)/Math.LN2);e((n<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,a,r)}}function a(e,t,a){var r=e(t,a),n=2*(r>>31)+1,o=r>>>23&255,s=8388607&r;return 255===o?s?NaN:n*(1/0):0===o?1.401298464324817e-45*n*s:n*Math.pow(2,o-150)*(s+8388608)}e.writeFloatLE=t.bind(null,writeUintLE),e.writeFloatBE=t.bind(null,writeUintBE),e.readFloatLE=a.bind(null,readUintLE),e.readFloatBE=a.bind(null,readUintBE)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),a=new Uint8Array(t.buffer),r=128===a[7];function n(e,r,n){t[0]=e,r[n]=a[0],r[n+1]=a[1],r[n+2]=a[2],r[n+3]=a[3],r[n+4]=a[4],r[n+5]=a[5],r[n+6]=a[6],r[n+7]=a[7]}function o(e,r,n){t[0]=e,r[n]=a[7],r[n+1]=a[6],r[n+2]=a[5],r[n+3]=a[4],r[n+4]=a[3],r[n+5]=a[2],r[n+6]=a[1],r[n+7]=a[0]}function s(e,r){return a[0]=e[r],a[1]=e[r+1],a[2]=e[r+2],a[3]=e[r+3],a[4]=e[r+4],a[5]=e[r+5],a[6]=e[r+6],a[7]=e[r+7],t[0]}function i(e,r){return a[7]=e[r],a[6]=e[r+1],a[5]=e[r+2],a[4]=e[r+3],a[3]=e[r+4],a[2]=e[r+5],a[1]=e[r+6],a[0]=e[r+7],t[0]}e.writeDoubleLE=r?n:o,e.writeDoubleBE=r?o:n,e.readDoubleLE=r?s:i,e.readDoubleBE=r?i:s}():function(){function t(e,t,a,r,n,o){var s=r<0?1:0;if(s&&(r=-r),0===r)e(0,n,o+t),e(1/r>0?0:2147483648,n,o+a);else if(isNaN(r))e(0,n,o+t),e(2146959360,n,o+a);else if(r>1.7976931348623157e308)e(0,n,o+t),e((s<<31|2146435072)>>>0,n,o+a);else{var i;if(r<2.2250738585072014e-308)e((i=r/5e-324)>>>0,n,o+t),e((s<<31|i/4294967296)>>>0,n,o+a);else{var p=Math.floor(Math.log(r)/Math.LN2);1024===p&&(p=1023),e(4503599627370496*(i=r*Math.pow(2,-p))>>>0,n,o+t),e((s<<31|p+1023<<20|1048576*i&1048575)>>>0,n,o+a)}}}function a(e,t,a,r,n){var o=e(r,n+t),s=e(r,n+a),i=2*(s>>31)+1,p=s>>>20&2047,u=4294967296*(1048575&s)+o;return 2047===p?u?NaN:i*(1/0):0===p?5e-324*i*u:i*Math.pow(2,p-1075)*(u+4503599627370496)}e.writeDoubleLE=t.bind(null,writeUintLE,0,4),e.writeDoubleBE=t.bind(null,writeUintBE,4,0),e.readDoubleLE=a.bind(null,readUintLE,0,4),e.readDoubleBE=a.bind(null,readUintBE,4,0)}(),e}function writeUintLE(e,t,a){t[a]=255&e,t[a+1]=e>>>8&255,t[a+2]=e>>>16&255,t[a+3]=e>>>24}function writeUintBE(e,t,a){t[a]=e>>>24,t[a+1]=e>>>16&255,t[a+2]=e>>>8&255,t[a+3]=255&e}function readUintLE(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function readUintBE(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}var inquire_1=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}var utf8_1=createCommonjsModule(function(e,t){var a=t;a.length=function(e){for(var t=0,a=0,r=0;r<e.length;++r)(a=e.charCodeAt(r))<128?t+=1:a<2048?t+=2:55296==(64512&a)&&56320==(64512&e.charCodeAt(r+1))?(++r,t+=4):t+=3;return t},a.read=function(e,t,a){if(a-t<1)return"";for(var r,n=null,o=[],s=0;t<a;)(r=e[t++])<128?o[s++]=r:r>191&&r<224?o[s++]=(31&r)<<6|63&e[t++]:r>239&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(r>>10),o[s++]=56320+(1023&r)):o[s++]=(15&r)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,o)),s=0);return n?(s&&n.push(String.fromCharCode.apply(String,o.slice(0,s))),n.join("")):String.fromCharCode.apply(String,o.slice(0,s))},a.write=function(e,t,a){for(var r,n,o=a,s=0;s<e.length;++s)(r=e.charCodeAt(s))<128?t[a++]=r:r<2048?(t[a++]=r>>6|192,t[a++]=63&r|128):55296==(64512&r)&&56320==(64512&(n=e.charCodeAt(s+1)))?(r=65536+((1023&r)<<10)+(1023&n),++s,t[a++]=r>>18|240,t[a++]=r>>12&63|128,t[a++]=r>>6&63|128,t[a++]=63&r|128):(t[a++]=r>>12|224,t[a++]=r>>6&63|128,t[a++]=63&r|128);return a-o}}),pool_1=pool;function pool(e,t,a){var r=a||8192,n=r>>>1,o=null,s=r;return function(a){if(a<1||a>n)return e(a);s+a>r&&(o=e(r),s=0);var i=t.call(o,s,s+=a);return 7&s&&(s=1+(7|s)),i}}var longbits=LongBits;function LongBits(e,t){this.lo=e>>>0,this.hi=t>>>0}var zero=LongBits.zero=new LongBits(0,0);zero.toNumber=function(){return 0},zero.zzEncode=zero.zzDecode=function(){return this},zero.length=function(){return 1};var zeroHash=LongBits.zeroHash="\0\0\0\0\0\0\0\0";LongBits.fromNumber=function(e){if(0===e)return zero;var t=e<0;t&&(e=-e);var a=e>>>0,r=(e-a)/4294967296>>>0;return t&&(r=~r>>>0,a=~a>>>0,++a>4294967295&&(a=0,++r>4294967295&&(r=0))),new LongBits(a,r)},LongBits.from=function(e){if("number"==typeof e)return LongBits.fromNumber(e);if(minimal.isString(e)){if(!minimal.Long)return LongBits.fromNumber(parseInt(e,10));e=minimal.Long.fromString(e)}return e.low||e.high?new LongBits(e.low>>>0,e.high>>>0):zero},LongBits.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,a=~this.hi>>>0;return t||(a=a+1>>>0),-(t+4294967296*a)}return this.lo+4294967296*this.hi},LongBits.prototype.toLong=function(e){return minimal.Long?new minimal.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var charCodeAt=String.prototype.charCodeAt;LongBits.fromHash=function(e){return e===zeroHash?zero:new LongBits((charCodeAt.call(e,0)|charCodeAt.call(e,1)<<8|charCodeAt.call(e,2)<<16|charCodeAt.call(e,3)<<24)>>>0,(charCodeAt.call(e,4)|charCodeAt.call(e,5)<<8|charCodeAt.call(e,6)<<16|charCodeAt.call(e,7)<<24)>>>0)},LongBits.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},LongBits.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},LongBits.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},LongBits.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,a=this.hi>>>24;return 0===a?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:a<128?9:10};var minimal=createCommonjsModule(function(e,t){var a=t;function r(e,t,a){for(var r=Object.keys(t),n=0;n<r.length;++n)void 0!==e[r[n]]&&a||(e[r[n]]=t[r[n]]);return e}function n(e){function t(e,a){if(!(this instanceof t))return new t(e,a);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),a&&r(this,a)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}a.asPromise=aspromise,a.base64=base64_1,a.EventEmitter=eventemitter,a.float=float_1,a.inquire=inquire_1,a.utf8=utf8_1,a.pool=pool_1,a.LongBits=longbits,a.global="undefined"!=typeof window&&window||void 0!==commonjsGlobal&&commonjsGlobal||"undefined"!=typeof self&&self||commonjsGlobal,a.emptyArray=Object.freeze?Object.freeze([]):[],a.emptyObject=Object.freeze?Object.freeze({}):{},a.isNode=Boolean(a.global.process&&a.global.process.versions&&a.global.process.versions.node),a.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},a.isString=function(e){return"string"==typeof e||e instanceof String},a.isObject=function(e){return e&&"object"==typeof e},a.isset=a.isSet=function(e,t){var a=e[t];return!(null==a||!e.hasOwnProperty(t))&&("object"!=typeof a||(Array.isArray(a)?a.length:Object.keys(a).length)>0)},a.Buffer=function(){try{var e=a.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),a._Buffer_from=null,a._Buffer_allocUnsafe=null,a.newBuffer=function(e){return"number"==typeof e?a.Buffer?a._Buffer_allocUnsafe(e):new a.Array(e):a.Buffer?a._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},a.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,a.Long=a.global.dcodeIO&&a.global.dcodeIO.Long||a.global.Long||a.inquire("long"),a.key2Re=/^true|false|0|1$/,a.key32Re=/^-?(?:0|[1-9][0-9]*)$/,a.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,a.longToHash=function(e){return e?a.LongBits.from(e).toHash():a.LongBits.zeroHash},a.longFromHash=function(e,t){var r=a.LongBits.fromHash(e);return a.Long?a.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},a.merge=r,a.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},a.newError=n,a.ProtocolError=n("ProtocolError"),a.oneOfGetter=function(e){for(var t={},a=0;a<e.length;++a)t[e[a]]=1;return function(){for(var e=Object.keys(this),a=e.length-1;a>-1;--a)if(1===t[e[a]]&&void 0!==this[e[a]]&&null!==this[e[a]])return e[a]}},a.oneOfSetter=function(e){return function(t){for(var a=0;a<e.length;++a)e[a]!==t&&delete this[e[a]]}},a.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},a._configure=function(){var e=a.Buffer;e?(a._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,a){return new e(t,a)},a._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):a._Buffer_from=a._Buffer_allocUnsafe=null}}),writer=Writer,BufferWriter,LongBits$1=minimal.LongBits,base64=minimal.base64,utf8=minimal.utf8;function Op(e,t,a){this.fn=e,this.len=t,this.next=void 0,this.val=a}function noop(){}function State(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function Writer(){this.len=0,this.head=new Op(noop,0,0),this.tail=this.head,this.states=null}function writeByte(e,t,a){t[a]=255&e}function writeVarint32(e,t,a){for(;e>127;)t[a++]=127&e|128,e>>>=7;t[a]=e}function VarintOp(e,t){this.len=e,this.next=void 0,this.val=t}function writeVarint64(e,t,a){for(;e.hi;)t[a++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[a++]=127&e.lo|128,e.lo=e.lo>>>7;t[a++]=e.lo}function writeFixed32(e,t,a){t[a]=255&e,t[a+1]=e>>>8&255,t[a+2]=e>>>16&255,t[a+3]=e>>>24}Writer.create=minimal.Buffer?function(){return(Writer.create=function(){return new BufferWriter})()}:function(){return new Writer},Writer.alloc=function(e){return new minimal.Array(e)},minimal.Array!==Array&&(Writer.alloc=minimal.pool(Writer.alloc,minimal.Array.prototype.subarray)),Writer.prototype._push=function(e,t,a){return this.tail=this.tail.next=new Op(e,t,a),this.len+=t,this},VarintOp.prototype=Object.create(Op.prototype),VarintOp.prototype.fn=writeVarint32,Writer.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new VarintOp((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},Writer.prototype.int32=function(e){return e<0?this._push(writeVarint64,10,LongBits$1.fromNumber(e)):this.uint32(e)},Writer.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},Writer.prototype.uint64=function(e){var t=LongBits$1.from(e);return this._push(writeVarint64,t.length(),t)},Writer.prototype.int64=Writer.prototype.uint64,Writer.prototype.sint64=function(e){var t=LongBits$1.from(e).zzEncode();return this._push(writeVarint64,t.length(),t)},Writer.prototype.bool=function(e){return this._push(writeByte,1,e?1:0)},Writer.prototype.fixed32=function(e){return this._push(writeFixed32,4,e>>>0)},Writer.prototype.sfixed32=Writer.prototype.fixed32,Writer.prototype.fixed64=function(e){var t=LongBits$1.from(e);return this._push(writeFixed32,4,t.lo)._push(writeFixed32,4,t.hi)},Writer.prototype.sfixed64=Writer.prototype.fixed64,Writer.prototype.float=function(e){return this._push(minimal.float.writeFloatLE,4,e)},Writer.prototype.double=function(e){return this._push(minimal.float.writeDoubleLE,8,e)};var writeBytes=minimal.Array.prototype.set?function(e,t,a){t.set(e,a)}:function(e,t,a){for(var r=0;r<e.length;++r)t[a+r]=e[r]};Writer.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(writeByte,1,0);if(minimal.isString(e)){var a=Writer.alloc(t=base64.length(e));base64.decode(e,a,0),e=a}return this.uint32(t)._push(writeBytes,t,e)},Writer.prototype.string=function(e){var t=utf8.length(e);return t?this.uint32(t)._push(utf8.write,t,e):this._push(writeByte,1,0)},Writer.prototype.fork=function(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this},Writer.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this},Writer.prototype.ldelim=function(){var e=this.head,t=this.tail,a=this.len;return this.reset().uint32(a),a&&(this.tail.next=e.next,this.tail=t,this.len+=a),this},Writer.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),a=0;e;)e.fn(e.val,t,a),a+=e.len,e=e.next;return t},Writer._configure=function(e){BufferWriter=e};var writer_buffer=BufferWriter$1;(BufferWriter$1.prototype=Object.create(writer.prototype)).constructor=BufferWriter$1;var Buffer$1=minimal.Buffer;function BufferWriter$1(){writer.call(this)}BufferWriter$1.alloc=function(e){return(BufferWriter$1.alloc=minimal._Buffer_allocUnsafe)(e)};var writeBytesBuffer=Buffer$1&&Buffer$1.prototype instanceof Uint8Array&&"set"===Buffer$1.prototype.set.name?function(e,t,a){t.set(e,a)}:function(e,t,a){if(e.copy)e.copy(t,a,0,e.length);else for(var r=0;r<e.length;)t[a++]=e[r++]};function writeStringBuffer(e,t,a){e.length<40?minimal.utf8.write(e,t,a):t.utf8Write(e,a)}BufferWriter$1.prototype.bytes=function(e){minimal.isString(e)&&(e=minimal._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(writeBytesBuffer,t,e),this},BufferWriter$1.prototype.string=function(e){var t=Buffer$1.byteLength(e);return this.uint32(t),t&&this._push(writeStringBuffer,t,e),this};var reader=Reader,BufferReader,LongBits$2=minimal.LongBits,utf8$1=minimal.utf8;function indexOutOfRange(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function Reader(e){this.buf=e,this.pos=0,this.len=e.length}var create_array="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new Reader(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new Reader(e);throw Error("illegal buffer")},value;function readLongVarint(){var e=new LongBits$2(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw indexOutOfRange(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw indexOutOfRange(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function readFixed32_end(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits$2(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader.create=minimal.Buffer?function(e){return(Reader.create=function(e){return minimal.Buffer.isBuffer(e)?new BufferReader(e):create_array(e)})(e)}:create_array,Reader.prototype._slice=minimal.Array.prototype.subarray||minimal.Array.prototype.slice,Reader.prototype.uint32=(value=4294967295,function(){if(value=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return value;if(value=(value|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return value;if(value=(value|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return value;if(value=(value|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return value;if(value=(value|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return value;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return value}),Reader.prototype.int32=function(){return 0|this.uint32()},Reader.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},Reader.prototype.bool=function(){return 0!==this.uint32()},Reader.prototype.fixed32=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)},Reader.prototype.sfixed32=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return 0|readFixed32_end(this.buf,this.pos+=4)},Reader.prototype.float=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var e=minimal.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},Reader.prototype.double=function(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var e=minimal.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},Reader.prototype.bytes=function(){var e=this.uint32(),t=this.pos,a=this.pos+e;if(a>this.len)throw indexOutOfRange(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,a):t===a?new this.buf.constructor(0):this._slice.call(this.buf,t,a)},Reader.prototype.string=function(){var e=this.bytes();return utf8$1.read(e,0,e.length)},Reader.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw indexOutOfRange(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw indexOutOfRange(this)}while(128&this.buf[this.pos++]);return this},Reader.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},Reader._configure=function(e){BufferReader=e;var t=minimal.Long?"toLong":"toNumber";minimal.merge(Reader.prototype,{int64:function(){return readLongVarint.call(this)[t](!1)},uint64:function(){return readLongVarint.call(this)[t](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[t](!1)},fixed64:function(){return readFixed64.call(this)[t](!0)},sfixed64:function(){return readFixed64.call(this)[t](!1)}})};var reader_buffer=BufferReader$1;function BufferReader$1(e){reader.call(this,e)}(BufferReader$1.prototype=Object.create(reader.prototype)).constructor=BufferReader$1,minimal.Buffer&&(BufferReader$1.prototype._slice=minimal.Buffer.prototype.slice),BufferReader$1.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len))};var service=Service;function Service(e,t,a){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");minimal.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(a)}(Service.prototype=Object.create(minimal.EventEmitter.prototype)).constructor=Service,Service.prototype.rpcCall=function e(t,a,r,n,o){if(!n)throw TypeError("request must be specified");var s=this;if(!o)return minimal.asPromise(e,s,t,a,r,n);if(s.rpcImpl)try{return s.rpcImpl(t,a[s.requestDelimited?"encodeDelimited":"encode"](n).finish(),function(e,a){if(e)return s.emit("error",e,t),o(e);if(null!==a){if(!(a instanceof r))try{a=r[s.responseDelimited?"decodeDelimited":"decode"](a)}catch(e){return s.emit("error",e,t),o(e)}return s.emit("data",a,t),o(null,a)}s.end(!0)})}catch(e){return s.emit("error",e,t),void setTimeout(function(){o(e)},0)}else setTimeout(function(){o(Error("already ended"))},0)},Service.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this};var rpc_1=createCommonjsModule(function(e,t){t.Service=service}),roots={},indexMinimal=createCommonjsModule(function(e,t){var a=t;function r(){a.Reader._configure(a.BufferReader),a.util._configure()}a.build="minimal",a.Writer=writer,a.BufferWriter=writer_buffer,a.Reader=reader,a.BufferReader=reader_buffer,a.util=minimal,a.rpc=rpc_1,a.roots=roots,a.configure=r,a.Writer._configure(a.BufferWriter),r()}),minimal$1=indexMinimal,minimal_1=minimal$1.roots,minimal_2=minimal$1.Reader,minimal_3=minimal$1.util,$Reader=minimal$1.Reader,$util=minimal$1.util,$root=minimal$1.roots.default||(minimal$1.roots.default={}),valuesById,values,tensorflow;$root.tensorflow=(tensorflow={},tensorflow.Any=function(){function e(e){if(e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.typeUrl="",e.prototype.value=$util.newBuffer([]),e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.Any;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.typeUrl=e.string();break;case 2:r.value=e.bytes();break;default:e.skipType(7&n)}}return r},e}(),tensorflow.DataType=(valuesById={},(values=Object.create(valuesById))[valuesById[0]="DT_INVALID"]=0,values[valuesById[1]="DT_FLOAT"]=1,values[valuesById[2]="DT_DOUBLE"]=2,values[valuesById[3]="DT_INT32"]=3,values[valuesById[4]="DT_UINT8"]=4,values[valuesById[5]="DT_INT16"]=5,values[valuesById[6]="DT_INT8"]=6,values[valuesById[7]="DT_STRING"]=7,values[valuesById[8]="DT_COMPLEX64"]=8,values[valuesById[9]="DT_INT64"]=9,values[valuesById[10]="DT_BOOL"]=10,values[valuesById[11]="DT_QINT8"]=11,values[valuesById[12]="DT_QUINT8"]=12,values[valuesById[13]="DT_QINT32"]=13,values[valuesById[14]="DT_BFLOAT16"]=14,values[valuesById[101]="DT_FLOAT_REF"]=101,values[valuesById[102]="DT_DOUBLE_REF"]=102,values[valuesById[103]="DT_INT32_REF"]=103,values[valuesById[104]="DT_UINT8_REF"]=104,values[valuesById[105]="DT_INT16_REF"]=105,values[valuesById[106]="DT_INT8_REF"]=106,values[valuesById[107]="DT_STRING_REF"]=107,values[valuesById[108]="DT_COMPLEX64_REF"]=108,values[valuesById[109]="DT_INT64_REF"]=109,values[valuesById[110]="DT_BOOL_REF"]=110,values[valuesById[111]="DT_QINT8_REF"]=111,values[valuesById[112]="DT_QUINT8_REF"]=112,values[valuesById[113]="DT_QINT32_REF"]=113,values[valuesById[114]="DT_BFLOAT16_REF"]=114,values),tensorflow.TensorShape=function(){function e(e){if(this.dim=[],e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.dim=$util.emptyArray,e.prototype.unknownRank=!1,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.TensorShape;e.pos<a;){var n=e.uint32();switch(n>>>3){case 2:r.dim&&r.dim.length||(r.dim=[]),r.dim.push($root.tensorflow.TensorShape.Dim.decode(e,e.uint32()));break;case 3:r.unknownRank=e.bool();break;default:e.skipType(7&n)}}return r},e.Dim=function(){function e(e){if(e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.size=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.name="",e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.TensorShape.Dim;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.size=e.int64();break;case 2:r.name=e.string();break;default:e.skipType(7&n)}}return r},e}(),e}(),tensorflow.Tensor=function(){function e(e){if(this.floatVal=[],this.doubleVal=[],this.intVal=[],this.stringVal=[],this.scomplexVal=[],this.int64Val=[],this.boolVal=[],this.uint32Val=[],this.uint64Val=[],e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.dtype=0,e.prototype.tensorShape=null,e.prototype.versionNumber=0,e.prototype.tensorContent=$util.newBuffer([]),e.prototype.floatVal=$util.emptyArray,e.prototype.doubleVal=$util.emptyArray,e.prototype.intVal=$util.emptyArray,e.prototype.stringVal=$util.emptyArray,e.prototype.scomplexVal=$util.emptyArray,e.prototype.int64Val=$util.emptyArray,e.prototype.boolVal=$util.emptyArray,e.prototype.uint32Val=$util.emptyArray,e.prototype.uint64Val=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.Tensor;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.dtype=e.int32();break;case 2:r.tensorShape=$root.tensorflow.TensorShape.decode(e,e.uint32());break;case 3:r.versionNumber=e.int32();break;case 4:r.tensorContent=e.bytes();break;case 5:if(r.floatVal&&r.floatVal.length||(r.floatVal=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)r.floatVal.push(e.float());else r.floatVal.push(e.float());break;case 6:if(r.doubleVal&&r.doubleVal.length||(r.doubleVal=[]),2==(7&n))for(o=e.uint32()+e.pos;e.pos<o;)r.doubleVal.push(e.double());else r.doubleVal.push(e.double());break;case 7:if(r.intVal&&r.intVal.length||(r.intVal=[]),2==(7&n))for(o=e.uint32()+e.pos;e.pos<o;)r.intVal.push(e.int32());else r.intVal.push(e.int32());break;case 8:r.stringVal&&r.stringVal.length||(r.stringVal=[]),r.stringVal.push(e.bytes());break;case 9:if(r.scomplexVal&&r.scomplexVal.length||(r.scomplexVal=[]),2==(7&n))for(o=e.uint32()+e.pos;e.pos<o;)r.scomplexVal.push(e.float());else r.scomplexVal.push(e.float());break;case 10:if(r.int64Val&&r.int64Val.length||(r.int64Val=[]),2==(7&n))for(o=e.uint32()+e.pos;e.pos<o;)r.int64Val.push(e.int64());else r.int64Val.push(e.int64());break;case 11:if(r.boolVal&&r.boolVal.length||(r.boolVal=[]),2==(7&n))for(o=e.uint32()+e.pos;e.pos<o;)r.boolVal.push(e.bool());else r.boolVal.push(e.bool());break;case 16:if(r.uint32Val&&r.uint32Val.length||(r.uint32Val=[]),2==(7&n))for(o=e.uint32()+e.pos;e.pos<o;)r.uint32Val.push(e.uint32());else r.uint32Val.push(e.uint32());break;case 17:if(r.uint64Val&&r.uint64Val.length||(r.uint64Val=[]),2==(7&n))for(o=e.uint32()+e.pos;e.pos<o;)r.uint64Val.push(e.uint64());else r.uint64Val.push(e.uint64());break;default:e.skipType(7&n)}}return r},e}(),tensorflow.AttrValue=function(){function e(e){if(e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}var t;return e.prototype.list=null,e.prototype.s=$util.newBuffer([]),e.prototype.i=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.f=0,e.prototype.b=!1,e.prototype.type=0,e.prototype.shape=null,e.prototype.tensor=null,e.prototype.placeholder="",e.prototype.func=null,Object.defineProperty(e.prototype,"value",{get:$util.oneOfGetter(t=["list","s","i","f","b","type","shape","tensor","placeholder","func"]),set:$util.oneOfSetter(t)}),e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.AttrValue;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.list=$root.tensorflow.AttrValue.ListValue.decode(e,e.uint32());break;case 2:r.s=e.bytes();break;case 3:r.i=e.int64();break;case 4:r.f=e.float();break;case 5:r.b=e.bool();break;case 6:r.type=e.int32();break;case 7:r.shape=$root.tensorflow.TensorShape.decode(e,e.uint32());break;case 8:r.tensor=$root.tensorflow.Tensor.decode(e,e.uint32());break;case 9:r.placeholder=e.string();break;case 10:r.func=$root.tensorflow.NameAttrList.decode(e,e.uint32());break;default:e.skipType(7&n)}}return r},e.ListValue=function(){function e(e){if(this.s=[],this.i=[],this.f=[],this.b=[],this.type=[],this.shape=[],this.tensor=[],this.func=[],e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.s=$util.emptyArray,e.prototype.i=$util.emptyArray,e.prototype.f=$util.emptyArray,e.prototype.b=$util.emptyArray,e.prototype.type=$util.emptyArray,e.prototype.shape=$util.emptyArray,e.prototype.tensor=$util.emptyArray,e.prototype.func=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.AttrValue.ListValue;e.pos<a;){var n=e.uint32();switch(n>>>3){case 2:r.s&&r.s.length||(r.s=[]),r.s.push(e.bytes());break;case 3:if(r.i&&r.i.length||(r.i=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)r.i.push(e.int64());else r.i.push(e.int64());break;case 4:if(r.f&&r.f.length||(r.f=[]),2==(7&n))for(o=e.uint32()+e.pos;e.pos<o;)r.f.push(e.float());else r.f.push(e.float());break;case 5:if(r.b&&r.b.length||(r.b=[]),2==(7&n))for(o=e.uint32()+e.pos;e.pos<o;)r.b.push(e.bool());else r.b.push(e.bool());break;case 6:if(r.type&&r.type.length||(r.type=[]),2==(7&n))for(o=e.uint32()+e.pos;e.pos<o;)r.type.push(e.int32());else r.type.push(e.int32());break;case 7:r.shape&&r.shape.length||(r.shape=[]),r.shape.push($root.tensorflow.TensorShape.decode(e,e.uint32()));break;case 8:r.tensor&&r.tensor.length||(r.tensor=[]),r.tensor.push($root.tensorflow.Tensor.decode(e,e.uint32()));break;case 9:r.func&&r.func.length||(r.func=[]),r.func.push($root.tensorflow.NameAttrList.decode(e,e.uint32()));break;default:e.skipType(7&n)}}return r},e}(),e}(),tensorflow.NameAttrList=function(){function e(e){if(this.attr={},e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.name="",e.prototype.attr=$util.emptyObject,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a,r=void 0===t?e.len:e.pos+t,n=new $root.tensorflow.NameAttrList;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.name=e.string();break;case 2:e.skip().pos++,n.attr===$util.emptyObject&&(n.attr={}),a=e.string(),e.pos++,n.attr[a]=$root.tensorflow.AttrValue.decode(e,e.uint32());break;default:e.skipType(7&o)}}return n},e}(),tensorflow.NodeDef=function(){function e(e){if(this.input=[],this.attr={},e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.name="",e.prototype.op="",e.prototype.input=$util.emptyArray,e.prototype.device="",e.prototype.attr=$util.emptyObject,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a,r=void 0===t?e.len:e.pos+t,n=new $root.tensorflow.NodeDef;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.name=e.string();break;case 2:n.op=e.string();break;case 3:n.input&&n.input.length||(n.input=[]),n.input.push(e.string());break;case 4:n.device=e.string();break;case 5:e.skip().pos++,n.attr===$util.emptyObject&&(n.attr={}),a=e.string(),e.pos++,n.attr[a]=$root.tensorflow.AttrValue.decode(e,e.uint32());break;default:e.skipType(7&o)}}return n},e}(),tensorflow.VersionDef=function(){function e(e){if(this.badConsumers=[],e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.producer=0,e.prototype.minConsumer=0,e.prototype.badConsumers=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.VersionDef;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.producer=e.int32();break;case 2:r.minConsumer=e.int32();break;case 3:if(r.badConsumers&&r.badConsumers.length||(r.badConsumers=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)r.badConsumers.push(e.int32());else r.badConsumers.push(e.int32());break;default:e.skipType(7&n)}}return r},e}(),tensorflow.GraphDef=function(){function e(e){if(this.node=[],e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.node=$util.emptyArray,e.prototype.versions=null,e.prototype.library=null,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.GraphDef;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.node&&r.node.length||(r.node=[]),r.node.push($root.tensorflow.NodeDef.decode(e,e.uint32()));break;case 4:r.versions=$root.tensorflow.VersionDef.decode(e,e.uint32());break;case 2:r.library=$root.tensorflow.FunctionDefLibrary.decode(e,e.uint32());break;default:e.skipType(7&n)}}return r},e}(),tensorflow.CollectionDef=function(){function e(e){if(e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}var t;return e.prototype.nodeList=null,e.prototype.bytesList=null,e.prototype.int64List=null,e.prototype.floatList=null,e.prototype.anyList=null,Object.defineProperty(e.prototype,"kind",{get:$util.oneOfGetter(t=["nodeList","bytesList","int64List","floatList","anyList"]),set:$util.oneOfSetter(t)}),e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.CollectionDef;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.nodeList=$root.tensorflow.CollectionDef.NodeList.decode(e,e.uint32());break;case 2:r.bytesList=$root.tensorflow.CollectionDef.BytesList.decode(e,e.uint32());break;case 3:r.int64List=$root.tensorflow.CollectionDef.Int64List.decode(e,e.uint32());break;case 4:r.floatList=$root.tensorflow.CollectionDef.FloatList.decode(e,e.uint32());break;case 5:r.anyList=$root.tensorflow.CollectionDef.AnyList.decode(e,e.uint32());break;default:e.skipType(7&n)}}return r},e.NodeList=function(){function e(e){if(this.value=[],e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.value=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.CollectionDef.NodeList;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.value&&r.value.length||(r.value=[]),r.value.push(e.string());break;default:e.skipType(7&n)}}return r},e}(),e.BytesList=function(){function e(e){if(this.value=[],e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.value=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.CollectionDef.BytesList;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.value&&r.value.length||(r.value=[]),r.value.push(e.bytes());break;default:e.skipType(7&n)}}return r},e}(),e.Int64List=function(){function e(e){if(this.value=[],e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.value=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.CollectionDef.Int64List;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:if(r.value&&r.value.length||(r.value=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)r.value.push(e.int64());else r.value.push(e.int64());break;default:e.skipType(7&n)}}return r},e}(),e.FloatList=function(){function e(e){if(this.value=[],e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.value=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.CollectionDef.FloatList;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:if(r.value&&r.value.length||(r.value=[]),2==(7&n))for(var o=e.uint32()+e.pos;e.pos<o;)r.value.push(e.float());else r.value.push(e.float());break;default:e.skipType(7&n)}}return r},e}(),e.AnyList=function(){function e(e){if(this.value=[],e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.value=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.CollectionDef.AnyList;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.value&&r.value.length||(r.value=[]),r.value.push($root.tensorflow.Any.decode(e,e.uint32()));break;default:e.skipType(7&n)}}return r},e}(),e}(),tensorflow.SaverDef=function(){function e(e){if(e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}var t,a;return e.prototype.filenameTensorName="",e.prototype.saveTensorName="",e.prototype.restoreOpName="",e.prototype.maxToKeep=0,e.prototype.sharded=!1,e.prototype.keepCheckpointEveryNHours=0,e.prototype.version=0,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.SaverDef;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.filenameTensorName=e.string();break;case 2:r.saveTensorName=e.string();break;case 3:r.restoreOpName=e.string();break;case 4:r.maxToKeep=e.int32();break;case 5:r.sharded=e.bool();break;case 6:r.keepCheckpointEveryNHours=e.float();break;case 7:r.version=e.int32();break;default:e.skipType(7&n)}}return r},e.CheckpointFormatVersion=(t={},(a=Object.create(t))[t[0]="LEGACY"]=0,a[t[1]="V1"]=1,a[t[2]="V2"]=2,a),e}(),tensorflow.TensorInfo=function(){function e(e){if(e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}var t;return e.prototype.name="",e.prototype.cooSparse=null,e.prototype.dtype=0,e.prototype.tensorShape=null,Object.defineProperty(e.prototype,"encoding",{get:$util.oneOfGetter(t=["name","cooSparse"]),set:$util.oneOfSetter(t)}),e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.TensorInfo;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.name=e.string();break;case 4:r.cooSparse=$root.tensorflow.TensorInfo.CooSparse.decode(e,e.uint32());break;case 2:r.dtype=e.int32();break;case 3:r.tensorShape=$root.tensorflow.TensorShape.decode(e,e.uint32());break;default:e.skipType(7&n)}}return r},e.CooSparse=function(){function e(e){if(e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.valuesTensorName="",e.prototype.indicesTensorName="",e.prototype.denseShapeTensorName="",e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.TensorInfo.CooSparse;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.valuesTensorName=e.string();break;case 2:r.indicesTensorName=e.string();break;case 3:r.denseShapeTensorName=e.string();break;default:e.skipType(7&n)}}return r},e}(),e}(),tensorflow.SignatureDef=function(){function e(e){if(this.inputs={},this.outputs={},e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.inputs=$util.emptyObject,e.prototype.outputs=$util.emptyObject,e.prototype.methodName="",e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a,r=void 0===t?e.len:e.pos+t,n=new $root.tensorflow.SignatureDef;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:e.skip().pos++,n.inputs===$util.emptyObject&&(n.inputs={}),a=e.string(),e.pos++,n.inputs[a]=$root.tensorflow.TensorInfo.decode(e,e.uint32());break;case 2:e.skip().pos++,n.outputs===$util.emptyObject&&(n.outputs={}),a=e.string(),e.pos++,n.outputs[a]=$root.tensorflow.TensorInfo.decode(e,e.uint32());break;case 3:n.methodName=e.string();break;default:e.skipType(7&o)}}return n},e}(),tensorflow.AssetFileDef=function(){function e(e){if(e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.tensorInfo=null,e.prototype.filename="",e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.AssetFileDef;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.tensorInfo=$root.tensorflow.TensorInfo.decode(e,e.uint32());break;case 2:r.filename=e.string();break;default:e.skipType(7&n)}}return r},e}(),tensorflow.OpDef=function(){function e(e){if(this.inputArg=[],this.outputArg=[],this.attr=[],e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.name="",e.prototype.inputArg=$util.emptyArray,e.prototype.outputArg=$util.emptyArray,e.prototype.attr=$util.emptyArray,e.prototype.deprecation=null,e.prototype.summary="",e.prototype.description="",e.prototype.isCommutative=!1,e.prototype.isAggregate=!1,e.prototype.isStateful=!1,e.prototype.allowsUninitializedInput=!1,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.OpDef;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.name=e.string();break;case 2:r.inputArg&&r.inputArg.length||(r.inputArg=[]),r.inputArg.push($root.tensorflow.OpDef.ArgDef.decode(e,e.uint32()));break;case 3:r.outputArg&&r.outputArg.length||(r.outputArg=[]),r.outputArg.push($root.tensorflow.OpDef.ArgDef.decode(e,e.uint32()));break;case 4:r.attr&&r.attr.length||(r.attr=[]),r.attr.push($root.tensorflow.OpDef.AttrDef.decode(e,e.uint32()));break;case 8:r.deprecation=$root.tensorflow.OpDef.OpDeprecation.decode(e,e.uint32());break;case 5:r.summary=e.string();break;case 6:r.description=e.string();break;case 18:r.isCommutative=e.bool();break;case 16:r.isAggregate=e.bool();break;case 17:r.isStateful=e.bool();break;case 19:r.allowsUninitializedInput=e.bool();break;default:e.skipType(7&n)}}return r},e.ArgDef=function(){function e(e){if(e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.name="",e.prototype.description="",e.prototype.type=0,e.prototype.typeAttr="",e.prototype.numberAttr="",e.prototype.typeListAttr="",e.prototype.isRef=!1,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.OpDef.ArgDef;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.name=e.string();break;case 2:r.description=e.string();break;case 3:r.type=e.int32();break;case 4:r.typeAttr=e.string();break;case 5:r.numberAttr=e.string();break;case 6:r.typeListAttr=e.string();break;case 16:r.isRef=e.bool();break;default:e.skipType(7&n)}}return r},e}(),e.AttrDef=function(){function e(e){if(e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.name="",e.prototype.type="",e.prototype.defaultValue=null,e.prototype.description="",e.prototype.hasMinimum=!1,e.prototype.minimum=$util.Long?$util.Long.fromBits(0,0,!1):0,e.prototype.allowedValues=null,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.OpDef.AttrDef;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.name=e.string();break;case 2:r.type=e.string();break;case 3:r.defaultValue=$root.tensorflow.AttrValue.decode(e,e.uint32());break;case 4:r.description=e.string();break;case 5:r.hasMinimum=e.bool();break;case 6:r.minimum=e.int64();break;case 7:r.allowedValues=$root.tensorflow.AttrValue.decode(e,e.uint32());break;default:e.skipType(7&n)}}return r},e}(),e.OpDeprecation=function(){function e(e){if(e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.version=0,e.prototype.explanation="",e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.OpDef.OpDeprecation;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.version=e.int32();break;case 2:r.explanation=e.string();break;default:e.skipType(7&n)}}return r},e}(),e}(),tensorflow.OpList=function(){function e(e){if(this.op=[],e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.op=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.OpList;e.pos<a;){var n=e.uint32();switch(n>>>3){case 1:r.op&&r.op.length||(r.op=[]),r.op.push($root.tensorflow.OpDef.decode(e,e.uint32()));break;default:e.skipType(7&n)}}return r},e}(),tensorflow.MetaGraphDef=function(){function e(e){if(this.collectionDef={},this.signatureDef={},this.assetFileDef=[],e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.metaInfoDef=null,e.prototype.graphDef=null,e.prototype.saverDef=null,e.prototype.collectionDef=$util.emptyObject,e.prototype.signatureDef=$util.emptyObject,e.prototype.assetFileDef=$util.emptyArray,e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a,r=void 0===t?e.len:e.pos+t,n=new $root.tensorflow.MetaGraphDef;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.metaInfoDef=$root.tensorflow.MetaGraphDef.MetaInfoDef.decode(e,e.uint32());break;case 2:n.graphDef=$root.tensorflow.GraphDef.decode(e,e.uint32());break;case 3:n.saverDef=$root.tensorflow.SaverDef.decode(e,e.uint32());break;case 4:e.skip().pos++,n.collectionDef===$util.emptyObject&&(n.collectionDef={}),a=e.string(),e.pos++,n.collectionDef[a]=$root.tensorflow.CollectionDef.decode(e,e.uint32());break;case 5:e.skip().pos++,n.signatureDef===$util.emptyObject&&(n.signatureDef={}),a=e.string(),e.pos++,n.signatureDef[a]=$root.tensorflow.SignatureDef.decode(e,e.uint32());break;case 6:n.assetFileDef&&n.assetFileDef.length||(n.assetFileDef=[]),n.assetFileDef.push($root.tensorflow.AssetFileDef.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return n},e.MetaInfoDef=function(){function e(e){if(this.tags=[],e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return e.prototype.metaGraphVersion="",e.prototype.strippedOpList=null,e.prototype.anyInfo=null,e.prototype.tags=$util.emptyArray,e.prototype.tensorflowVersion="",e.prototype.tensorflowGitVersion="",e.decode=function(e,t){e instanceof $Reader||(e=$Reader.create(e));for(var a=void 0===t?e.len:e.pos+t,r=new $root.tensorflow.MetaGraphDef.MetaInfoDef;e.pos<a;){var n=e.uint32();switch(n