@tensorflow/tfjs-converter
Advanced tools
Comparing version 1.0.0-alpha5 to 1.0.0-alpha6
@@ -17,4 +17,4 @@ "use strict"; | ||
while (_) try { | ||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [0, t.value]; | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
@@ -134,3 +134,5 @@ case 0: case 1: t = op; break; | ||
coreOps | ||
// tslint:disable-next-line:no-any | ||
.sort(function (a, b) { return a.symbolName.localeCompare(b.symbolName); }) | ||
// tslint:disable-next-line:no-any | ||
.forEach(function (element) { | ||
@@ -137,0 +139,0 @@ if (!ops.find(function (op) { return op.tfOpName === element.symbolName; })) { |
@@ -0,1 +1,17 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 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. | ||
* ============================================================================= | ||
*/ | ||
export {}; |
@@ -1,1581 +0,425 @@ | ||
import * as $protobuf from 'protobufjs'; | ||
/** Namespace tensorflow. */ | ||
export namespace tensorflow { | ||
/** Properties of an Any. */ | ||
interface IAny { | ||
/** Any typeUrl */ | ||
typeUrl?: (string|null); | ||
/** Any value */ | ||
value?: (Uint8Array|null); | ||
} | ||
/** Represents an Any. */ | ||
class Any implements IAny { | ||
/** | ||
* Constructs a new Any. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.IAny); | ||
/** Any typeUrl. */ | ||
public typeUrl: string; | ||
/** Any value. */ | ||
public value: Uint8Array; | ||
/** | ||
* Decodes an Any message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns Any | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.Any; | ||
} | ||
/** DataType enum. */ | ||
enum DataType { | ||
DT_INVALID = 0, | ||
DT_FLOAT = 1, | ||
DT_DOUBLE = 2, | ||
DT_INT32 = 3, | ||
DT_UINT8 = 4, | ||
DT_INT16 = 5, | ||
DT_INT8 = 6, | ||
DT_STRING = 7, | ||
DT_COMPLEX64 = 8, | ||
DT_INT64 = 9, | ||
DT_BOOL = 10, | ||
DT_QINT8 = 11, | ||
DT_QUINT8 = 12, | ||
DT_QINT32 = 13, | ||
DT_BFLOAT16 = 14, | ||
DT_FLOAT_REF = 101, | ||
DT_DOUBLE_REF = 102, | ||
DT_INT32_REF = 103, | ||
DT_UINT8_REF = 104, | ||
DT_INT16_REF = 105, | ||
DT_INT8_REF = 106, | ||
DT_STRING_REF = 107, | ||
DT_COMPLEX64_REF = 108, | ||
DT_INT64_REF = 109, | ||
DT_BOOL_REF = 110, | ||
DT_QINT8_REF = 111, | ||
DT_QUINT8_REF = 112, | ||
DT_QINT32_REF = 113, | ||
DT_BFLOAT16_REF = 114 | ||
} | ||
/** Properties of a TensorShape. */ | ||
interface ITensorShape { | ||
/** TensorShape dim */ | ||
dim?: (tensorflow.TensorShape.IDim[]|null); | ||
/** TensorShape unknownRank */ | ||
unknownRank?: (boolean|null); | ||
} | ||
/** Represents a TensorShape. */ | ||
class TensorShape implements ITensorShape { | ||
/** | ||
* Constructs a new TensorShape. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.ITensorShape); | ||
/** TensorShape dim. */ | ||
public dim: tensorflow.TensorShape.IDim[]; | ||
/** TensorShape unknownRank. */ | ||
public unknownRank: boolean; | ||
/** | ||
* Decodes a TensorShape message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns TensorShape | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.TensorShape; | ||
} | ||
namespace TensorShape { | ||
/** Properties of a Dim. */ | ||
interface IDim { | ||
/** Dim size */ | ||
size?: (number|Long|null); | ||
/** Dim name */ | ||
name?: (string|null); | ||
export declare namespace tensorflow { | ||
/** Properties of an Any. */ | ||
interface IAny { | ||
/** Any typeUrl */ | ||
typeUrl?: (string | null); | ||
/** Any value */ | ||
value?: (Uint8Array | null); | ||
} | ||
/** Represents a Dim. */ | ||
class Dim implements IDim { | ||
/** | ||
* Constructs a new Dim. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.TensorShape.IDim); | ||
/** Dim size. */ | ||
public size: (number|Long); | ||
/** Dim name. */ | ||
public name: string; | ||
/** | ||
* Decodes a Dim message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns Dim | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.TensorShape.Dim; | ||
/** DataType enum. */ | ||
enum DataType { | ||
DT_INVALID = 0, | ||
DT_FLOAT = 1, | ||
DT_DOUBLE = 2, | ||
DT_INT32 = 3, | ||
DT_UINT8 = 4, | ||
DT_INT16 = 5, | ||
DT_INT8 = 6, | ||
DT_STRING = 7, | ||
DT_COMPLEX64 = 8, | ||
DT_INT64 = 9, | ||
DT_BOOL = 10, | ||
DT_QINT8 = 11, | ||
DT_QUINT8 = 12, | ||
DT_QINT32 = 13, | ||
DT_BFLOAT16 = 14, | ||
DT_FLOAT_REF = 101, | ||
DT_DOUBLE_REF = 102, | ||
DT_INT32_REF = 103, | ||
DT_UINT8_REF = 104, | ||
DT_INT16_REF = 105, | ||
DT_INT8_REF = 106, | ||
DT_STRING_REF = 107, | ||
DT_COMPLEX64_REF = 108, | ||
DT_INT64_REF = 109, | ||
DT_BOOL_REF = 110, | ||
DT_QINT8_REF = 111, | ||
DT_QUINT8_REF = 112, | ||
DT_QINT32_REF = 113, | ||
DT_BFLOAT16_REF = 114 | ||
} | ||
} | ||
/** Properties of a Tensor. */ | ||
interface ITensor { | ||
/** Tensor dtype */ | ||
dtype?: (tensorflow.DataType|null); | ||
/** Tensor tensorShape */ | ||
tensorShape?: (tensorflow.ITensorShape|null); | ||
/** Tensor versionNumber */ | ||
versionNumber?: (number|null); | ||
/** Tensor tensorContent */ | ||
tensorContent?: (Uint8Array|null); | ||
/** Tensor floatVal */ | ||
floatVal?: (number[]|null); | ||
/** Tensor doubleVal */ | ||
doubleVal?: (number[]|null); | ||
/** Tensor intVal */ | ||
intVal?: (number[]|null); | ||
/** Tensor stringVal */ | ||
stringVal?: (Uint8Array[]|null); | ||
/** Tensor scomplexVal */ | ||
scomplexVal?: (number[]|null); | ||
/** Tensor int64Val */ | ||
int64Val?: ((number | Long)[]|null); | ||
/** Tensor boolVal */ | ||
boolVal?: (boolean[]|null); | ||
/** Tensor uint32Val */ | ||
uint32Val?: (number[]|null); | ||
/** Tensor uint64Val */ | ||
uint64Val?: ((number | Long)[]|null); | ||
} | ||
/** Represents a Tensor. */ | ||
class Tensor implements ITensor { | ||
/** | ||
* Constructs a new Tensor. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.ITensor); | ||
/** Tensor dtype. */ | ||
public dtype: tensorflow.DataType; | ||
/** Tensor tensorShape. */ | ||
public tensorShape?: (tensorflow.ITensorShape|null); | ||
/** Tensor versionNumber. */ | ||
public versionNumber: number; | ||
/** Tensor tensorContent. */ | ||
public tensorContent: Uint8Array; | ||
/** Tensor floatVal. */ | ||
public floatVal: number[]; | ||
/** Tensor doubleVal. */ | ||
public doubleVal: number[]; | ||
/** Tensor intVal. */ | ||
public intVal: number[]; | ||
/** Tensor stringVal. */ | ||
public stringVal: Uint8Array[]; | ||
/** Tensor scomplexVal. */ | ||
public scomplexVal: number[]; | ||
/** Tensor int64Val. */ | ||
public int64Val: (number|Long)[]; | ||
/** Tensor boolVal. */ | ||
public boolVal: boolean[]; | ||
/** Tensor uint32Val. */ | ||
public uint32Val: number[]; | ||
/** Tensor uint64Val. */ | ||
public uint64Val: (number|Long)[]; | ||
/** | ||
* Decodes a Tensor message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns Tensor | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.Tensor; | ||
} | ||
/** Properties of an AttrValue. */ | ||
interface IAttrValue { | ||
/** AttrValue list */ | ||
list?: (tensorflow.AttrValue.IListValue|null); | ||
/** AttrValue s */ | ||
s?: (Uint8Array|null); | ||
/** AttrValue i */ | ||
i?: (number|Long|null); | ||
/** AttrValue f */ | ||
f?: (number|null); | ||
/** AttrValue b */ | ||
b?: (boolean|null); | ||
/** AttrValue type */ | ||
type?: (tensorflow.DataType|null); | ||
/** AttrValue shape */ | ||
shape?: (tensorflow.ITensorShape|null); | ||
/** AttrValue tensor */ | ||
tensor?: (tensorflow.ITensor|null); | ||
/** AttrValue placeholder */ | ||
placeholder?: (string|null); | ||
/** AttrValue func */ | ||
func?: (tensorflow.INameAttrList|null); | ||
} | ||
/** Represents an AttrValue. */ | ||
class AttrValue implements IAttrValue { | ||
/** | ||
* Constructs a new AttrValue. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.IAttrValue); | ||
/** AttrValue list. */ | ||
public list?: (tensorflow.AttrValue.IListValue|null); | ||
/** AttrValue s. */ | ||
public s: Uint8Array; | ||
/** AttrValue i. */ | ||
public i: (number|Long); | ||
/** AttrValue f. */ | ||
public f: number; | ||
/** AttrValue b. */ | ||
public b: boolean; | ||
/** AttrValue type. */ | ||
public type: tensorflow.DataType; | ||
/** AttrValue shape. */ | ||
public shape?: (tensorflow.ITensorShape|null); | ||
/** AttrValue tensor. */ | ||
public tensor?: (tensorflow.ITensor|null); | ||
/** AttrValue placeholder. */ | ||
public placeholder: string; | ||
/** AttrValue func. */ | ||
public func?: (tensorflow.INameAttrList|null); | ||
/** AttrValue value. */ | ||
public value?: ('list'|'s'|'i'|'f'|'b'|'type'|'shape'|'tensor'| | ||
'placeholder'|'func'); | ||
/** | ||
* Decodes an AttrValue message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns AttrValue | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.AttrValue; | ||
} | ||
namespace AttrValue { | ||
/** Properties of a ListValue. */ | ||
interface IListValue { | ||
/** ListValue s */ | ||
s?: (Uint8Array[]|null); | ||
/** ListValue i */ | ||
i?: ((number | Long)[]|null); | ||
/** ListValue f */ | ||
f?: (number[]|null); | ||
/** ListValue b */ | ||
b?: (boolean[]|null); | ||
/** ListValue type */ | ||
type?: (tensorflow.DataType[]|null); | ||
/** ListValue shape */ | ||
shape?: (tensorflow.ITensorShape[]|null); | ||
/** ListValue tensor */ | ||
tensor?: (tensorflow.ITensor[]|null); | ||
/** ListValue func */ | ||
func?: (tensorflow.INameAttrList[]|null); | ||
/** Properties of a TensorShape. */ | ||
interface ITensorShape { | ||
/** TensorShape dim */ | ||
dim?: (tensorflow.TensorShape.IDim[] | null); | ||
/** TensorShape unknownRank */ | ||
unknownRank?: (boolean | null); | ||
} | ||
/** Represents a ListValue. */ | ||
class ListValue implements IListValue { | ||
/** | ||
* Constructs a new ListValue. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.AttrValue.IListValue); | ||
/** ListValue s. */ | ||
public s: Uint8Array[]; | ||
/** ListValue i. */ | ||
public i: (number|Long)[]; | ||
/** ListValue f. */ | ||
public f: number[]; | ||
/** ListValue b. */ | ||
public b: boolean[]; | ||
/** ListValue type. */ | ||
public type: tensorflow.DataType[]; | ||
/** ListValue shape. */ | ||
public shape: tensorflow.ITensorShape[]; | ||
/** ListValue tensor. */ | ||
public tensor: tensorflow.ITensor[]; | ||
/** ListValue func. */ | ||
public func: tensorflow.INameAttrList[]; | ||
/** | ||
* Decodes a ListValue message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns ListValue | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.AttrValue.ListValue; | ||
namespace TensorShape { | ||
/** Properties of a Dim. */ | ||
interface IDim { | ||
/** Dim size */ | ||
size?: (number | string | null); | ||
/** Dim name */ | ||
name?: (string | null); | ||
} | ||
} | ||
} | ||
/** Properties of a NameAttrList. */ | ||
interface INameAttrList { | ||
/** NameAttrList name */ | ||
name?: (string|null); | ||
/** NameAttrList attr */ | ||
attr?: ({[k: string]: tensorflow.IAttrValue}|null); | ||
} | ||
/** Represents a NameAttrList. */ | ||
class NameAttrList implements INameAttrList { | ||
/** | ||
* Constructs a new NameAttrList. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.INameAttrList); | ||
/** NameAttrList name. */ | ||
public name: string; | ||
/** NameAttrList attr. */ | ||
public attr: {[k: string]: tensorflow.IAttrValue}; | ||
/** | ||
* Decodes a NameAttrList message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns NameAttrList | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.NameAttrList; | ||
} | ||
/** Properties of a NodeDef. */ | ||
interface INodeDef { | ||
/** NodeDef name */ | ||
name?: (string|null); | ||
/** NodeDef op */ | ||
op?: (string|null); | ||
/** NodeDef input */ | ||
input?: (string[]|null); | ||
/** NodeDef device */ | ||
device?: (string|null); | ||
/** NodeDef attr */ | ||
attr?: ({[k: string]: tensorflow.IAttrValue}|null); | ||
} | ||
/** Represents a NodeDef. */ | ||
class NodeDef implements INodeDef { | ||
/** | ||
* Constructs a new NodeDef. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.INodeDef); | ||
/** NodeDef name. */ | ||
public name: string; | ||
/** NodeDef op. */ | ||
public op: string; | ||
/** NodeDef input. */ | ||
public input: string[]; | ||
/** NodeDef device. */ | ||
public device: string; | ||
/** NodeDef attr. */ | ||
public attr: {[k: string]: tensorflow.IAttrValue}; | ||
/** | ||
* Decodes a NodeDef message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns NodeDef | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.NodeDef; | ||
} | ||
/** Properties of a VersionDef. */ | ||
interface IVersionDef { | ||
/** VersionDef producer */ | ||
producer?: (number|null); | ||
/** VersionDef minConsumer */ | ||
minConsumer?: (number|null); | ||
/** VersionDef badConsumers */ | ||
badConsumers?: (number[]|null); | ||
} | ||
/** Represents a VersionDef. */ | ||
class VersionDef implements IVersionDef { | ||
/** | ||
* Constructs a new VersionDef. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.IVersionDef); | ||
/** VersionDef producer. */ | ||
public producer: number; | ||
/** VersionDef minConsumer. */ | ||
public minConsumer: number; | ||
/** VersionDef badConsumers. */ | ||
public badConsumers: number[]; | ||
/** | ||
* Decodes a VersionDef message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns VersionDef | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.VersionDef; | ||
} | ||
/** Properties of a GraphDef. */ | ||
interface IGraphDef { | ||
/** GraphDef node */ | ||
node?: (tensorflow.INodeDef[]|null); | ||
/** GraphDef versions */ | ||
versions?: (tensorflow.IVersionDef|null); | ||
/** GraphDef library */ | ||
library?: (tensorflow.IFunctionDefLibrary|null); | ||
} | ||
/** Represents a GraphDef. */ | ||
class GraphDef implements IGraphDef { | ||
/** | ||
* Constructs a new GraphDef. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.IGraphDef); | ||
/** GraphDef node. */ | ||
public node: tensorflow.INodeDef[]; | ||
/** GraphDef versions. */ | ||
public versions?: (tensorflow.IVersionDef|null); | ||
/** GraphDef library. */ | ||
public library?: (tensorflow.IFunctionDefLibrary|null); | ||
/** | ||
* Decodes a GraphDef message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns GraphDef | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.GraphDef; | ||
} | ||
/** Properties of a CollectionDef. */ | ||
interface ICollectionDef { | ||
/** CollectionDef nodeList */ | ||
nodeList?: (tensorflow.CollectionDef.INodeList|null); | ||
/** CollectionDef bytesList */ | ||
bytesList?: (tensorflow.CollectionDef.IBytesList|null); | ||
/** CollectionDef int64List */ | ||
int64List?: (tensorflow.CollectionDef.IInt64List|null); | ||
/** CollectionDef floatList */ | ||
floatList?: (tensorflow.CollectionDef.IFloatList|null); | ||
/** CollectionDef anyList */ | ||
anyList?: (tensorflow.CollectionDef.IAnyList|null); | ||
} | ||
/** Represents a CollectionDef. */ | ||
class CollectionDef implements ICollectionDef { | ||
/** | ||
* Constructs a new CollectionDef. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.ICollectionDef); | ||
/** CollectionDef nodeList. */ | ||
public nodeList?: (tensorflow.CollectionDef.INodeList|null); | ||
/** CollectionDef bytesList. */ | ||
public bytesList?: (tensorflow.CollectionDef.IBytesList|null); | ||
/** CollectionDef int64List. */ | ||
public int64List?: (tensorflow.CollectionDef.IInt64List|null); | ||
/** CollectionDef floatList. */ | ||
public floatList?: (tensorflow.CollectionDef.IFloatList|null); | ||
/** CollectionDef anyList. */ | ||
public anyList?: (tensorflow.CollectionDef.IAnyList|null); | ||
/** CollectionDef kind. */ | ||
public kind?: ('nodeList'|'bytesList'|'int64List'|'floatList'|'anyList'); | ||
/** | ||
* Decodes a CollectionDef message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns CollectionDef | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.CollectionDef; | ||
} | ||
namespace CollectionDef { | ||
/** Properties of a NodeList. */ | ||
interface INodeList { | ||
/** NodeList value */ | ||
value?: (string[]|null); | ||
/** Properties of a Tensor. */ | ||
interface ITensor { | ||
/** Tensor dtype */ | ||
dtype?: (tensorflow.DataType | null); | ||
/** Tensor tensorShape */ | ||
tensorShape?: (tensorflow.ITensorShape | null); | ||
/** Tensor versionNumber */ | ||
versionNumber?: (number | null); | ||
/** Tensor tensorContent */ | ||
tensorContent?: (Uint8Array | null); | ||
/** Tensor floatVal */ | ||
floatVal?: (number[] | null); | ||
/** Tensor doubleVal */ | ||
doubleVal?: (number[] | null); | ||
/** Tensor intVal */ | ||
intVal?: (number[] | null); | ||
/** Tensor stringVal */ | ||
stringVal?: (Uint8Array[] | null); | ||
/** Tensor scomplexVal */ | ||
scomplexVal?: (number[] | null); | ||
/** Tensor int64Val */ | ||
int64Val?: ((number | string)[] | null); | ||
/** Tensor boolVal */ | ||
boolVal?: (boolean[] | null); | ||
/** Tensor uint32Val */ | ||
uint32Val?: (number[] | null); | ||
/** Tensor uint64Val */ | ||
uint64Val?: ((number | string)[] | null); | ||
} | ||
/** Represents a NodeList. */ | ||
class NodeList implements INodeList { | ||
/** | ||
* Constructs a new NodeList. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.CollectionDef.INodeList); | ||
/** NodeList value. */ | ||
public value: string[]; | ||
/** | ||
* Decodes a NodeList message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns NodeList | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.CollectionDef.NodeList; | ||
/** Properties of an AttrValue. */ | ||
interface IAttrValue { | ||
/** AttrValue list */ | ||
list?: (tensorflow.AttrValue.IListValue | null); | ||
/** AttrValue s */ | ||
s?: (string | null); | ||
/** AttrValue i */ | ||
i?: (number | string | null); | ||
/** AttrValue f */ | ||
f?: (number | null); | ||
/** AttrValue b */ | ||
b?: (boolean | null); | ||
/** AttrValue type */ | ||
type?: (tensorflow.DataType | null); | ||
/** AttrValue shape */ | ||
shape?: (tensorflow.ITensorShape | null); | ||
/** AttrValue tensor */ | ||
tensor?: (tensorflow.ITensor | null); | ||
/** AttrValue placeholder */ | ||
placeholder?: (string | null); | ||
/** AttrValue func */ | ||
func?: (tensorflow.INameAttrList | null); | ||
} | ||
/** Properties of a BytesList. */ | ||
interface IBytesList { | ||
/** BytesList value */ | ||
value?: (Uint8Array[]|null); | ||
namespace AttrValue { | ||
/** Properties of a ListValue. */ | ||
interface IListValue { | ||
/** ListValue s */ | ||
s?: (string[] | null); | ||
/** ListValue i */ | ||
i?: ((number | string)[] | null); | ||
/** ListValue f */ | ||
f?: (number[] | null); | ||
/** ListValue b */ | ||
b?: (boolean[] | null); | ||
/** ListValue type */ | ||
type?: (tensorflow.DataType[] | null); | ||
/** ListValue shape */ | ||
shape?: (tensorflow.ITensorShape[] | null); | ||
/** ListValue tensor */ | ||
tensor?: (tensorflow.ITensor[] | null); | ||
/** ListValue func */ | ||
func?: (tensorflow.INameAttrList[] | null); | ||
} | ||
} | ||
/** Represents a BytesList. */ | ||
class BytesList implements IBytesList { | ||
/** | ||
* Constructs a new BytesList. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.CollectionDef.IBytesList); | ||
/** BytesList value. */ | ||
public value: Uint8Array[]; | ||
/** | ||
* Decodes a BytesList message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns BytesList | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.CollectionDef.BytesList; | ||
/** Properties of a NameAttrList. */ | ||
interface INameAttrList { | ||
/** NameAttrList name */ | ||
name?: (string | null); | ||
/** NameAttrList attr */ | ||
attr?: ({ | ||
[k: string]: tensorflow.IAttrValue; | ||
} | null); | ||
} | ||
/** Properties of an Int64List. */ | ||
interface IInt64List { | ||
/** Int64List value */ | ||
value?: ((number | Long)[]|null); | ||
/** Properties of a NodeDef. */ | ||
interface INodeDef { | ||
/** NodeDef name */ | ||
name?: (string | null); | ||
/** NodeDef op */ | ||
op?: (string | null); | ||
/** NodeDef input */ | ||
input?: (string[] | null); | ||
/** NodeDef device */ | ||
device?: (string | null); | ||
/** NodeDef attr */ | ||
attr?: ({ | ||
[k: string]: tensorflow.IAttrValue; | ||
} | null); | ||
} | ||
/** Represents an Int64List. */ | ||
class Int64List implements IInt64List { | ||
/** | ||
* Constructs a new Int64List. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.CollectionDef.IInt64List); | ||
/** Int64List value. */ | ||
public value: (number|Long)[]; | ||
/** | ||
* Decodes an Int64List message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns Int64List | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.CollectionDef.Int64List; | ||
/** Properties of a VersionDef. */ | ||
interface IVersionDef { | ||
/** VersionDef producer */ | ||
producer?: (number | null); | ||
/** VersionDef minConsumer */ | ||
minConsumer?: (number | null); | ||
/** VersionDef badConsumers */ | ||
badConsumers?: (number[] | null); | ||
} | ||
/** Properties of a FloatList. */ | ||
interface IFloatList { | ||
/** FloatList value */ | ||
value?: (number[]|null); | ||
/** Properties of a GraphDef. */ | ||
interface IGraphDef { | ||
/** GraphDef node */ | ||
node?: (tensorflow.INodeDef[] | null); | ||
/** GraphDef versions */ | ||
versions?: (tensorflow.IVersionDef | null); | ||
/** GraphDef library */ | ||
library?: (tensorflow.IFunctionDefLibrary | null); | ||
} | ||
/** Represents a FloatList. */ | ||
class FloatList implements IFloatList { | ||
/** | ||
* Constructs a new FloatList. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.CollectionDef.IFloatList); | ||
/** FloatList value. */ | ||
public value: number[]; | ||
/** | ||
* Decodes a FloatList message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns FloatList | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.CollectionDef.FloatList; | ||
/** Properties of a CollectionDef. */ | ||
interface ICollectionDef { | ||
/** CollectionDef nodeList */ | ||
nodeList?: (tensorflow.CollectionDef.INodeList | null); | ||
/** CollectionDef bytesList */ | ||
bytesList?: (tensorflow.CollectionDef.IBytesList | null); | ||
/** CollectionDef int64List */ | ||
int64List?: (tensorflow.CollectionDef.IInt64List | null); | ||
/** CollectionDef floatList */ | ||
floatList?: (tensorflow.CollectionDef.IFloatList | null); | ||
/** CollectionDef anyList */ | ||
anyList?: (tensorflow.CollectionDef.IAnyList | null); | ||
} | ||
/** Properties of an AnyList. */ | ||
interface IAnyList { | ||
/** AnyList value */ | ||
value?: (tensorflow.IAny[]|null); | ||
namespace CollectionDef { | ||
/** Properties of a NodeList. */ | ||
interface INodeList { | ||
/** NodeList value */ | ||
value?: (string[] | null); | ||
} | ||
/** Properties of a BytesList. */ | ||
interface IBytesList { | ||
/** BytesList value */ | ||
value?: (Uint8Array[] | null); | ||
} | ||
/** Properties of an Int64List. */ | ||
interface IInt64List { | ||
/** Int64List value */ | ||
value?: ((number | string)[] | null); | ||
} | ||
/** Properties of a FloatList. */ | ||
interface IFloatList { | ||
/** FloatList value */ | ||
value?: (number[] | null); | ||
} | ||
/** Properties of an AnyList. */ | ||
interface IAnyList { | ||
/** AnyList value */ | ||
value?: (tensorflow.IAny[] | null); | ||
} | ||
} | ||
/** Represents an AnyList. */ | ||
class AnyList implements IAnyList { | ||
/** | ||
* Constructs a new AnyList. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.CollectionDef.IAnyList); | ||
/** AnyList value. */ | ||
public value: tensorflow.IAny[]; | ||
/** | ||
* Decodes an AnyList message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns AnyList | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.CollectionDef.AnyList; | ||
/** Properties of a SaverDef. */ | ||
interface ISaverDef { | ||
/** SaverDef filenameTensorName */ | ||
filenameTensorName?: (string | null); | ||
/** SaverDef saveTensorName */ | ||
saveTensorName?: (string | null); | ||
/** SaverDef restoreOpName */ | ||
restoreOpName?: (string | null); | ||
/** SaverDef maxToKeep */ | ||
maxToKeep?: (number | null); | ||
/** SaverDef sharded */ | ||
sharded?: (boolean | null); | ||
/** SaverDef keepCheckpointEveryNHours */ | ||
keepCheckpointEveryNHours?: (number | null); | ||
/** SaverDef version */ | ||
version?: (tensorflow.SaverDef.CheckpointFormatVersion | null); | ||
} | ||
} | ||
/** Properties of a SaverDef. */ | ||
interface ISaverDef { | ||
/** SaverDef filenameTensorName */ | ||
filenameTensorName?: (string|null); | ||
/** SaverDef saveTensorName */ | ||
saveTensorName?: (string|null); | ||
/** SaverDef restoreOpName */ | ||
restoreOpName?: (string|null); | ||
/** SaverDef maxToKeep */ | ||
maxToKeep?: (number|null); | ||
/** SaverDef sharded */ | ||
sharded?: (boolean|null); | ||
/** SaverDef keepCheckpointEveryNHours */ | ||
keepCheckpointEveryNHours?: (number|null); | ||
/** SaverDef version */ | ||
version?: (tensorflow.SaverDef.CheckpointFormatVersion|null); | ||
} | ||
/** Represents a SaverDef. */ | ||
class SaverDef implements ISaverDef { | ||
/** | ||
* Constructs a new SaverDef. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.ISaverDef); | ||
/** SaverDef filenameTensorName. */ | ||
public filenameTensorName: string; | ||
/** SaverDef saveTensorName. */ | ||
public saveTensorName: string; | ||
/** SaverDef restoreOpName. */ | ||
public restoreOpName: string; | ||
/** SaverDef maxToKeep. */ | ||
public maxToKeep: number; | ||
/** SaverDef sharded. */ | ||
public sharded: boolean; | ||
/** SaverDef keepCheckpointEveryNHours. */ | ||
public keepCheckpointEveryNHours: number; | ||
/** SaverDef version. */ | ||
public version: tensorflow.SaverDef.CheckpointFormatVersion; | ||
/** | ||
* Decodes a SaverDef message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns SaverDef | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.SaverDef; | ||
} | ||
namespace SaverDef { | ||
/** CheckpointFormatVersion enum. */ | ||
enum CheckpointFormatVersion { LEGACY = 0, V1 = 1, V2 = 2 } | ||
} | ||
/** Properties of a TensorInfo. */ | ||
interface ITensorInfo { | ||
/** TensorInfo name */ | ||
name?: (string|null); | ||
/** TensorInfo cooSparse */ | ||
cooSparse?: (tensorflow.TensorInfo.ICooSparse|null); | ||
/** TensorInfo dtype */ | ||
dtype?: (tensorflow.DataType|null); | ||
/** TensorInfo tensorShape */ | ||
tensorShape?: (tensorflow.ITensorShape|null); | ||
} | ||
/** Represents a TensorInfo. */ | ||
class TensorInfo implements ITensorInfo { | ||
/** | ||
* Constructs a new TensorInfo. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.ITensorInfo); | ||
/** TensorInfo name. */ | ||
public name: string; | ||
/** TensorInfo cooSparse. */ | ||
public cooSparse?: (tensorflow.TensorInfo.ICooSparse|null); | ||
/** TensorInfo dtype. */ | ||
public dtype: tensorflow.DataType; | ||
/** TensorInfo tensorShape. */ | ||
public tensorShape?: (tensorflow.ITensorShape|null); | ||
/** TensorInfo encoding. */ | ||
public encoding?: ('name'|'cooSparse'); | ||
/** | ||
* Decodes a TensorInfo message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns TensorInfo | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.TensorInfo; | ||
} | ||
namespace TensorInfo { | ||
/** Properties of a CooSparse. */ | ||
interface ICooSparse { | ||
/** CooSparse valuesTensorName */ | ||
valuesTensorName?: (string|null); | ||
/** CooSparse indicesTensorName */ | ||
indicesTensorName?: (string|null); | ||
/** CooSparse denseShapeTensorName */ | ||
denseShapeTensorName?: (string|null); | ||
namespace SaverDef { | ||
/** CheckpointFormatVersion enum. */ | ||
enum CheckpointFormatVersion { | ||
LEGACY = 0, | ||
V1 = 1, | ||
V2 = 2 | ||
} | ||
} | ||
/** Represents a CooSparse. */ | ||
class CooSparse implements ICooSparse { | ||
/** | ||
* Constructs a new CooSparse. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.TensorInfo.ICooSparse); | ||
/** CooSparse valuesTensorName. */ | ||
public valuesTensorName: string; | ||
/** CooSparse indicesTensorName. */ | ||
public indicesTensorName: string; | ||
/** CooSparse denseShapeTensorName. */ | ||
public denseShapeTensorName: string; | ||
/** | ||
* Decodes a CooSparse message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns CooSparse | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.TensorInfo.CooSparse; | ||
/** Properties of a TensorInfo. */ | ||
interface ITensorInfo { | ||
/** TensorInfo name */ | ||
name?: (string | null); | ||
/** TensorInfo cooSparse */ | ||
cooSparse?: (tensorflow.TensorInfo.ICooSparse | null); | ||
/** TensorInfo dtype */ | ||
dtype?: (tensorflow.DataType | null); | ||
/** TensorInfo tensorShape */ | ||
tensorShape?: (tensorflow.ITensorShape | null); | ||
} | ||
} | ||
/** Properties of a SignatureDef. */ | ||
interface ISignatureDef { | ||
/** SignatureDef inputs */ | ||
inputs?: ({[k: string]: tensorflow.ITensorInfo}|null); | ||
/** SignatureDef outputs */ | ||
outputs?: ({[k: string]: tensorflow.ITensorInfo}|null); | ||
/** SignatureDef methodName */ | ||
methodName?: (string|null); | ||
} | ||
/** Represents a SignatureDef. */ | ||
class SignatureDef implements ISignatureDef { | ||
/** | ||
* Constructs a new SignatureDef. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.ISignatureDef); | ||
/** SignatureDef inputs. */ | ||
public inputs: {[k: string]: tensorflow.ITensorInfo}; | ||
/** SignatureDef outputs. */ | ||
public outputs: {[k: string]: tensorflow.ITensorInfo}; | ||
/** SignatureDef methodName. */ | ||
public methodName: string; | ||
/** | ||
* Decodes a SignatureDef message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns SignatureDef | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.SignatureDef; | ||
} | ||
/** Properties of an AssetFileDef. */ | ||
interface IAssetFileDef { | ||
/** AssetFileDef tensorInfo */ | ||
tensorInfo?: (tensorflow.ITensorInfo|null); | ||
/** AssetFileDef filename */ | ||
filename?: (string|null); | ||
} | ||
/** Represents an AssetFileDef. */ | ||
class AssetFileDef implements IAssetFileDef { | ||
/** | ||
* Constructs a new AssetFileDef. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.IAssetFileDef); | ||
/** AssetFileDef tensorInfo. */ | ||
public tensorInfo?: (tensorflow.ITensorInfo|null); | ||
/** AssetFileDef filename. */ | ||
public filename: string; | ||
/** | ||
* Decodes an AssetFileDef message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns AssetFileDef | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.AssetFileDef; | ||
} | ||
/** Properties of an OpDef. */ | ||
interface IOpDef { | ||
/** OpDef name */ | ||
name?: (string|null); | ||
/** OpDef inputArg */ | ||
inputArg?: (tensorflow.OpDef.IArgDef[]|null); | ||
/** OpDef outputArg */ | ||
outputArg?: (tensorflow.OpDef.IArgDef[]|null); | ||
/** OpDef attr */ | ||
attr?: (tensorflow.OpDef.IAttrDef[]|null); | ||
/** OpDef deprecation */ | ||
deprecation?: (tensorflow.OpDef.IOpDeprecation|null); | ||
/** OpDef summary */ | ||
summary?: (string|null); | ||
/** OpDef description */ | ||
description?: (string|null); | ||
/** OpDef isCommutative */ | ||
isCommutative?: (boolean|null); | ||
/** OpDef isAggregate */ | ||
isAggregate?: (boolean|null); | ||
/** OpDef isStateful */ | ||
isStateful?: (boolean|null); | ||
/** OpDef allowsUninitializedInput */ | ||
allowsUninitializedInput?: (boolean|null); | ||
} | ||
/** Represents an OpDef. */ | ||
class OpDef implements IOpDef { | ||
/** | ||
* Constructs a new OpDef. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.IOpDef); | ||
/** OpDef name. */ | ||
public name: string; | ||
/** OpDef inputArg. */ | ||
public inputArg: tensorflow.OpDef.IArgDef[]; | ||
/** OpDef outputArg. */ | ||
public outputArg: tensorflow.OpDef.IArgDef[]; | ||
/** OpDef attr. */ | ||
public attr: tensorflow.OpDef.IAttrDef[]; | ||
/** OpDef deprecation. */ | ||
public deprecation?: (tensorflow.OpDef.IOpDeprecation|null); | ||
/** OpDef summary. */ | ||
public summary: string; | ||
/** OpDef description. */ | ||
public description: string; | ||
/** OpDef isCommutative. */ | ||
public isCommutative: boolean; | ||
/** OpDef isAggregate. */ | ||
public isAggregate: boolean; | ||
/** OpDef isStateful. */ | ||
public isStateful: boolean; | ||
/** OpDef allowsUninitializedInput. */ | ||
public allowsUninitializedInput: boolean; | ||
/** | ||
* Decodes an OpDef message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns OpDef | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.OpDef; | ||
} | ||
namespace OpDef { | ||
/** Properties of an ArgDef. */ | ||
interface IArgDef { | ||
/** ArgDef name */ | ||
name?: (string|null); | ||
/** ArgDef description */ | ||
description?: (string|null); | ||
/** ArgDef type */ | ||
type?: (tensorflow.DataType|null); | ||
/** ArgDef typeAttr */ | ||
typeAttr?: (string|null); | ||
/** ArgDef numberAttr */ | ||
numberAttr?: (string|null); | ||
/** ArgDef typeListAttr */ | ||
typeListAttr?: (string|null); | ||
/** ArgDef isRef */ | ||
isRef?: (boolean|null); | ||
namespace TensorInfo { | ||
/** Properties of a CooSparse. */ | ||
interface ICooSparse { | ||
/** CooSparse valuesTensorName */ | ||
valuesTensorName?: (string | null); | ||
/** CooSparse indicesTensorName */ | ||
indicesTensorName?: (string | null); | ||
/** CooSparse denseShapeTensorName */ | ||
denseShapeTensorName?: (string | null); | ||
} | ||
} | ||
/** Represents an ArgDef. */ | ||
class ArgDef implements IArgDef { | ||
/** | ||
* Constructs a new ArgDef. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.OpDef.IArgDef); | ||
/** ArgDef name. */ | ||
public name: string; | ||
/** ArgDef description. */ | ||
public description: string; | ||
/** ArgDef type. */ | ||
public type: tensorflow.DataType; | ||
/** ArgDef typeAttr. */ | ||
public typeAttr: string; | ||
/** ArgDef numberAttr. */ | ||
public numberAttr: string; | ||
/** ArgDef typeListAttr. */ | ||
public typeListAttr: string; | ||
/** ArgDef isRef. */ | ||
public isRef: boolean; | ||
/** | ||
* Decodes an ArgDef message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns ArgDef | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.OpDef.ArgDef; | ||
/** Properties of a SignatureDef. */ | ||
interface ISignatureDef { | ||
/** SignatureDef inputs */ | ||
inputs?: ({ | ||
[k: string]: tensorflow.ITensorInfo; | ||
} | null); | ||
/** SignatureDef outputs */ | ||
outputs?: ({ | ||
[k: string]: tensorflow.ITensorInfo; | ||
} | null); | ||
/** SignatureDef methodName */ | ||
methodName?: (string | null); | ||
} | ||
/** Properties of an AttrDef. */ | ||
interface IAttrDef { | ||
/** AttrDef name */ | ||
name?: (string|null); | ||
/** AttrDef type */ | ||
type?: (string|null); | ||
/** AttrDef defaultValue */ | ||
defaultValue?: (tensorflow.IAttrValue|null); | ||
/** AttrDef description */ | ||
description?: (string|null); | ||
/** AttrDef hasMinimum */ | ||
hasMinimum?: (boolean|null); | ||
/** AttrDef minimum */ | ||
minimum?: (number|Long|null); | ||
/** AttrDef allowedValues */ | ||
allowedValues?: (tensorflow.IAttrValue|null); | ||
/** Properties of an AssetFileDef. */ | ||
interface IAssetFileDef { | ||
/** AssetFileDef tensorInfo */ | ||
tensorInfo?: (tensorflow.ITensorInfo | null); | ||
/** AssetFileDef filename */ | ||
filename?: (string | null); | ||
} | ||
/** Represents an AttrDef. */ | ||
class AttrDef implements IAttrDef { | ||
/** | ||
* Constructs a new AttrDef. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.OpDef.IAttrDef); | ||
/** AttrDef name. */ | ||
public name: string; | ||
/** AttrDef type. */ | ||
public type: string; | ||
/** AttrDef defaultValue. */ | ||
public defaultValue?: (tensorflow.IAttrValue|null); | ||
/** AttrDef description. */ | ||
public description: string; | ||
/** AttrDef hasMinimum. */ | ||
public hasMinimum: boolean; | ||
/** AttrDef minimum. */ | ||
public minimum: (number|Long); | ||
/** AttrDef allowedValues. */ | ||
public allowedValues?: (tensorflow.IAttrValue|null); | ||
/** | ||
* Decodes an AttrDef message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns AttrDef | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.OpDef.AttrDef; | ||
/** Properties of an OpDef. */ | ||
interface IOpDef { | ||
/** OpDef name */ | ||
name?: (string | null); | ||
/** OpDef inputArg */ | ||
inputArg?: (tensorflow.OpDef.IArgDef[] | null); | ||
/** OpDef outputArg */ | ||
outputArg?: (tensorflow.OpDef.IArgDef[] | null); | ||
/** OpDef attr */ | ||
attr?: (tensorflow.OpDef.IAttrDef[] | null); | ||
/** OpDef deprecation */ | ||
deprecation?: (tensorflow.OpDef.IOpDeprecation | null); | ||
/** OpDef summary */ | ||
summary?: (string | null); | ||
/** OpDef description */ | ||
description?: (string | null); | ||
/** OpDef isCommutative */ | ||
isCommutative?: (boolean | null); | ||
/** OpDef isAggregate */ | ||
isAggregate?: (boolean | null); | ||
/** OpDef isStateful */ | ||
isStateful?: (boolean | null); | ||
/** OpDef allowsUninitializedInput */ | ||
allowsUninitializedInput?: (boolean | null); | ||
} | ||
/** Properties of an OpDeprecation. */ | ||
interface IOpDeprecation { | ||
/** OpDeprecation version */ | ||
version?: (number|null); | ||
/** OpDeprecation explanation */ | ||
explanation?: (string|null); | ||
namespace OpDef { | ||
/** Properties of an ArgDef. */ | ||
interface IArgDef { | ||
/** ArgDef name */ | ||
name?: (string | null); | ||
/** ArgDef description */ | ||
description?: (string | null); | ||
/** ArgDef type */ | ||
type?: (tensorflow.DataType | null); | ||
/** ArgDef typeAttr */ | ||
typeAttr?: (string | null); | ||
/** ArgDef numberAttr */ | ||
numberAttr?: (string | null); | ||
/** ArgDef typeListAttr */ | ||
typeListAttr?: (string | null); | ||
/** ArgDef isRef */ | ||
isRef?: (boolean | null); | ||
} | ||
/** Properties of an AttrDef. */ | ||
interface IAttrDef { | ||
/** AttrDef name */ | ||
name?: (string | null); | ||
/** AttrDef type */ | ||
type?: (string | null); | ||
/** AttrDef defaultValue */ | ||
defaultValue?: (tensorflow.IAttrValue | null); | ||
/** AttrDef description */ | ||
description?: (string | null); | ||
/** AttrDef hasMinimum */ | ||
hasMinimum?: (boolean | null); | ||
/** AttrDef minimum */ | ||
minimum?: (number | string | null); | ||
/** AttrDef allowedValues */ | ||
allowedValues?: (tensorflow.IAttrValue | null); | ||
} | ||
/** Properties of an OpDeprecation. */ | ||
interface IOpDeprecation { | ||
/** OpDeprecation version */ | ||
version?: (number | null); | ||
/** OpDeprecation explanation */ | ||
explanation?: (string | null); | ||
} | ||
} | ||
/** Represents an OpDeprecation. */ | ||
class OpDeprecation implements IOpDeprecation { | ||
/** | ||
* Constructs a new OpDeprecation. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.OpDef.IOpDeprecation); | ||
/** OpDeprecation version. */ | ||
public version: number; | ||
/** OpDeprecation explanation. */ | ||
public explanation: string; | ||
/** | ||
* Decodes an OpDeprecation message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns OpDeprecation | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.OpDef.OpDeprecation; | ||
/** Properties of an OpList. */ | ||
interface IOpList { | ||
/** OpList op */ | ||
op?: (tensorflow.IOpDef[] | null); | ||
} | ||
} | ||
/** Properties of an OpList. */ | ||
interface IOpList { | ||
/** OpList op */ | ||
op?: (tensorflow.IOpDef[]|null); | ||
} | ||
/** Represents an OpList. */ | ||
class OpList implements IOpList { | ||
/** | ||
* Constructs a new OpList. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.IOpList); | ||
/** OpList op. */ | ||
public op: tensorflow.IOpDef[]; | ||
/** | ||
* Decodes an OpList message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns OpList | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.OpList; | ||
} | ||
/** Properties of a MetaGraphDef. */ | ||
interface IMetaGraphDef { | ||
/** MetaGraphDef metaInfoDef */ | ||
metaInfoDef?: (tensorflow.MetaGraphDef.IMetaInfoDef|null); | ||
/** MetaGraphDef graphDef */ | ||
graphDef?: (tensorflow.IGraphDef|null); | ||
/** MetaGraphDef saverDef */ | ||
saverDef?: (tensorflow.ISaverDef|null); | ||
/** MetaGraphDef collectionDef */ | ||
collectionDef?: ({[k: string]: tensorflow.ICollectionDef}|null); | ||
/** MetaGraphDef signatureDef */ | ||
signatureDef?: ({[k: string]: tensorflow.ISignatureDef}|null); | ||
/** MetaGraphDef assetFileDef */ | ||
assetFileDef?: (tensorflow.IAssetFileDef[]|null); | ||
} | ||
/** Represents a MetaGraphDef. */ | ||
class MetaGraphDef implements IMetaGraphDef { | ||
/** | ||
* Constructs a new MetaGraphDef. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.IMetaGraphDef); | ||
/** MetaGraphDef metaInfoDef. */ | ||
public metaInfoDef?: (tensorflow.MetaGraphDef.IMetaInfoDef|null); | ||
/** MetaGraphDef graphDef. */ | ||
public graphDef?: (tensorflow.IGraphDef|null); | ||
/** MetaGraphDef saverDef. */ | ||
public saverDef?: (tensorflow.ISaverDef|null); | ||
/** MetaGraphDef collectionDef. */ | ||
public collectionDef: {[k: string]: tensorflow.ICollectionDef}; | ||
/** MetaGraphDef signatureDef. */ | ||
public signatureDef: {[k: string]: tensorflow.ISignatureDef}; | ||
/** MetaGraphDef assetFileDef. */ | ||
public assetFileDef: tensorflow.IAssetFileDef[]; | ||
/** | ||
* Decodes a MetaGraphDef message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns MetaGraphDef | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.MetaGraphDef; | ||
} | ||
namespace MetaGraphDef { | ||
/** Properties of a MetaInfoDef. */ | ||
interface IMetaInfoDef { | ||
/** MetaInfoDef metaGraphVersion */ | ||
metaGraphVersion?: (string|null); | ||
/** MetaInfoDef strippedOpList */ | ||
strippedOpList?: (tensorflow.IOpList|null); | ||
/** MetaInfoDef anyInfo */ | ||
anyInfo?: (tensorflow.IAny|null); | ||
/** MetaInfoDef tags */ | ||
tags?: (string[]|null); | ||
/** MetaInfoDef tensorflowVersion */ | ||
tensorflowVersion?: (string|null); | ||
/** MetaInfoDef tensorflowGitVersion */ | ||
tensorflowGitVersion?: (string|null); | ||
/** Properties of a MetaGraphDef. */ | ||
interface IMetaGraphDef { | ||
/** MetaGraphDef metaInfoDef */ | ||
metaInfoDef?: (tensorflow.MetaGraphDef.IMetaInfoDef | null); | ||
/** MetaGraphDef graphDef */ | ||
graphDef?: (tensorflow.IGraphDef | null); | ||
/** MetaGraphDef saverDef */ | ||
saverDef?: (tensorflow.ISaverDef | null); | ||
/** MetaGraphDef collectionDef */ | ||
collectionDef?: ({ | ||
[k: string]: tensorflow.ICollectionDef; | ||
} | null); | ||
/** MetaGraphDef signatureDef */ | ||
signatureDef?: ({ | ||
[k: string]: tensorflow.ISignatureDef; | ||
} | null); | ||
/** MetaGraphDef assetFileDef */ | ||
assetFileDef?: (tensorflow.IAssetFileDef[] | null); | ||
} | ||
/** Represents a MetaInfoDef. */ | ||
class MetaInfoDef implements IMetaInfoDef { | ||
/** | ||
* Constructs a new MetaInfoDef. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.MetaGraphDef.IMetaInfoDef); | ||
/** MetaInfoDef metaGraphVersion. */ | ||
public metaGraphVersion: string; | ||
/** MetaInfoDef strippedOpList. */ | ||
public strippedOpList?: (tensorflow.IOpList|null); | ||
/** MetaInfoDef anyInfo. */ | ||
public anyInfo?: (tensorflow.IAny|null); | ||
/** MetaInfoDef tags. */ | ||
public tags: string[]; | ||
/** MetaInfoDef tensorflowVersion. */ | ||
public tensorflowVersion: string; | ||
/** MetaInfoDef tensorflowGitVersion. */ | ||
public tensorflowGitVersion: string; | ||
/** | ||
* Decodes a MetaInfoDef message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns MetaInfoDef | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.MetaGraphDef.MetaInfoDef; | ||
namespace MetaGraphDef { | ||
/** Properties of a MetaInfoDef. */ | ||
interface IMetaInfoDef { | ||
/** MetaInfoDef metaGraphVersion */ | ||
metaGraphVersion?: (string | null); | ||
/** MetaInfoDef strippedOpList */ | ||
strippedOpList?: (tensorflow.IOpList | null); | ||
/** MetaInfoDef anyInfo */ | ||
anyInfo?: (tensorflow.IAny | null); | ||
/** MetaInfoDef tags */ | ||
tags?: (string[] | null); | ||
/** MetaInfoDef tensorflowVersion */ | ||
tensorflowVersion?: (string | null); | ||
/** MetaInfoDef tensorflowGitVersion */ | ||
tensorflowGitVersion?: (string | null); | ||
} | ||
} | ||
} | ||
/** Properties of a SavedModel. */ | ||
interface ISavedModel { | ||
/** SavedModel savedModelSchemaVersion */ | ||
savedModelSchemaVersion?: (number|Long|null); | ||
/** SavedModel metaGraphs */ | ||
metaGraphs?: (tensorflow.IMetaGraphDef[]|null); | ||
} | ||
/** Represents a SavedModel. */ | ||
class SavedModel implements ISavedModel { | ||
/** | ||
* Constructs a new SavedModel. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.ISavedModel); | ||
/** SavedModel savedModelSchemaVersion. */ | ||
public savedModelSchemaVersion: (number|Long); | ||
/** SavedModel metaGraphs. */ | ||
public metaGraphs: tensorflow.IMetaGraphDef[]; | ||
/** | ||
* Decodes a SavedModel message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns SavedModel | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.SavedModel; | ||
} | ||
/** Properties of a FunctionDefLibrary. */ | ||
interface IFunctionDefLibrary { | ||
/** FunctionDefLibrary function */ | ||
'function'?: (tensorflow.IFunctionDef[]|null); | ||
/** FunctionDefLibrary gradient */ | ||
gradient?: (tensorflow.IGradientDef[]|null); | ||
} | ||
/** Represents a FunctionDefLibrary. */ | ||
class FunctionDefLibrary implements IFunctionDefLibrary { | ||
/** | ||
* Constructs a new FunctionDefLibrary. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.IFunctionDefLibrary); | ||
/** FunctionDefLibrary function. */ | ||
public function: tensorflow.IFunctionDef[]; | ||
/** FunctionDefLibrary gradient. */ | ||
public gradient: tensorflow.IGradientDef[]; | ||
/** | ||
* Decodes a FunctionDefLibrary message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns FunctionDefLibrary | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.FunctionDefLibrary; | ||
} | ||
/** Properties of a FunctionDef. */ | ||
interface IFunctionDef { | ||
/** FunctionDef signature */ | ||
signature?: (tensorflow.IOpDef|null); | ||
/** FunctionDef attr */ | ||
attr?: ({[k: string]: tensorflow.IAttrValue}|null); | ||
/** FunctionDef nodeDef */ | ||
nodeDef?: (tensorflow.INodeDef[]|null); | ||
/** FunctionDef ret */ | ||
ret?: ({[k: string]: string}|null); | ||
} | ||
/** Represents a FunctionDef. */ | ||
class FunctionDef implements IFunctionDef { | ||
/** | ||
* Constructs a new FunctionDef. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.IFunctionDef); | ||
/** FunctionDef signature. */ | ||
public signature?: (tensorflow.IOpDef|null); | ||
/** FunctionDef attr. */ | ||
public attr: {[k: string]: tensorflow.IAttrValue}; | ||
/** FunctionDef nodeDef. */ | ||
public nodeDef: tensorflow.INodeDef[]; | ||
/** FunctionDef ret. */ | ||
public ret: {[k: string]: string}; | ||
/** | ||
* Decodes a FunctionDef message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns FunctionDef | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.FunctionDef; | ||
} | ||
/** Properties of a GradientDef. */ | ||
interface IGradientDef { | ||
/** GradientDef functionName */ | ||
functionName?: (string|null); | ||
/** GradientDef gradientFunc */ | ||
gradientFunc?: (string|null); | ||
} | ||
/** Represents a GradientDef. */ | ||
class GradientDef implements IGradientDef { | ||
/** | ||
* Constructs a new GradientDef. | ||
* @param [p] Properties to set | ||
*/ | ||
constructor(p?: tensorflow.IGradientDef); | ||
/** GradientDef functionName. */ | ||
public functionName: string; | ||
/** GradientDef gradientFunc. */ | ||
public gradientFunc: string; | ||
/** | ||
* Decodes a GradientDef message from the specified reader or buffer. | ||
* @param r Reader or buffer to decode from | ||
* @param [l] Message length if known beforehand | ||
* @returns GradientDef | ||
* @throws {Error} If the payload is not a reader or valid buffer | ||
* @throws {$protobuf.util.ProtocolError} If required fields are missing | ||
*/ | ||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): | ||
tensorflow.GradientDef; | ||
} | ||
/** Properties of a SavedModel. */ | ||
interface ISavedModel { | ||
/** SavedModel savedModelSchemaVersion */ | ||
savedModelSchemaVersion?: (number | string | null); | ||
/** SavedModel metaGraphs */ | ||
metaGraphs?: (tensorflow.IMetaGraphDef[] | null); | ||
} | ||
/** Properties of a FunctionDefLibrary. */ | ||
interface IFunctionDefLibrary { | ||
/** FunctionDefLibrary function */ | ||
'function'?: (tensorflow.IFunctionDef[] | null); | ||
/** FunctionDefLibrary gradient */ | ||
gradient?: (tensorflow.IGradientDef[] | null); | ||
} | ||
/** Properties of a FunctionDef. */ | ||
interface IFunctionDef { | ||
/** FunctionDef signature */ | ||
signature?: (tensorflow.IOpDef | null); | ||
/** FunctionDef attr */ | ||
attr?: ({ | ||
[k: string]: tensorflow.IAttrValue; | ||
} | null); | ||
/** FunctionDef nodeDef */ | ||
nodeDef?: (tensorflow.INodeDef[] | null); | ||
/** FunctionDef ret */ | ||
ret?: ({ | ||
[k: string]: string; | ||
} | null); | ||
} | ||
/** Properties of a GradientDef. */ | ||
interface IGradientDef { | ||
/** GradientDef functionName */ | ||
functionName?: (string | null); | ||
/** GradientDef gradientFunc */ | ||
gradientFunc?: (string | null); | ||
} | ||
} |
@@ -1,1723 +0,50 @@ | ||
/*eslint-disable block-scoped-var, no-redeclare, no-control-regex, no-prototype-builtins*/ | ||
"use strict"; | ||
var $protobuf = require("protobufjs/minimal"); | ||
var $Reader = $protobuf.Reader, $util = $protobuf.util; | ||
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); | ||
$root.tensorflow = (function() { | ||
var tensorflow = {}; | ||
tensorflow.Any = (function() { | ||
function Any(p) { | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
Any.prototype.typeUrl = ""; | ||
Any.prototype.value = $util.newBuffer([]); | ||
Any.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.Any(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.typeUrl = r.string(); | ||
break; | ||
case 2: | ||
m.value = r.bytes(); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return Any; | ||
})(); | ||
tensorflow.DataType = (function() { | ||
var valuesById = {}, values = Object.create(valuesById); | ||
values[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; | ||
return values; | ||
})(); | ||
tensorflow.TensorShape = (function() { | ||
function TensorShape(p) { | ||
this.dim = []; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
TensorShape.prototype.dim = $util.emptyArray; | ||
TensorShape.prototype.unknownRank = false; | ||
TensorShape.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.TensorShape(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 2: | ||
if (!(m.dim && m.dim.length)) | ||
m.dim = []; | ||
m.dim.push($root.tensorflow.TensorShape.Dim.decode(r, r.uint32())); | ||
break; | ||
case 3: | ||
m.unknownRank = r.bool(); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
TensorShape.Dim = (function() { | ||
function Dim(p) { | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
Dim.prototype.size = $util.Long ? $util.Long.fromBits(0,0,false) : 0; | ||
Dim.prototype.name = ""; | ||
Dim.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.TensorShape.Dim(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.size = r.int64(); | ||
break; | ||
case 2: | ||
m.name = r.string(); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return Dim; | ||
})(); | ||
return TensorShape; | ||
})(); | ||
tensorflow.Tensor = (function() { | ||
function Tensor(p) { | ||
this.floatVal = []; | ||
this.doubleVal = []; | ||
this.intVal = []; | ||
this.stringVal = []; | ||
this.scomplexVal = []; | ||
this.int64Val = []; | ||
this.boolVal = []; | ||
this.uint32Val = []; | ||
this.uint64Val = []; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
Tensor.prototype.dtype = 0; | ||
Tensor.prototype.tensorShape = null; | ||
Tensor.prototype.versionNumber = 0; | ||
Tensor.prototype.tensorContent = $util.newBuffer([]); | ||
Tensor.prototype.floatVal = $util.emptyArray; | ||
Tensor.prototype.doubleVal = $util.emptyArray; | ||
Tensor.prototype.intVal = $util.emptyArray; | ||
Tensor.prototype.stringVal = $util.emptyArray; | ||
Tensor.prototype.scomplexVal = $util.emptyArray; | ||
Tensor.prototype.int64Val = $util.emptyArray; | ||
Tensor.prototype.boolVal = $util.emptyArray; | ||
Tensor.prototype.uint32Val = $util.emptyArray; | ||
Tensor.prototype.uint64Val = $util.emptyArray; | ||
Tensor.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.Tensor(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.dtype = r.int32(); | ||
break; | ||
case 2: | ||
m.tensorShape = $root.tensorflow.TensorShape.decode(r, r.uint32()); | ||
break; | ||
case 3: | ||
m.versionNumber = r.int32(); | ||
break; | ||
case 4: | ||
m.tensorContent = r.bytes(); | ||
break; | ||
case 5: | ||
if (!(m.floatVal && m.floatVal.length)) | ||
m.floatVal = []; | ||
if ((t & 7) === 2) { | ||
var c2 = r.uint32() + r.pos; | ||
while (r.pos < c2) | ||
m.floatVal.push(r.float()); | ||
} else | ||
m.floatVal.push(r.float()); | ||
break; | ||
case 6: | ||
if (!(m.doubleVal && m.doubleVal.length)) | ||
m.doubleVal = []; | ||
if ((t & 7) === 2) { | ||
var c2 = r.uint32() + r.pos; | ||
while (r.pos < c2) | ||
m.doubleVal.push(r.double()); | ||
} else | ||
m.doubleVal.push(r.double()); | ||
break; | ||
case 7: | ||
if (!(m.intVal && m.intVal.length)) | ||
m.intVal = []; | ||
if ((t & 7) === 2) { | ||
var c2 = r.uint32() + r.pos; | ||
while (r.pos < c2) | ||
m.intVal.push(r.int32()); | ||
} else | ||
m.intVal.push(r.int32()); | ||
break; | ||
case 8: | ||
if (!(m.stringVal && m.stringVal.length)) | ||
m.stringVal = []; | ||
m.stringVal.push(r.bytes()); | ||
break; | ||
case 9: | ||
if (!(m.scomplexVal && m.scomplexVal.length)) | ||
m.scomplexVal = []; | ||
if ((t & 7) === 2) { | ||
var c2 = r.uint32() + r.pos; | ||
while (r.pos < c2) | ||
m.scomplexVal.push(r.float()); | ||
} else | ||
m.scomplexVal.push(r.float()); | ||
break; | ||
case 10: | ||
if (!(m.int64Val && m.int64Val.length)) | ||
m.int64Val = []; | ||
if ((t & 7) === 2) { | ||
var c2 = r.uint32() + r.pos; | ||
while (r.pos < c2) | ||
m.int64Val.push(r.int64()); | ||
} else | ||
m.int64Val.push(r.int64()); | ||
break; | ||
case 11: | ||
if (!(m.boolVal && m.boolVal.length)) | ||
m.boolVal = []; | ||
if ((t & 7) === 2) { | ||
var c2 = r.uint32() + r.pos; | ||
while (r.pos < c2) | ||
m.boolVal.push(r.bool()); | ||
} else | ||
m.boolVal.push(r.bool()); | ||
break; | ||
case 16: | ||
if (!(m.uint32Val && m.uint32Val.length)) | ||
m.uint32Val = []; | ||
if ((t & 7) === 2) { | ||
var c2 = r.uint32() + r.pos; | ||
while (r.pos < c2) | ||
m.uint32Val.push(r.uint32()); | ||
} else | ||
m.uint32Val.push(r.uint32()); | ||
break; | ||
case 17: | ||
if (!(m.uint64Val && m.uint64Val.length)) | ||
m.uint64Val = []; | ||
if ((t & 7) === 2) { | ||
var c2 = r.uint32() + r.pos; | ||
while (r.pos < c2) | ||
m.uint64Val.push(r.uint64()); | ||
} else | ||
m.uint64Val.push(r.uint64()); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return Tensor; | ||
})(); | ||
tensorflow.AttrValue = (function() { | ||
function AttrValue(p) { | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
AttrValue.prototype.list = null; | ||
AttrValue.prototype.s = $util.newBuffer([]); | ||
AttrValue.prototype.i = $util.Long ? $util.Long.fromBits(0,0,false) : 0; | ||
AttrValue.prototype.f = 0; | ||
AttrValue.prototype.b = false; | ||
AttrValue.prototype.type = 0; | ||
AttrValue.prototype.shape = null; | ||
AttrValue.prototype.tensor = null; | ||
AttrValue.prototype.placeholder = ""; | ||
AttrValue.prototype.func = null; | ||
var $oneOfFields; | ||
Object.defineProperty(AttrValue.prototype, "value", { | ||
get: $util.oneOfGetter($oneOfFields = ["list", "s", "i", "f", "b", "type", "shape", "tensor", "placeholder", "func"]), | ||
set: $util.oneOfSetter($oneOfFields) | ||
}); | ||
AttrValue.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.AttrValue(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.list = $root.tensorflow.AttrValue.ListValue.decode(r, r.uint32()); | ||
break; | ||
case 2: | ||
m.s = r.bytes(); | ||
break; | ||
case 3: | ||
m.i = r.int64(); | ||
break; | ||
case 4: | ||
m.f = r.float(); | ||
break; | ||
case 5: | ||
m.b = r.bool(); | ||
break; | ||
case 6: | ||
m.type = r.int32(); | ||
break; | ||
case 7: | ||
m.shape = $root.tensorflow.TensorShape.decode(r, r.uint32()); | ||
break; | ||
case 8: | ||
m.tensor = $root.tensorflow.Tensor.decode(r, r.uint32()); | ||
break; | ||
case 9: | ||
m.placeholder = r.string(); | ||
break; | ||
case 10: | ||
m.func = $root.tensorflow.NameAttrList.decode(r, r.uint32()); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
AttrValue.ListValue = (function() { | ||
function ListValue(p) { | ||
this.s = []; | ||
this.i = []; | ||
this.f = []; | ||
this.b = []; | ||
this.type = []; | ||
this.shape = []; | ||
this.tensor = []; | ||
this.func = []; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
ListValue.prototype.s = $util.emptyArray; | ||
ListValue.prototype.i = $util.emptyArray; | ||
ListValue.prototype.f = $util.emptyArray; | ||
ListValue.prototype.b = $util.emptyArray; | ||
ListValue.prototype.type = $util.emptyArray; | ||
ListValue.prototype.shape = $util.emptyArray; | ||
ListValue.prototype.tensor = $util.emptyArray; | ||
ListValue.prototype.func = $util.emptyArray; | ||
ListValue.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.AttrValue.ListValue(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 2: | ||
if (!(m.s && m.s.length)) | ||
m.s = []; | ||
m.s.push(r.bytes()); | ||
break; | ||
case 3: | ||
if (!(m.i && m.i.length)) | ||
m.i = []; | ||
if ((t & 7) === 2) { | ||
var c2 = r.uint32() + r.pos; | ||
while (r.pos < c2) | ||
m.i.push(r.int64()); | ||
} else | ||
m.i.push(r.int64()); | ||
break; | ||
case 4: | ||
if (!(m.f && m.f.length)) | ||
m.f = []; | ||
if ((t & 7) === 2) { | ||
var c2 = r.uint32() + r.pos; | ||
while (r.pos < c2) | ||
m.f.push(r.float()); | ||
} else | ||
m.f.push(r.float()); | ||
break; | ||
case 5: | ||
if (!(m.b && m.b.length)) | ||
m.b = []; | ||
if ((t & 7) === 2) { | ||
var c2 = r.uint32() + r.pos; | ||
while (r.pos < c2) | ||
m.b.push(r.bool()); | ||
} else | ||
m.b.push(r.bool()); | ||
break; | ||
case 6: | ||
if (!(m.type && m.type.length)) | ||
m.type = []; | ||
if ((t & 7) === 2) { | ||
var c2 = r.uint32() + r.pos; | ||
while (r.pos < c2) | ||
m.type.push(r.int32()); | ||
} else | ||
m.type.push(r.int32()); | ||
break; | ||
case 7: | ||
if (!(m.shape && m.shape.length)) | ||
m.shape = []; | ||
m.shape.push($root.tensorflow.TensorShape.decode(r, r.uint32())); | ||
break; | ||
case 8: | ||
if (!(m.tensor && m.tensor.length)) | ||
m.tensor = []; | ||
m.tensor.push($root.tensorflow.Tensor.decode(r, r.uint32())); | ||
break; | ||
case 9: | ||
if (!(m.func && m.func.length)) | ||
m.func = []; | ||
m.func.push($root.tensorflow.NameAttrList.decode(r, r.uint32())); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return ListValue; | ||
})(); | ||
return AttrValue; | ||
})(); | ||
tensorflow.NameAttrList = (function() { | ||
function NameAttrList(p) { | ||
this.attr = {}; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
NameAttrList.prototype.name = ""; | ||
NameAttrList.prototype.attr = $util.emptyObject; | ||
NameAttrList.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.NameAttrList(), k; | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.name = r.string(); | ||
break; | ||
case 2: | ||
r.skip().pos++; | ||
if (m.attr === $util.emptyObject) | ||
m.attr = {}; | ||
k = r.string(); | ||
r.pos++; | ||
m.attr[k] = $root.tensorflow.AttrValue.decode(r, r.uint32()); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return NameAttrList; | ||
})(); | ||
tensorflow.NodeDef = (function() { | ||
function NodeDef(p) { | ||
this.input = []; | ||
this.attr = {}; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
NodeDef.prototype.name = ""; | ||
NodeDef.prototype.op = ""; | ||
NodeDef.prototype.input = $util.emptyArray; | ||
NodeDef.prototype.device = ""; | ||
NodeDef.prototype.attr = $util.emptyObject; | ||
NodeDef.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.NodeDef(), k; | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.name = r.string(); | ||
break; | ||
case 2: | ||
m.op = r.string(); | ||
break; | ||
case 3: | ||
if (!(m.input && m.input.length)) | ||
m.input = []; | ||
m.input.push(r.string()); | ||
break; | ||
case 4: | ||
m.device = r.string(); | ||
break; | ||
case 5: | ||
r.skip().pos++; | ||
if (m.attr === $util.emptyObject) | ||
m.attr = {}; | ||
k = r.string(); | ||
r.pos++; | ||
m.attr[k] = $root.tensorflow.AttrValue.decode(r, r.uint32()); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return NodeDef; | ||
})(); | ||
tensorflow.VersionDef = (function() { | ||
function VersionDef(p) { | ||
this.badConsumers = []; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
VersionDef.prototype.producer = 0; | ||
VersionDef.prototype.minConsumer = 0; | ||
VersionDef.prototype.badConsumers = $util.emptyArray; | ||
VersionDef.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.VersionDef(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.producer = r.int32(); | ||
break; | ||
case 2: | ||
m.minConsumer = r.int32(); | ||
break; | ||
case 3: | ||
if (!(m.badConsumers && m.badConsumers.length)) | ||
m.badConsumers = []; | ||
if ((t & 7) === 2) { | ||
var c2 = r.uint32() + r.pos; | ||
while (r.pos < c2) | ||
m.badConsumers.push(r.int32()); | ||
} else | ||
m.badConsumers.push(r.int32()); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return VersionDef; | ||
})(); | ||
tensorflow.GraphDef = (function() { | ||
function GraphDef(p) { | ||
this.node = []; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
GraphDef.prototype.node = $util.emptyArray; | ||
GraphDef.prototype.versions = null; | ||
GraphDef.prototype.library = null; | ||
GraphDef.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.GraphDef(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
if (!(m.node && m.node.length)) | ||
m.node = []; | ||
m.node.push($root.tensorflow.NodeDef.decode(r, r.uint32())); | ||
break; | ||
case 4: | ||
m.versions = $root.tensorflow.VersionDef.decode(r, r.uint32()); | ||
break; | ||
case 2: | ||
m.library = $root.tensorflow.FunctionDefLibrary.decode(r, r.uint32()); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return GraphDef; | ||
})(); | ||
tensorflow.CollectionDef = (function() { | ||
function CollectionDef(p) { | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
CollectionDef.prototype.nodeList = null; | ||
CollectionDef.prototype.bytesList = null; | ||
CollectionDef.prototype.int64List = null; | ||
CollectionDef.prototype.floatList = null; | ||
CollectionDef.prototype.anyList = null; | ||
var $oneOfFields; | ||
Object.defineProperty(CollectionDef.prototype, "kind", { | ||
get: $util.oneOfGetter($oneOfFields = ["nodeList", "bytesList", "int64List", "floatList", "anyList"]), | ||
set: $util.oneOfSetter($oneOfFields) | ||
}); | ||
CollectionDef.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.CollectionDef(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.nodeList = $root.tensorflow.CollectionDef.NodeList.decode(r, r.uint32()); | ||
break; | ||
case 2: | ||
m.bytesList = $root.tensorflow.CollectionDef.BytesList.decode(r, r.uint32()); | ||
break; | ||
case 3: | ||
m.int64List = $root.tensorflow.CollectionDef.Int64List.decode(r, r.uint32()); | ||
break; | ||
case 4: | ||
m.floatList = $root.tensorflow.CollectionDef.FloatList.decode(r, r.uint32()); | ||
break; | ||
case 5: | ||
m.anyList = $root.tensorflow.CollectionDef.AnyList.decode(r, r.uint32()); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
CollectionDef.NodeList = (function() { | ||
function NodeList(p) { | ||
this.value = []; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
NodeList.prototype.value = $util.emptyArray; | ||
NodeList.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.CollectionDef.NodeList(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
if (!(m.value && m.value.length)) | ||
m.value = []; | ||
m.value.push(r.string()); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return NodeList; | ||
})(); | ||
CollectionDef.BytesList = (function() { | ||
function BytesList(p) { | ||
this.value = []; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
BytesList.prototype.value = $util.emptyArray; | ||
BytesList.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.CollectionDef.BytesList(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
if (!(m.value && m.value.length)) | ||
m.value = []; | ||
m.value.push(r.bytes()); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return BytesList; | ||
})(); | ||
CollectionDef.Int64List = (function() { | ||
function Int64List(p) { | ||
this.value = []; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
Int64List.prototype.value = $util.emptyArray; | ||
Int64List.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.CollectionDef.Int64List(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
if (!(m.value && m.value.length)) | ||
m.value = []; | ||
if ((t & 7) === 2) { | ||
var c2 = r.uint32() + r.pos; | ||
while (r.pos < c2) | ||
m.value.push(r.int64()); | ||
} else | ||
m.value.push(r.int64()); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return Int64List; | ||
})(); | ||
CollectionDef.FloatList = (function() { | ||
function FloatList(p) { | ||
this.value = []; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
FloatList.prototype.value = $util.emptyArray; | ||
FloatList.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.CollectionDef.FloatList(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
if (!(m.value && m.value.length)) | ||
m.value = []; | ||
if ((t & 7) === 2) { | ||
var c2 = r.uint32() + r.pos; | ||
while (r.pos < c2) | ||
m.value.push(r.float()); | ||
} else | ||
m.value.push(r.float()); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return FloatList; | ||
})(); | ||
CollectionDef.AnyList = (function() { | ||
function AnyList(p) { | ||
this.value = []; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
AnyList.prototype.value = $util.emptyArray; | ||
AnyList.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.CollectionDef.AnyList(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
if (!(m.value && m.value.length)) | ||
m.value = []; | ||
m.value.push($root.tensorflow.Any.decode(r, r.uint32())); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return AnyList; | ||
})(); | ||
return CollectionDef; | ||
})(); | ||
tensorflow.SaverDef = (function() { | ||
function SaverDef(p) { | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
SaverDef.prototype.filenameTensorName = ""; | ||
SaverDef.prototype.saveTensorName = ""; | ||
SaverDef.prototype.restoreOpName = ""; | ||
SaverDef.prototype.maxToKeep = 0; | ||
SaverDef.prototype.sharded = false; | ||
SaverDef.prototype.keepCheckpointEveryNHours = 0; | ||
SaverDef.prototype.version = 0; | ||
SaverDef.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.SaverDef(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.filenameTensorName = r.string(); | ||
break; | ||
case 2: | ||
m.saveTensorName = r.string(); | ||
break; | ||
case 3: | ||
m.restoreOpName = r.string(); | ||
break; | ||
case 4: | ||
m.maxToKeep = r.int32(); | ||
break; | ||
case 5: | ||
m.sharded = r.bool(); | ||
break; | ||
case 6: | ||
m.keepCheckpointEveryNHours = r.float(); | ||
break; | ||
case 7: | ||
m.version = r.int32(); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
SaverDef.CheckpointFormatVersion = (function() { | ||
var valuesById = {}, values = Object.create(valuesById); | ||
values[valuesById[0] = "LEGACY"] = 0; | ||
values[valuesById[1] = "V1"] = 1; | ||
values[valuesById[2] = "V2"] = 2; | ||
return values; | ||
})(); | ||
return SaverDef; | ||
})(); | ||
tensorflow.TensorInfo = (function() { | ||
function TensorInfo(p) { | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
TensorInfo.prototype.name = ""; | ||
TensorInfo.prototype.cooSparse = null; | ||
TensorInfo.prototype.dtype = 0; | ||
TensorInfo.prototype.tensorShape = null; | ||
var $oneOfFields; | ||
Object.defineProperty(TensorInfo.prototype, "encoding", { | ||
get: $util.oneOfGetter($oneOfFields = ["name", "cooSparse"]), | ||
set: $util.oneOfSetter($oneOfFields) | ||
}); | ||
TensorInfo.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.TensorInfo(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.name = r.string(); | ||
break; | ||
case 4: | ||
m.cooSparse = $root.tensorflow.TensorInfo.CooSparse.decode(r, r.uint32()); | ||
break; | ||
case 2: | ||
m.dtype = r.int32(); | ||
break; | ||
case 3: | ||
m.tensorShape = $root.tensorflow.TensorShape.decode(r, r.uint32()); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
TensorInfo.CooSparse = (function() { | ||
function CooSparse(p) { | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
CooSparse.prototype.valuesTensorName = ""; | ||
CooSparse.prototype.indicesTensorName = ""; | ||
CooSparse.prototype.denseShapeTensorName = ""; | ||
CooSparse.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.TensorInfo.CooSparse(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.valuesTensorName = r.string(); | ||
break; | ||
case 2: | ||
m.indicesTensorName = r.string(); | ||
break; | ||
case 3: | ||
m.denseShapeTensorName = r.string(); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return CooSparse; | ||
})(); | ||
return TensorInfo; | ||
})(); | ||
tensorflow.SignatureDef = (function() { | ||
function SignatureDef(p) { | ||
this.inputs = {}; | ||
this.outputs = {}; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
SignatureDef.prototype.inputs = $util.emptyObject; | ||
SignatureDef.prototype.outputs = $util.emptyObject; | ||
SignatureDef.prototype.methodName = ""; | ||
SignatureDef.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.SignatureDef(), k; | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
r.skip().pos++; | ||
if (m.inputs === $util.emptyObject) | ||
m.inputs = {}; | ||
k = r.string(); | ||
r.pos++; | ||
m.inputs[k] = $root.tensorflow.TensorInfo.decode(r, r.uint32()); | ||
break; | ||
case 2: | ||
r.skip().pos++; | ||
if (m.outputs === $util.emptyObject) | ||
m.outputs = {}; | ||
k = r.string(); | ||
r.pos++; | ||
m.outputs[k] = $root.tensorflow.TensorInfo.decode(r, r.uint32()); | ||
break; | ||
case 3: | ||
m.methodName = r.string(); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return SignatureDef; | ||
})(); | ||
tensorflow.AssetFileDef = (function() { | ||
function AssetFileDef(p) { | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
AssetFileDef.prototype.tensorInfo = null; | ||
AssetFileDef.prototype.filename = ""; | ||
AssetFileDef.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.AssetFileDef(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.tensorInfo = $root.tensorflow.TensorInfo.decode(r, r.uint32()); | ||
break; | ||
case 2: | ||
m.filename = r.string(); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return AssetFileDef; | ||
})(); | ||
tensorflow.OpDef = (function() { | ||
function OpDef(p) { | ||
this.inputArg = []; | ||
this.outputArg = []; | ||
this.attr = []; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
OpDef.prototype.name = ""; | ||
OpDef.prototype.inputArg = $util.emptyArray; | ||
OpDef.prototype.outputArg = $util.emptyArray; | ||
OpDef.prototype.attr = $util.emptyArray; | ||
OpDef.prototype.deprecation = null; | ||
OpDef.prototype.summary = ""; | ||
OpDef.prototype.description = ""; | ||
OpDef.prototype.isCommutative = false; | ||
OpDef.prototype.isAggregate = false; | ||
OpDef.prototype.isStateful = false; | ||
OpDef.prototype.allowsUninitializedInput = false; | ||
OpDef.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.OpDef(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.name = r.string(); | ||
break; | ||
case 2: | ||
if (!(m.inputArg && m.inputArg.length)) | ||
m.inputArg = []; | ||
m.inputArg.push($root.tensorflow.OpDef.ArgDef.decode(r, r.uint32())); | ||
break; | ||
case 3: | ||
if (!(m.outputArg && m.outputArg.length)) | ||
m.outputArg = []; | ||
m.outputArg.push($root.tensorflow.OpDef.ArgDef.decode(r, r.uint32())); | ||
break; | ||
case 4: | ||
if (!(m.attr && m.attr.length)) | ||
m.attr = []; | ||
m.attr.push($root.tensorflow.OpDef.AttrDef.decode(r, r.uint32())); | ||
break; | ||
case 8: | ||
m.deprecation = $root.tensorflow.OpDef.OpDeprecation.decode(r, r.uint32()); | ||
break; | ||
case 5: | ||
m.summary = r.string(); | ||
break; | ||
case 6: | ||
m.description = r.string(); | ||
break; | ||
case 18: | ||
m.isCommutative = r.bool(); | ||
break; | ||
case 16: | ||
m.isAggregate = r.bool(); | ||
break; | ||
case 17: | ||
m.isStateful = r.bool(); | ||
break; | ||
case 19: | ||
m.allowsUninitializedInput = r.bool(); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
OpDef.ArgDef = (function() { | ||
function ArgDef(p) { | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
ArgDef.prototype.name = ""; | ||
ArgDef.prototype.description = ""; | ||
ArgDef.prototype.type = 0; | ||
ArgDef.prototype.typeAttr = ""; | ||
ArgDef.prototype.numberAttr = ""; | ||
ArgDef.prototype.typeListAttr = ""; | ||
ArgDef.prototype.isRef = false; | ||
ArgDef.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.OpDef.ArgDef(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.name = r.string(); | ||
break; | ||
case 2: | ||
m.description = r.string(); | ||
break; | ||
case 3: | ||
m.type = r.int32(); | ||
break; | ||
case 4: | ||
m.typeAttr = r.string(); | ||
break; | ||
case 5: | ||
m.numberAttr = r.string(); | ||
break; | ||
case 6: | ||
m.typeListAttr = r.string(); | ||
break; | ||
case 16: | ||
m.isRef = r.bool(); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return ArgDef; | ||
})(); | ||
OpDef.AttrDef = (function() { | ||
function AttrDef(p) { | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
AttrDef.prototype.name = ""; | ||
AttrDef.prototype.type = ""; | ||
AttrDef.prototype.defaultValue = null; | ||
AttrDef.prototype.description = ""; | ||
AttrDef.prototype.hasMinimum = false; | ||
AttrDef.prototype.minimum = $util.Long ? $util.Long.fromBits(0,0,false) : 0; | ||
AttrDef.prototype.allowedValues = null; | ||
AttrDef.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.OpDef.AttrDef(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.name = r.string(); | ||
break; | ||
case 2: | ||
m.type = r.string(); | ||
break; | ||
case 3: | ||
m.defaultValue = $root.tensorflow.AttrValue.decode(r, r.uint32()); | ||
break; | ||
case 4: | ||
m.description = r.string(); | ||
break; | ||
case 5: | ||
m.hasMinimum = r.bool(); | ||
break; | ||
case 6: | ||
m.minimum = r.int64(); | ||
break; | ||
case 7: | ||
m.allowedValues = $root.tensorflow.AttrValue.decode(r, r.uint32()); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return AttrDef; | ||
})(); | ||
OpDef.OpDeprecation = (function() { | ||
function OpDeprecation(p) { | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
OpDeprecation.prototype.version = 0; | ||
OpDeprecation.prototype.explanation = ""; | ||
OpDeprecation.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.OpDef.OpDeprecation(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.version = r.int32(); | ||
break; | ||
case 2: | ||
m.explanation = r.string(); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return OpDeprecation; | ||
})(); | ||
return OpDef; | ||
})(); | ||
tensorflow.OpList = (function() { | ||
function OpList(p) { | ||
this.op = []; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
OpList.prototype.op = $util.emptyArray; | ||
OpList.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.OpList(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
if (!(m.op && m.op.length)) | ||
m.op = []; | ||
m.op.push($root.tensorflow.OpDef.decode(r, r.uint32())); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return OpList; | ||
})(); | ||
tensorflow.MetaGraphDef = (function() { | ||
function MetaGraphDef(p) { | ||
this.collectionDef = {}; | ||
this.signatureDef = {}; | ||
this.assetFileDef = []; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
MetaGraphDef.prototype.metaInfoDef = null; | ||
MetaGraphDef.prototype.graphDef = null; | ||
MetaGraphDef.prototype.saverDef = null; | ||
MetaGraphDef.prototype.collectionDef = $util.emptyObject; | ||
MetaGraphDef.prototype.signatureDef = $util.emptyObject; | ||
MetaGraphDef.prototype.assetFileDef = $util.emptyArray; | ||
MetaGraphDef.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.MetaGraphDef(), k; | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.metaInfoDef = $root.tensorflow.MetaGraphDef.MetaInfoDef.decode(r, r.uint32()); | ||
break; | ||
case 2: | ||
m.graphDef = $root.tensorflow.GraphDef.decode(r, r.uint32()); | ||
break; | ||
case 3: | ||
m.saverDef = $root.tensorflow.SaverDef.decode(r, r.uint32()); | ||
break; | ||
case 4: | ||
r.skip().pos++; | ||
if (m.collectionDef === $util.emptyObject) | ||
m.collectionDef = {}; | ||
k = r.string(); | ||
r.pos++; | ||
m.collectionDef[k] = $root.tensorflow.CollectionDef.decode(r, r.uint32()); | ||
break; | ||
case 5: | ||
r.skip().pos++; | ||
if (m.signatureDef === $util.emptyObject) | ||
m.signatureDef = {}; | ||
k = r.string(); | ||
r.pos++; | ||
m.signatureDef[k] = $root.tensorflow.SignatureDef.decode(r, r.uint32()); | ||
break; | ||
case 6: | ||
if (!(m.assetFileDef && m.assetFileDef.length)) | ||
m.assetFileDef = []; | ||
m.assetFileDef.push($root.tensorflow.AssetFileDef.decode(r, r.uint32())); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
MetaGraphDef.MetaInfoDef = (function() { | ||
function MetaInfoDef(p) { | ||
this.tags = []; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
MetaInfoDef.prototype.metaGraphVersion = ""; | ||
MetaInfoDef.prototype.strippedOpList = null; | ||
MetaInfoDef.prototype.anyInfo = null; | ||
MetaInfoDef.prototype.tags = $util.emptyArray; | ||
MetaInfoDef.prototype.tensorflowVersion = ""; | ||
MetaInfoDef.prototype.tensorflowGitVersion = ""; | ||
MetaInfoDef.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.MetaGraphDef.MetaInfoDef(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.metaGraphVersion = r.string(); | ||
break; | ||
case 2: | ||
m.strippedOpList = $root.tensorflow.OpList.decode(r, r.uint32()); | ||
break; | ||
case 3: | ||
m.anyInfo = $root.tensorflow.Any.decode(r, r.uint32()); | ||
break; | ||
case 4: | ||
if (!(m.tags && m.tags.length)) | ||
m.tags = []; | ||
m.tags.push(r.string()); | ||
break; | ||
case 5: | ||
m.tensorflowVersion = r.string(); | ||
break; | ||
case 6: | ||
m.tensorflowGitVersion = r.string(); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return MetaInfoDef; | ||
})(); | ||
return MetaGraphDef; | ||
})(); | ||
tensorflow.SavedModel = (function() { | ||
function SavedModel(p) { | ||
this.metaGraphs = []; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
SavedModel.prototype.savedModelSchemaVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0; | ||
SavedModel.prototype.metaGraphs = $util.emptyArray; | ||
SavedModel.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.SavedModel(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.savedModelSchemaVersion = r.int64(); | ||
break; | ||
case 2: | ||
if (!(m.metaGraphs && m.metaGraphs.length)) | ||
m.metaGraphs = []; | ||
m.metaGraphs.push($root.tensorflow.MetaGraphDef.decode(r, r.uint32())); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return SavedModel; | ||
})(); | ||
tensorflow.FunctionDefLibrary = (function() { | ||
function FunctionDefLibrary(p) { | ||
this["function"] = []; | ||
this.gradient = []; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
FunctionDefLibrary.prototype["function"] = $util.emptyArray; | ||
FunctionDefLibrary.prototype.gradient = $util.emptyArray; | ||
FunctionDefLibrary.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.FunctionDefLibrary(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
if (!(m["function"] && m["function"].length)) | ||
m["function"] = []; | ||
m["function"].push($root.tensorflow.FunctionDef.decode(r, r.uint32())); | ||
break; | ||
case 2: | ||
if (!(m.gradient && m.gradient.length)) | ||
m.gradient = []; | ||
m.gradient.push($root.tensorflow.GradientDef.decode(r, r.uint32())); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return FunctionDefLibrary; | ||
})(); | ||
tensorflow.FunctionDef = (function() { | ||
function FunctionDef(p) { | ||
this.attr = {}; | ||
this.nodeDef = []; | ||
this.ret = {}; | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
FunctionDef.prototype.signature = null; | ||
FunctionDef.prototype.attr = $util.emptyObject; | ||
FunctionDef.prototype.nodeDef = $util.emptyArray; | ||
FunctionDef.prototype.ret = $util.emptyObject; | ||
FunctionDef.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.FunctionDef(), k; | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.signature = $root.tensorflow.OpDef.decode(r, r.uint32()); | ||
break; | ||
case 5: | ||
r.skip().pos++; | ||
if (m.attr === $util.emptyObject) | ||
m.attr = {}; | ||
k = r.string(); | ||
r.pos++; | ||
m.attr[k] = $root.tensorflow.AttrValue.decode(r, r.uint32()); | ||
break; | ||
case 3: | ||
if (!(m.nodeDef && m.nodeDef.length)) | ||
m.nodeDef = []; | ||
m.nodeDef.push($root.tensorflow.NodeDef.decode(r, r.uint32())); | ||
break; | ||
case 4: | ||
r.skip().pos++; | ||
if (m.ret === $util.emptyObject) | ||
m.ret = {}; | ||
k = r.string(); | ||
r.pos++; | ||
m.ret[k] = r.string(); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return FunctionDef; | ||
})(); | ||
tensorflow.GradientDef = (function() { | ||
function GradientDef(p) { | ||
if (p) | ||
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) | ||
if (p[ks[i]] != null) | ||
this[ks[i]] = p[ks[i]]; | ||
} | ||
GradientDef.prototype.functionName = ""; | ||
GradientDef.prototype.gradientFunc = ""; | ||
GradientDef.decode = function decode(r, l) { | ||
if (!(r instanceof $Reader)) | ||
r = $Reader.create(r); | ||
var c = l === undefined ? r.len : r.pos + l, m = new $root.tensorflow.GradientDef(); | ||
while (r.pos < c) { | ||
var t = r.uint32(); | ||
switch (t >>> 3) { | ||
case 1: | ||
m.functionName = r.string(); | ||
break; | ||
case 2: | ||
m.gradientFunc = r.string(); | ||
break; | ||
default: | ||
r.skipType(t & 7); | ||
break; | ||
} | ||
} | ||
return m; | ||
}; | ||
return GradientDef; | ||
})(); | ||
return tensorflow; | ||
})(); | ||
module.exports = $root; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** Namespace tensorflow. */ | ||
var tensorflow; | ||
(function (tensorflow) { | ||
/** DataType enum. */ | ||
var DataType; | ||
(function (DataType) { | ||
DataType[DataType["DT_INVALID"] = 0] = "DT_INVALID"; | ||
DataType[DataType["DT_FLOAT"] = 1] = "DT_FLOAT"; | ||
DataType[DataType["DT_DOUBLE"] = 2] = "DT_DOUBLE"; | ||
DataType[DataType["DT_INT32"] = 3] = "DT_INT32"; | ||
DataType[DataType["DT_UINT8"] = 4] = "DT_UINT8"; | ||
DataType[DataType["DT_INT16"] = 5] = "DT_INT16"; | ||
DataType[DataType["DT_INT8"] = 6] = "DT_INT8"; | ||
DataType[DataType["DT_STRING"] = 7] = "DT_STRING"; | ||
DataType[DataType["DT_COMPLEX64"] = 8] = "DT_COMPLEX64"; | ||
DataType[DataType["DT_INT64"] = 9] = "DT_INT64"; | ||
DataType[DataType["DT_BOOL"] = 10] = "DT_BOOL"; | ||
DataType[DataType["DT_QINT8"] = 11] = "DT_QINT8"; | ||
DataType[DataType["DT_QUINT8"] = 12] = "DT_QUINT8"; | ||
DataType[DataType["DT_QINT32"] = 13] = "DT_QINT32"; | ||
DataType[DataType["DT_BFLOAT16"] = 14] = "DT_BFLOAT16"; | ||
DataType[DataType["DT_FLOAT_REF"] = 101] = "DT_FLOAT_REF"; | ||
DataType[DataType["DT_DOUBLE_REF"] = 102] = "DT_DOUBLE_REF"; | ||
DataType[DataType["DT_INT32_REF"] = 103] = "DT_INT32_REF"; | ||
DataType[DataType["DT_UINT8_REF"] = 104] = "DT_UINT8_REF"; | ||
DataType[DataType["DT_INT16_REF"] = 105] = "DT_INT16_REF"; | ||
DataType[DataType["DT_INT8_REF"] = 106] = "DT_INT8_REF"; | ||
DataType[DataType["DT_STRING_REF"] = 107] = "DT_STRING_REF"; | ||
DataType[DataType["DT_COMPLEX64_REF"] = 108] = "DT_COMPLEX64_REF"; | ||
DataType[DataType["DT_INT64_REF"] = 109] = "DT_INT64_REF"; | ||
DataType[DataType["DT_BOOL_REF"] = 110] = "DT_BOOL_REF"; | ||
DataType[DataType["DT_QINT8_REF"] = 111] = "DT_QINT8_REF"; | ||
DataType[DataType["DT_QUINT8_REF"] = 112] = "DT_QUINT8_REF"; | ||
DataType[DataType["DT_QINT32_REF"] = 113] = "DT_QINT32_REF"; | ||
DataType[DataType["DT_BFLOAT16_REF"] = 114] = "DT_BFLOAT16_REF"; | ||
})(DataType = tensorflow.DataType || (tensorflow.DataType = {})); | ||
var SaverDef; | ||
(function (SaverDef) { | ||
/** CheckpointFormatVersion enum. */ | ||
var CheckpointFormatVersion; | ||
(function (CheckpointFormatVersion) { | ||
CheckpointFormatVersion[CheckpointFormatVersion["LEGACY"] = 0] = "LEGACY"; | ||
CheckpointFormatVersion[CheckpointFormatVersion["V1"] = 1] = "V1"; | ||
CheckpointFormatVersion[CheckpointFormatVersion["V2"] = 2] = "V2"; | ||
})(CheckpointFormatVersion = SaverDef.CheckpointFormatVersion || (SaverDef.CheckpointFormatVersion = {})); | ||
})(SaverDef = tensorflow.SaverDef || (tensorflow.SaverDef = {})); | ||
})(tensorflow = exports.tensorflow || (exports.tensorflow = {})); | ||
//# sourceMappingURL=compiled_api.js.map |
@@ -42,3 +42,3 @@ /** | ||
constructor(weightMap: NamedTensorsMap, tensorArrayMap: TensorArrayMap); | ||
private newFrame(id, frameName); | ||
private newFrame; | ||
/** | ||
@@ -59,4 +59,4 @@ * Set the current context | ||
readonly currentContextIds: string[]; | ||
private generateCurrentContextIds(); | ||
private contextIdforContexts(contexts); | ||
private generateCurrentContextIds; | ||
private contextIdforContexts; | ||
/** | ||
@@ -63,0 +63,0 @@ * Enter a new frame, a new context is pushed on the current context list. |
@@ -0,1 +1,17 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 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. | ||
* ============================================================================= | ||
*/ | ||
import { NamedTensorMap, NamedTensorsMap, TensorInfo } from '../data/types'; | ||
@@ -23,3 +39,3 @@ import { Graph } from '../operations/types'; | ||
*/ | ||
private compile(startNodes?); | ||
private compile; | ||
/** | ||
@@ -35,4 +51,4 @@ * Executes the inference for given input tensors. | ||
execute(inputs: NamedTensorsMap, strictInputCheck?: boolean, outputs?: string | string[]): NamedTensorMap; | ||
private getFrozenTensorIds(tensorMap); | ||
private checkTensorForDisposal(nodeName, node, tensorMap, context, tensorsToKeep, outputNames, intermediateTensorConsumerCount); | ||
private getFrozenTensorIds; | ||
private checkTensorForDisposal; | ||
/** | ||
@@ -54,7 +70,7 @@ * Executes the inference for given input tensors in Async fashion. | ||
*/ | ||
private executeWithControlFlow(inputs, context, outputNames); | ||
private processStack(inputNodes, stack, context, tensorMap, added, tensorsToKeep, outputNames, intermediateTensorConsumerCount); | ||
private processChildNodes(node, stack, context, tensorMap, added); | ||
private calculateOutputs(outputs?); | ||
private findOutputs(tensorMap, context, outputs?); | ||
private executeWithControlFlow; | ||
private processStack; | ||
private processChildNodes; | ||
private calculateOutputs; | ||
private findOutputs; | ||
/** | ||
@@ -64,5 +80,5 @@ * Releases the memory used by the weight tensors. | ||
dispose(): void; | ||
private checkInputShapeAndType(inputs, strictInputCheck?); | ||
private checkInput(inputs, strictInputCheck?); | ||
private checkOutput(compiledNodes, outputs); | ||
private checkInputShapeAndType; | ||
private checkInput; | ||
private checkOutput; | ||
} |
@@ -41,4 +41,4 @@ "use strict"; | ||
while (_) try { | ||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [0, t.value]; | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
@@ -282,4 +282,4 @@ case 0: case 1: t = op; break; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var tensorArrayMap, context, outputNames, tensors, results, outputIds, inputIdArray, inputIds; | ||
var _this = this; | ||
var tensorArrayMap, context, outputNames, tensors, results, outputIds, inputIdArray, inputIds; | ||
return __generator(this, function (_a) { | ||
@@ -324,4 +324,4 @@ switch (_a.label) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var names, inputNodes, stack, tensorMap, intermediateTensorConsumerCount, tensorsToKeep, added, promises; | ||
var _this = this; | ||
var names, inputNodes, stack, tensorMap, intermediateTensorConsumerCount, tensorsToKeep, added, promises; | ||
return __generator(this, function (_a) { | ||
@@ -411,3 +411,4 @@ switch (_a.label) { | ||
} | ||
else if (childNode.inputNames.every(function (name) { | ||
else // Otherwise all inputs must to have value. | ||
if (childNode.inputNames.every(function (name) { | ||
return !!utils_1.getTensor(name, tensorMap, context); | ||
@@ -456,6 +457,10 @@ })) { | ||
input.shape.every(function (dim, index) { return shape_1[index] === -1 || shape_1[index] === dim; }); | ||
tfjs_core_1.util.assert(match, "The shape of dict['" + node.name + "'] provided in model.execute(dict) must be [" + shape_1 + "], but was [" + input.shape + "]"); | ||
tfjs_core_1.util.assert(match, function () { return "The shape of dict['" + node.name + "'] provided in " + | ||
("model.execute(dict) must be [" + shape_1 + "], but was ") + | ||
("[" + input.shape + "]"); }); | ||
} | ||
if (node.attrParams['dtype'] && node.attrParams['dtype'].value) { | ||
tfjs_core_1.util.assert(input.dtype === node.attrParams['dtype'].value, "The dtype of dict['" + node.name + "'] provided in model.execute(dict) must be " + node.attrParams['dtype'].value + ", but was " + input.dtype); | ||
tfjs_core_1.util.assert(input.dtype === node.attrParams['dtype'].value, function () { return "The dtype of dict['" + node.name + "'] provided in " + | ||
"model.execute(dict) must be " + | ||
(node.attrParams['dtype'].value + ", but was " + input.dtype); }); | ||
} | ||
@@ -462,0 +467,0 @@ }); |
@@ -93,4 +93,9 @@ /** | ||
split(length: number[], tensor: Tensor): void; | ||
private assertShapesMatch(shapeA, shapeB, errorMessagePrefix?); | ||
private arraysEqual(n1, n2); | ||
/** | ||
* This differs from util.assertShapesMatch in that it allows values of | ||
* negative one, an undefined size of a dimensinon, in a shape to match | ||
* anything. | ||
*/ | ||
private assertShapesMatchAllowUndefinedSize; | ||
private shapesEqualAllowUndefinedSize; | ||
} |
@@ -106,3 +106,3 @@ "use strict"; | ||
} | ||
this.assertShapesMatch(this.elementShape, tensor.shape, "TensorArray " + this.name + ": Could not write to TensorArray index " + index + "."); | ||
this.assertShapesMatchAllowUndefinedSize(this.elementShape, tensor.shape, "TensorArray " + this.name + ": Could not write to TensorArray index " + index + "."); | ||
if (t && t.read) { | ||
@@ -153,3 +153,3 @@ throw new Error("TensorArray " + this.name + ": Could not write to TensorArray index " + index + ", because it has already been read."); | ||
var tensors = this.readMany(indices); | ||
this.assertShapesMatch(this.elementShape, tensors[0].shape, 'TensorArray shape mismatch: '); | ||
this.assertShapesMatchAllowUndefinedSize(this.elementShape, tensors[0].shape, 'TensorArray shape mismatch: '); | ||
return tfjs_core_1.stack(tensors, 0); | ||
@@ -173,3 +173,3 @@ }; | ||
var tensors = this.readMany(indices); | ||
this.assertShapesMatch(this.elementShape, tensors[0].shape, "TensorArray shape mismatch: tensor array shape (" + this.elementShape + ") vs first tensor shape (" + tensors[0].shape + ")"); | ||
this.assertShapesMatchAllowUndefinedSize(this.elementShape, tensors[0].shape, "TensorArray shape mismatch: tensor array shape (" + this.elementShape + ") vs first tensor shape (" + tensors[0].shape + ")"); | ||
return tfjs_core_1.concat(tensors, 0); | ||
@@ -237,7 +237,14 @@ }; | ||
}; | ||
TensorArray.prototype.assertShapesMatch = function (shapeA, shapeB, errorMessagePrefix) { | ||
/** | ||
* This differs from util.assertShapesMatch in that it allows values of | ||
* negative one, an undefined size of a dimensinon, in a shape to match | ||
* anything. | ||
*/ | ||
TensorArray.prototype.assertShapesMatchAllowUndefinedSize = function (shapeA, shapeB, errorMessagePrefix) { | ||
if (errorMessagePrefix === void 0) { errorMessagePrefix = ''; } | ||
tfjs_core_1.util.assert(this.arraysEqual(shapeA, shapeB), errorMessagePrefix + (" Shapes " + shapeA + " and " + shapeB + " must match")); | ||
tfjs_core_1.util.assert(this.shapesEqualAllowUndefinedSize(shapeA, shapeB), function () { | ||
return errorMessagePrefix + (" Shapes " + shapeA + " and " + shapeB + " must match"); | ||
}); | ||
}; | ||
TensorArray.prototype.arraysEqual = function (n1, n2) { | ||
TensorArray.prototype.shapesEqualAllowUndefinedSize = function (n1, n2) { | ||
if (n1.length !== n2.length) { | ||
@@ -244,0 +251,0 @@ return false; |
@@ -17,69 +17,3 @@ /** | ||
*/ | ||
import { io } from '@tensorflow/tfjs-core'; | ||
import { FrozenModel } from './executor/frozen_model'; | ||
export { FrozenModel, loadTfHubModule } from './executor/frozen_model'; | ||
export { FrozenModel as GraphModel } from './executor/frozen_model'; | ||
export { FrozenModel as FrozenModelJSON } from './executor/frozen_model_json'; | ||
export { GraphModel, loadGraphModel } from './executor/graph_model'; | ||
export { version as version_converter } from './version'; | ||
/** | ||
* Deprecated. Use `tf.loadGraphModel`. | ||
* | ||
* Load the frozen model through url. | ||
* | ||
* Example of loading the MobileNetV2 model and making a prediction with a zero | ||
* input. | ||
* | ||
* ```js | ||
* const GOOGLE_CLOUD_STORAGE_DIR = | ||
* 'https://storage.googleapis.com/tfjs-models/savedmodel/'; | ||
* const MODEL_URL = 'mobilenet_v2_1.0_224/tensorflowjs_model.pb'; | ||
* const WEIGHTS_URL = | ||
* 'mobilenet_v2_1.0_224/weights_manifest.json'; | ||
* const model = await tf.loadFrozenModel(GOOGLE_CLOUD_STORAGE_DIR + MODEL_URL, | ||
* GOOGLE_CLOUD_STORAGE_DIR + WEIGHTS_URL); | ||
* const zeros = tf.zeros([1, 224, 224, 3]); | ||
* model.predict(zeros).print(); | ||
* ``` | ||
* | ||
* @param modelUrl url for the model file generated by scripts/convert.py | ||
* script. | ||
* @param weightManifestUrl url for the weight file generated by | ||
* scripts/convert.py script. | ||
* @param requestOption options for Request, which allows to send credentials | ||
* and custom headers. | ||
* @param onProgress Optional, progress callback function, fired periodically | ||
* before the load is completed. | ||
*/ | ||
/** @doc {heading: 'Models', subheading: 'Loading'} */ | ||
export declare function loadFrozenModel(modelUrl: string, weightsManifestUrl?: string, requestOption?: RequestInit, onProgress?: Function): Promise<FrozenModel>; | ||
/** | ||
* Load a graph model given a URL to the model definition. | ||
* | ||
* Example of loading MobileNetV2 from a URL and making a prediction with a | ||
* zeros input: | ||
* | ||
* ```js | ||
* const modelUrl = | ||
* 'https://storage.googleapis.com/tfjs-models/savedmodel/mobilenet_v2_1.0_224/tensorflowjs_model.pb'; | ||
* const model = await tf.loadGraphModel(modelUrl); | ||
* const zeros = tf.zeros([1, 224, 224, 3]); | ||
* model.predict(zeros).print(); | ||
* ``` | ||
* | ||
* Example of loading MobileNetV2 from a TF Hub URL and making a prediction with | ||
* a zeros input: | ||
* | ||
* ```js | ||
* const modelUrl = | ||
* 'https://tfhub.dev/google/imagenet/mobilenet_v2_140_224/classification/2'; | ||
* const model = await tf.loadGraphModel(modelUrl, {fromTFHub: true}); | ||
* const zeros = tf.zeros([1, 224, 224, 3]); | ||
* model.predict(zeros).print(); | ||
* ``` | ||
* @param modelUrl url for the model file generated by scripts/convert.py | ||
* script or a TF Hub url. | ||
* @param options options for the Request, which allows to send credentials | ||
* and custom headers. | ||
*/ | ||
/** @doc {heading: 'Models', subheading: 'Loading'} */ | ||
export declare function loadGraphModel(modelUrl: string, options?: io.LoadOptions): Promise<FrozenModel>; |
@@ -19,118 +19,7 @@ "use strict"; | ||
*/ | ||
var tfjs_core_1 = require("@tensorflow/tfjs-core"); | ||
var frozen_model_1 = require("./executor/frozen_model"); | ||
var frozen_model_json_1 = require("./executor/frozen_model_json"); | ||
var frozen_model_2 = require("./executor/frozen_model"); | ||
exports.FrozenModel = frozen_model_2.FrozenModel; | ||
exports.loadTfHubModule = frozen_model_2.loadTfHubModule; | ||
var frozen_model_3 = require("./executor/frozen_model"); | ||
exports.GraphModel = frozen_model_3.FrozenModel; | ||
var frozen_model_json_2 = require("./executor/frozen_model_json"); | ||
exports.FrozenModelJSON = frozen_model_json_2.FrozenModel; | ||
var graph_model_1 = require("./executor/graph_model"); | ||
exports.GraphModel = graph_model_1.GraphModel; | ||
exports.loadGraphModel = graph_model_1.loadGraphModel; | ||
var version_1 = require("./version"); | ||
exports.version_converter = version_1.version; | ||
/** | ||
* Deprecated. Use `tf.loadGraphModel`. | ||
* | ||
* Load the frozen model through url. | ||
* | ||
* Example of loading the MobileNetV2 model and making a prediction with a zero | ||
* input. | ||
* | ||
* ```js | ||
* const GOOGLE_CLOUD_STORAGE_DIR = | ||
* 'https://storage.googleapis.com/tfjs-models/savedmodel/'; | ||
* const MODEL_URL = 'mobilenet_v2_1.0_224/tensorflowjs_model.pb'; | ||
* const WEIGHTS_URL = | ||
* 'mobilenet_v2_1.0_224/weights_manifest.json'; | ||
* const model = await tf.loadFrozenModel(GOOGLE_CLOUD_STORAGE_DIR + MODEL_URL, | ||
* GOOGLE_CLOUD_STORAGE_DIR + WEIGHTS_URL); | ||
* const zeros = tf.zeros([1, 224, 224, 3]); | ||
* model.predict(zeros).print(); | ||
* ``` | ||
* | ||
* @param modelUrl url for the model file generated by scripts/convert.py | ||
* script. | ||
* @param weightManifestUrl url for the weight file generated by | ||
* scripts/convert.py script. | ||
* @param requestOption options for Request, which allows to send credentials | ||
* and custom headers. | ||
* @param onProgress Optional, progress callback function, fired periodically | ||
* before the load is completed. | ||
*/ | ||
/** @doc {heading: 'Models', subheading: 'Loading'} */ | ||
function loadFrozenModel(modelUrl, weightsManifestUrl, requestOption, onProgress) { | ||
tfjs_core_1.deprecationWarn('tf.loadFrozenModel() is going away. ' + | ||
'Use tf.loadGraphModel() instead, and note the positional argument changes.'); | ||
if (modelUrl && modelUrl.endsWith('.json')) { | ||
return frozen_model_json_1.loadFrozenModel(modelUrl, requestOption, onProgress); | ||
} | ||
// if users are using the new loadGraphModel API, the weightManifestUrl | ||
// will be omitted. We will build the url using the model URL path and | ||
// default manifest file name. | ||
if (modelUrl != null && weightsManifestUrl == null) { | ||
weightsManifestUrl = getWeightsManifestUrl(modelUrl); | ||
} | ||
return frozen_model_1.loadFrozenModel(modelUrl, weightsManifestUrl, requestOption, onProgress); | ||
} | ||
exports.loadFrozenModel = loadFrozenModel; | ||
function getWeightsManifestUrl(modelUrl) { | ||
var weightsManifestUrl; | ||
if (modelUrl != null) { | ||
var path = modelUrl.substr(0, modelUrl.lastIndexOf('/')); | ||
weightsManifestUrl = path + '/' + frozen_model_1.DEFAULT_MANIFEST_NAME; | ||
} | ||
return weightsManifestUrl; | ||
} | ||
/** | ||
* Load a graph model given a URL to the model definition. | ||
* | ||
* Example of loading MobileNetV2 from a URL and making a prediction with a | ||
* zeros input: | ||
* | ||
* ```js | ||
* const modelUrl = | ||
* 'https://storage.googleapis.com/tfjs-models/savedmodel/mobilenet_v2_1.0_224/tensorflowjs_model.pb'; | ||
* const model = await tf.loadGraphModel(modelUrl); | ||
* const zeros = tf.zeros([1, 224, 224, 3]); | ||
* model.predict(zeros).print(); | ||
* ``` | ||
* | ||
* Example of loading MobileNetV2 from a TF Hub URL and making a prediction with | ||
* a zeros input: | ||
* | ||
* ```js | ||
* const modelUrl = | ||
* 'https://tfhub.dev/google/imagenet/mobilenet_v2_140_224/classification/2'; | ||
* const model = await tf.loadGraphModel(modelUrl, {fromTFHub: true}); | ||
* const zeros = tf.zeros([1, 224, 224, 3]); | ||
* model.predict(zeros).print(); | ||
* ``` | ||
* @param modelUrl url for the model file generated by scripts/convert.py | ||
* script or a TF Hub url. | ||
* @param options options for the Request, which allows to send credentials | ||
* and custom headers. | ||
*/ | ||
/** @doc {heading: 'Models', subheading: 'Loading'} */ | ||
function loadGraphModel(modelUrl, options) { | ||
if (options === void 0) { options = {}; } | ||
if (options == null) { | ||
options = {}; | ||
} | ||
if (options.fromTFHub) { | ||
return frozen_model_1.loadTfHubModule(modelUrl, options.requestInit, options.onProgress); | ||
} | ||
var weightsManifestUrl = undefined; | ||
if (modelUrl && modelUrl.endsWith('.json')) { | ||
return frozen_model_json_1.loadFrozenModel(modelUrl, options.requestInit, options.onProgress); | ||
} | ||
// if users are using the new loadGraphModel API, the weightManifestUrl will | ||
// be omitted. We will build the url using the model URL path and default | ||
// manifest file name. | ||
if (modelUrl != null && weightsManifestUrl == null) { | ||
weightsManifestUrl = getWeightsManifestUrl(modelUrl); | ||
} | ||
return frozen_model_1.loadFrozenModel(modelUrl, weightsManifestUrl, options.requestInit, options.onProgress); | ||
} | ||
exports.loadGraphModel = loadGraphModel; | ||
//# sourceMappingURL=index.js.map |
@@ -0,3 +1,19 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 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. | ||
* ============================================================================= | ||
*/ | ||
import { OpExecutor } from '../types'; | ||
export declare let executeOp: OpExecutor; | ||
export declare const CATEGORY = "arithmetic"; |
@@ -0,3 +1,19 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 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. | ||
* ============================================================================= | ||
*/ | ||
import { OpExecutor } from '../types'; | ||
export declare let executeOp: OpExecutor; | ||
export declare const CATEGORY = "basic_math"; |
@@ -33,4 +33,4 @@ "use strict"; | ||
while (_) try { | ||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [0, t.value]; | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
@@ -37,0 +37,0 @@ case 0: case 1: t = op; break; |
@@ -0,3 +1,19 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 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. | ||
* ============================================================================= | ||
*/ | ||
import { OpExecutor } from '../types'; | ||
export declare let executeOp: OpExecutor; | ||
export declare const CATEGORY = "convolution"; |
@@ -0,3 +1,19 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 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. | ||
* ============================================================================= | ||
*/ | ||
import { OpExecutor } from '../types'; | ||
export declare let executeOp: OpExecutor; | ||
export declare const CATEGORY = "creation"; |
@@ -33,4 +33,4 @@ "use strict"; | ||
while (_) try { | ||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [0, t.value]; | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
@@ -37,0 +37,0 @@ case 0: case 1: t = op; break; |
@@ -0,3 +1,19 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 Google Inc. 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. | ||
* ============================================================================= | ||
*/ | ||
import { OpExecutor } from '../types'; | ||
export declare let executeOp: OpExecutor; | ||
export declare const CATEGORY = "evaluation"; |
@@ -0,3 +1,19 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 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. | ||
* ============================================================================= | ||
*/ | ||
import { OpExecutor } from '../types'; | ||
export declare let executeOp: OpExecutor; | ||
export declare const CATEGORY = "graph"; |
@@ -33,3 +33,3 @@ "use strict"; | ||
case 'StopGradient': | ||
case 'FakeQuantWithMinMaxVars':// This op is currently ignored. | ||
case 'FakeQuantWithMinMaxVars': // This op is currently ignored. | ||
return [ | ||
@@ -36,0 +36,0 @@ utils_1.getParamValue('x', node, tensorMap, context).clone() |
@@ -0,3 +1,19 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 Google Inc. 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. | ||
* ============================================================================= | ||
*/ | ||
import { OpExecutor } from '../types'; | ||
export declare let executeOp: OpExecutor; | ||
export declare const CATEGORY = "image"; |
@@ -0,3 +1,19 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 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. | ||
* ============================================================================= | ||
*/ | ||
import { OpExecutor } from '../types'; | ||
export declare let executeOp: OpExecutor; | ||
export declare const CATEGORY = "logical"; |
@@ -0,3 +1,19 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 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. | ||
* ============================================================================= | ||
*/ | ||
import { OpExecutor } from '../types'; | ||
export declare let executeOp: OpExecutor; | ||
export declare const CATEGORY = "matrices"; |
@@ -0,3 +1,19 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 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. | ||
* ============================================================================= | ||
*/ | ||
import { OpExecutor } from '../types'; | ||
export declare let executeOp: OpExecutor; | ||
export declare const CATEGORY = "normalization"; |
@@ -0,3 +1,19 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 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. | ||
* ============================================================================= | ||
*/ | ||
import { OpExecutor } from '../types'; | ||
export declare let executeOp: OpExecutor; | ||
export declare const CATEGORY = "reduction"; |
@@ -0,3 +1,19 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 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. | ||
* ============================================================================= | ||
*/ | ||
import { OpExecutor } from '../types'; | ||
export declare let executeOp: OpExecutor; | ||
export declare const CATEGORY = "slice_join"; |
@@ -0,3 +1,19 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 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. | ||
* ============================================================================= | ||
*/ | ||
import { OpExecutor } from '../types'; | ||
export declare let executeOp: OpExecutor; | ||
export declare const CATEGORY = "spectral"; |
@@ -0,3 +1,19 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 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. | ||
* ============================================================================= | ||
*/ | ||
import { OpExecutor } from '../types'; | ||
export declare let executeOp: OpExecutor; | ||
export declare const CATEGORY = "transformation"; |
@@ -64,3 +64,3 @@ /** | ||
'type': string; | ||
items?: undefined; | ||
'items'?: undefined; | ||
} | { | ||
@@ -102,3 +102,3 @@ 'type': string; | ||
'type': string; | ||
items?: undefined; | ||
'items'?: undefined; | ||
} | { | ||
@@ -105,0 +105,0 @@ 'type': string; |
@@ -0,1 +1,17 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 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. | ||
* ============================================================================= | ||
*/ | ||
import { tensorflow } from '../data/compiled_api'; | ||
@@ -8,12 +24,13 @@ import { Graph } from './types'; | ||
private constructor(); | ||
private isControlFlow(node); | ||
private isDynamicShape(node); | ||
private isControlFlow; | ||
private isDynamicShape; | ||
transformGraph(graph: tensorflow.IGraphDef): Graph; | ||
private mapNode(node); | ||
private getStringParam(attrs, name, def, keepCase?); | ||
private getBoolParam(attrs, name, def); | ||
private getNumberParam(attrs, name, def); | ||
private getDtypeParam(attrs, name, def); | ||
private getTensorShapeParam(attrs, name, def?); | ||
private getNumericArrayParam(attrs, name, def); | ||
private mapNode; | ||
private decodeBase64; | ||
private getStringParam; | ||
private getBoolParam; | ||
private getNumberParam; | ||
private getDtypeParam; | ||
private getTensorShapeParam; | ||
private getNumericArrayParam; | ||
} |
"use strict"; | ||
/** | ||
* @license | ||
* Copyright 2018 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. | ||
* ============================================================================= | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -52,3 +68,3 @@ var compiled_api_1 = require("../data/compiled_api"); | ||
// Converts the model from Tensorflow GraphDef to local representation for | ||
// deeplearn.js API | ||
// TensorFlow.js API | ||
OperationMapper.prototype.transformGraph = function (graph) { | ||
@@ -117,3 +133,6 @@ var _this = this; | ||
}; | ||
if (!!mapper.inputs) { | ||
if (node.attr == null) { | ||
node.attr = {}; | ||
} | ||
if (mapper.inputs != null) { | ||
newNode.inputParams = | ||
@@ -129,3 +148,3 @@ mapper.inputs.reduce(function (map, param) { | ||
} | ||
if (!!mapper.attrs) { | ||
if (mapper.attrs != null) { | ||
newNode.attrParams = | ||
@@ -184,2 +203,14 @@ mapper.attrs.reduce(function (map, param) { | ||
}; | ||
OperationMapper.prototype.decodeBase64 = function (text) { | ||
if (typeof atob !== 'undefined') { | ||
return atob(text); | ||
} | ||
else if (typeof Buffer !== 'undefined') { | ||
return new Buffer(text, 'base64').toString(); | ||
} | ||
else { | ||
throw new Error('Unable to decode base64 in this environment. ' + | ||
'Missing built-in atob() or Buffer()'); | ||
} | ||
}; | ||
OperationMapper.prototype.getStringParam = function (attrs, name, def, keepCase) { | ||
@@ -189,3 +220,5 @@ if (keepCase === void 0) { keepCase = false; } | ||
if (param !== undefined) { | ||
var value = String.fromCharCode.apply(null, param.s); | ||
var value = Array.isArray(param.s) ? | ||
String.fromCharCode.apply(null, param.s) : | ||
this.decodeBase64(param.s); | ||
return keepCase ? value : value.toLowerCase(); | ||
@@ -200,5 +233,7 @@ } | ||
OperationMapper.prototype.getNumberParam = function (attrs, name, def) { | ||
var param = attrs[name]; | ||
var value = (param ? param[param.value] : def); | ||
return (typeof value === 'number') ? value : value['toInt'](); | ||
var param = attrs[name] || {}; | ||
var value = param['i'] ? param['i'] : (param['f'] ? param['f'] : def); | ||
return (typeof value === 'number') ? | ||
value : | ||
parseInt(value, 10); | ||
}; | ||
@@ -208,3 +243,8 @@ OperationMapper.prototype.getDtypeParam = function (attrs, name, def) { | ||
if (param && param.type) { | ||
switch (param.type) { | ||
// tslint:disable-next-line:no-any | ||
var type = param.type; | ||
if (typeof (param.type) === 'string') { | ||
type = compiled_api_1.tensorflow.DataType[param.type]; | ||
} | ||
switch (type) { | ||
case compiled_api_1.tensorflow.DataType.DT_FLOAT: | ||
@@ -225,5 +265,10 @@ return 'float32'; | ||
if (param && param.shape) { | ||
return param.shape.dim.map(function (dim) { | ||
return (typeof dim.size === 'number') ? dim.size : dim.size['toInt'](); | ||
}); | ||
if (param.shape.unknownRank) { | ||
return undefined; | ||
} | ||
if (param.shape.dim != null) { | ||
return param.shape.dim.map(function (dim) { return (typeof dim.size === 'number') ? | ||
dim.size : | ||
parseInt(dim.size, 10); }); | ||
} | ||
} | ||
@@ -237,3 +282,5 @@ return def; | ||
param.list.i)) | ||
.map(function (v) { return (typeof v === 'number') ? v : v['toInt'](); }); | ||
.map(function (v) { return (typeof v === 'number') ? | ||
v : | ||
parseInt(v, 10); }); | ||
} | ||
@@ -240,0 +287,0 @@ return def; |
@@ -22,3 +22,3 @@ /** | ||
export declare type Category = 'arithmetic' | 'basic_math' | 'control' | 'convolution' | 'custom' | 'dynamic' | 'evaluation' | 'image' | 'creation' | 'graph' | 'logical' | 'matrices' | 'normalization' | 'reduction' | 'slice_join' | 'spectral' | 'transformation'; | ||
export interface ParamMapper { | ||
export declare interface ParamMapper { | ||
name: string; | ||
@@ -29,7 +29,7 @@ type: ParamType; | ||
} | ||
export interface InputParamMapper extends ParamMapper { | ||
export declare interface InputParamMapper extends ParamMapper { | ||
start: number; | ||
end?: number; | ||
} | ||
export interface AttrParamMapper extends ParamMapper { | ||
export declare interface AttrParamMapper extends ParamMapper { | ||
tfName?: string; | ||
@@ -41,3 +41,3 @@ tfDeprecatedName?: string; | ||
} | ||
export interface OpMapper { | ||
export declare interface OpMapper { | ||
tfOpName?: string; | ||
@@ -49,3 +49,3 @@ category?: Category; | ||
} | ||
export interface Node { | ||
export declare interface Node { | ||
name: string; | ||
@@ -64,3 +64,3 @@ op: string; | ||
} | ||
export interface Graph { | ||
export declare interface Graph { | ||
nodes: { | ||
@@ -77,9 +77,9 @@ [key: string]: Node; | ||
export declare type ValueType = string | string[] | number | number[] | number[][] | boolean | boolean[] | Tensor | Tensor[]; | ||
export interface ParamValue { | ||
export declare interface ParamValue { | ||
value?: ValueType; | ||
type: ParamType; | ||
} | ||
export interface InputParamValue extends ParamValue { | ||
export declare interface InputParamValue extends ParamValue { | ||
inputIndexStart?: number; | ||
inputIndexEnd?: number; | ||
} |
/** @license See the LICENSE file. */ | ||
declare const version = "1.0.0-alpha5"; | ||
declare const version = "1.0.0-alpha6"; | ||
export { version }; |
@@ -5,4 +5,4 @@ "use strict"; | ||
// This code is auto-generated, do not modify this file! | ||
var version = '1.0.0-alpha5'; | ||
var version = '1.0.0-alpha6'; | ||
exports.version = version; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@tensorflow/tfjs-converter", | ||
"version": "1.0.0-alpha5", | ||
"version": "1.0.0-alpha6", | ||
"description": "Tensorflow model converter for javascript", | ||
@@ -17,6 +17,6 @@ "main": "dist/src/index.js", | ||
"peerDependencies": { | ||
"@tensorflow/tfjs-core": "1.0.0-alpha3" | ||
"@tensorflow/tfjs-core": "1.0.0-alpha4" | ||
}, | ||
"devDependencies": { | ||
"@tensorflow/tfjs-core": "1.0.0-alpha3", | ||
"@tensorflow/tfjs-core": "1.0.0-alpha4", | ||
"@types/jasmine": "~2.8.6", | ||
@@ -31,8 +31,8 @@ "@types/node-fetch": "1.6.9", | ||
"jasmine-core": "~3.1.0", | ||
"karma": "~2.0.0", | ||
"karma-browserstack-launcher": "~1.3.0", | ||
"karma": "~4.0.0", | ||
"karma-browserstack-launcher": "~1.4.0", | ||
"karma-chrome-launcher": "~2.2.0", | ||
"karma-firefox-launcher": "~1.0.1", | ||
"karma-jasmine": "~1.1.1", | ||
"karma-typescript": "~3.0.12", | ||
"karma-firefox-launcher": "~1.1.0", | ||
"karma-jasmine": "~2.0.1", | ||
"karma-typescript": "~4.0.0", | ||
"node-fetch": "~2.1.2", | ||
@@ -50,4 +50,6 @@ "opn": "~5.1.0", | ||
"tslint-no-circular-imports": "~0.5.0", | ||
"typescript": "~2.7.2", | ||
"yalc": "~1.0.0-pre.21" | ||
"typescript": "~2.9.2", | ||
"yalc": "~1.0.0-pre.21", | ||
"@types/long": "~3.0.32", | ||
"protobufjs": "~6.8.6" | ||
}, | ||
@@ -65,8 +67,5 @@ "scripts": { | ||
"gen-google3-proto": "rollup -c rollup.config.google.js", | ||
"gen-json": "ts-node ./scripts/gen_json.ts" | ||
}, | ||
"dependencies": { | ||
"@types/long": "~3.0.32", | ||
"protobufjs": "~6.8.6" | ||
"gen-json": "ts-node ./scripts/gen_json.ts", | ||
"pb2json": "ts-node ./tools/pb2json_converter.ts" | ||
} | ||
} |
@@ -99,33 +99,41 @@ [![Build Status](https://travis-ci.org/tensorflow/tfjs-converter.svg?branch=master)](https://travis-ci.org/tensorflow/tfjs-converter) | ||
|---|---| | ||
|`--input_format` | The format of input model, use `tf_saved_model` for SavedModel, `tf_frozen_model` for frozen model, `tf_session_bundle` for session bundle, `tf_hub` for TensorFlow Hub module, `tensorflowjs` for TensorFlow.js JSON format, and `keras` for Keras HDF5. | | ||
|`--input_format` | The format of input model, use `tf_saved_model` for SavedModel, `tf_frozen_model` for frozen model, `tf_session_bundle` for session bundle, `tf_hub` for TensorFlow Hub module, `tfjs_layers_model` for TensorFlow.js JSON format, and `keras` for Keras HDF5. | | ||
|<nobr>`--output_node_names`</nobr>| The names of the output nodes, separated by commas.| | ||
|`--output_format`| The desired output format. Must be `tensorflowjs` (the default) or `keras`. Not all pairs of input-output formats are supported. Please file a [github issue](https://github.com/tensorflow/tfjs/issues) if your desired input-output pair is not supported.| | ||
|`--output_format`| The desired output format. Must be `tfjs_layers_model`, `tfjs_graph_model` or `keras`. Not all pairs of input-output formats are supported. Please file a [github issue](https://github.com/tensorflow/tfjs/issues) if your desired input-output pair is not supported.| | ||
|<nobr>`--saved_model_tags`</nobr> | Only applicable to SavedModel conversion. Tags of the MetaGraphDef to load, in comma separated format. Defaults to `serve`.| | ||
|`--signature_name` | Only applicable to TensorFlow Hub module conversion, signature to load. Defaults to `default`. See https://www.tensorflow.org/hub/common_signatures/.| | ||
|`--strip_debug_ops` | Strips out TensorFlow debug operations `Print`, `Assert`, `CheckNumerics`. Defaults to `True`.| | ||
|`--quantization_bytes` | How many bytes to optionally quantize/compress the weights to. Valid values are 1 and 2. which will quantize int32 and float32 to 1 or 2 bytes. The default (unquantized) size is 4 bytes.| | ||
|`--quantization_bytes` | How many bytes to optionally quantize/compress the weights to. Valid values are 1 and 2. which will quantize int32 and float32 to 1 or 2 bytes respectively. The default (unquantized) size is 4 bytes.| | ||
### Format conversions support table | ||
| input format | output `tensorflowjs` | output `keras` | | ||
### Format Conversion Support Tables | ||
Note: Unless stated otherwise, we can infer the value of `--output_format` from the | ||
value of `--input_format`. So the `--output_format` flag can be omitted in | ||
most cases. | ||
#### Python-to-JavaScript | ||
| `--input_format` | `--output_format` | Description | | ||
|---|---|---| | ||
|`keras`| :heavy_check_mark: | :x: | | ||
|`tensorflowjs`| :x: | :heavy_check_mark: | | ||
|`tf_frozen_model`| :heavy_check_mark: | :x: | | ||
|`tf_hub`| :heavy_check_mark: | :x: | | ||
|`tf_saved_model`| :heavy_check_mark: | :x: | | ||
|`tf_session_bundle`| :heavy_check_mark: | :x: | | ||
| `keras` | `tfjs_layers_model` | Convert a keras or tf.keras HDF5 model file to TensorFlow.js Layers model format. Use [`tf.lodLayersModel()`](https://js.tensorflow.org/api/latest/#loadLayersModel) to load the model in JavaScript. | | ||
| `keras_saved_model` | `tfjs_layers_model` | Convert a tf.keras SavedModel model file (from [`tf.contrib.saved_model.save_keras_model`](https://www.tensorflow.org/api_docs/python/tf/contrib/saved_model/save_keras_model)) to TensorFlow.js Layers model format. Use [`tf.lodLayersModel()`](https://js.tensorflow.org/api/latest/#loadLayersModel) to load the model in JavaScript. | | ||
| `tf_frozen_model` | `tfjs_graph_model` | Convert a TensorFlow Frozen Graph (.pb) file to TensorFlow.js graph model format. Use [`tf.loadGraphModel()`](https://js.tensorflow.org/api/latest/#loadGraphModel) to load the converted model in JavaScript. | | ||
| `tf_hub` | `tfjs_graph_model` | Convert a [TF-Hub](https://www.tensorflow.org/hub) model file to TensorFlow.js graph model format. Use [`tf.loadGraphModel()`](https://js.tensorflow.org/api/latest/#loadGraphModel) to load the converted model in JavaScript. | | ||
| `tf_saved_model` | `tfjs_graph_model` | Convert a [TensorFlow SavedModel](https://www.tensorflow.org/guide/saved_model#build_and_load_a_savedmodel) to TensorFlow.js graph model format. Use [`tf.loadGraphModel()`](https://js.tensorflow.org/api/latest/#loadGraphModel) to load the converted model in JavaScript. | | ||
| `tf_session_bundle` | `tfjs_graph_model` | Convert a TensorFlow Session Bundle to TensorFlow.js graph model format. Use [`tf.loadGraphModel()`](https://js.tensorflow.org/api/latest/#loadGraphModel) to load the converted model in JavaScript. | | ||
#### JavaScript-to-Python | ||
| `--input_format` | `--output_format` | Description | | ||
|---|---|---| | ||
| `tfjs_layers_model` | `keras` | Convert a TensorFlow.js Layers model (JSON + binary weight file(s)) to a Keras HDF5 model file. Use [`keras.model.load_model()`](https://keras.io/getting-started/faq/#savingloading-whole-models-architecture-weights-optimizer-state) or [`tf.keras.models.load_model()`](https://www.tensorflow.org/api_docs/python/tf/keras/models/load_model) to load the converted model in Python. | | ||
### Web-friendly format | ||
The conversion script above produces 4 types of files: | ||
The conversion script above produces 2 types of files: | ||
* `tensorflowjs_model.pb` (the dataflow graph) | ||
* `weights_manifest.json` (weight manifest file) | ||
* `model.json` (the two above, in a single file) | ||
* `model.json` (the dataflow graph and weight manifest file) | ||
* `group1-shard\*of\*` (collection of binary weight files) | ||
For `keras` input files, the converter generates `model.json` and `group1-shard\*of\*`. | ||
For other input formats, it generates the `tensorflowjs_model.pb`, `weights_manifest.json`, and `group1-shard\*of\*`. | ||
For example, here is the MobileNet model converted and served in | ||
@@ -135,4 +143,3 @@ following location: | ||
```html | ||
https://storage.cloud.google.com/tfjs-models/savedmodel/mobilenet_v1_1.0_224/optimized_model.pb | ||
https://storage.cloud.google.com/tfjs-models/savedmodel/mobilenet_v1_1.0_224/weights_manifest.json | ||
https://storage.cloud.google.com/tfjs-models/savedmodel/mobilenet_v1_1.0_224/model.json | ||
https://storage.cloud.google.com/tfjs-models/savedmodel/mobilenet_v1_1.0_224/group1-shard1of5 | ||
@@ -145,3 +152,3 @@ ... | ||
Instantiate the [FrozenModel class](./src/executor/frozen_model.ts) and run inference. | ||
Instantiate the [GraphModel class](./src/executor/graph_model.ts) and run inference. | ||
@@ -151,6 +158,5 @@ ```typescript | ||
const MODEL_URL = 'https://.../mobilenet/tensorflowjs_model.pb'; | ||
const WEIGHTS_URL = 'https://.../mobilenet/weights_manifest.json'; | ||
const MODEL_URL = 'https://.../mobilenet/model.json'; | ||
const model = await tf.loadFrozenModel(MODEL_URL, WEIGHTS_URL); | ||
const model = await tf.loadGraphModel(MODEL_URL); | ||
const cat = document.getElementById('cat'); | ||
@@ -165,3 +171,3 @@ model.execute({input: tf.browser.fromPixels(cat)}); | ||
```typescript | ||
const model = await loadFrozenModel(MODEL_URL, WEIGHTS_URL, | ||
const model = await loadGraphModel(MODEL_URL, | ||
{credentials: 'include'}); | ||
@@ -178,3 +184,3 @@ ``` | ||
Therefore, you can load the same frozen model from local file system into | ||
a Node.js program running TensorFlow.js. This is done by calling `loadFrozenModel` with the path | ||
a Node.js program running TensorFlow.js. This is done by calling `loadGraphModel` with the path | ||
to the model files: | ||
@@ -184,7 +190,6 @@ | ||
// Load the tfjs-node binding | ||
import '@tensorflow/tfjs-node'; | ||
import * as tf from '@tensorflow/tfjs-node'; | ||
const MODEL_PATH = 'file:///tmp/mobilenet/tensorflowjs_model.pb'; | ||
const WEIGHTS_PATH = 'file:///tmp/mobilenet/weights_manifest.json'; | ||
const model = await tf.loadFrozenModel(MODEL_PATH, WEIGHTS_PATH); | ||
const MODEL_PATH = 'file:///tmp/mobilenet/model.json'; | ||
const model = await tf.loadGraphModel(MODEL_PATH); | ||
``` | ||
@@ -210,6 +215,6 @@ | ||
const weightManifestUrl = "https://example.org/model/weights_manifest.json"; | ||
const modelUrl = "https://example.org/model/model.json"; | ||
const manifest = await fetch(weightManifestUrl); | ||
this.weightManifest = await manifest.json(); | ||
const model = await fetch(modelUrl); | ||
this.weightManifest = (await model.json())['weightsManifest']; | ||
const weightMap = await tf.io.loadWeights( | ||
@@ -223,3 +228,3 @@ this.weightManifest, "https://example.org/model"); | ||
Image-based models (MobileNet, SqueezeNet, add more if you tested) are the most supported. Models with control flow ops (e.g. RNNs) are not yet supported. The tensorflowjs_converter script will validate the model you have and show a list of unsupported ops in your model. See [this list](./docs/supported_ops.md) for which ops are currently supported. | ||
Image-based models (MobileNet, SqueezeNet, add more if you tested) are the most supported. Models with control flow ops (e.g. RNNs) are also supported. The tensorflowjs_converter script will validate the model you have and show a list of unsupported ops in your model. See [this list](./docs/supported_ops.md) for which ops are currently supported. | ||
@@ -242,3 +247,3 @@ 2. Will model with large weights work? | ||
--input_format=tf_hub \ | ||
--quantization_byptes=1 | ||
--quantization_bytes=1 | ||
'https://tfhub.dev/google/imagenet/mobilenet_v1_100_224/classification/1' \ | ||
@@ -282,3 +287,3 @@ /mobilenet/web_model | ||
$ yarn test --browsers=Chrome --grep='execute' | ||
> ... | ||
@@ -293,16 +298,1 @@ > Chrome 64.0.3282 (Linux 0.0.0): Executed 39 of 39 SUCCESS (0.129 secs / 0 secs) | ||
``` | ||
To generate the static js file for GraphDef proto, run following steps: | ||
1. Generate static js file with comment first, in order to generate typescript definition. | ||
```bash | ||
$ node_modules/protobufjs/bin/pbjs -t static-module -w commonjs -o src/data/compiled_api.js --no-create --no-encode --no-verify --no-convert --no-delimited --no-beautify src/data/api.proto | ||
$ node_modules/protobufjs/bin/pbts -o src/data/compiled_api.d.ts src/data/compiled_api.js | ||
``` | ||
2. Replace the static js file with the version without comments. | ||
```bash | ||
$ node_modules/protobufjs/bin/pbjs -t static-module -w commonjs -o src/data/compiled_api.js --no-create --no-encode --no-verify --no-convert --no-delimited --no-beautify --no-comments src/data/api.proto | ||
``` |
@@ -21,3 +21,3 @@ /** | ||
import {tensorflow} from '../src/data/compiled_api'; | ||
import {tensorflow} from './compiled_api'; | ||
@@ -24,0 +24,0 @@ function replacer(key: string, value: any) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
1
0
2022834
32
180
14956
287
+ Added@tensorflow/tfjs-core@1.0.0-alpha4(transitive)
- Removed@types/long@~3.0.32
- Removedprotobufjs@~6.8.6
- Removed@protobufjs/aspromise@1.1.2(transitive)
- Removed@protobufjs/base64@1.1.2(transitive)
- Removed@protobufjs/codegen@2.0.4(transitive)
- Removed@protobufjs/eventemitter@1.1.0(transitive)
- Removed@protobufjs/fetch@1.1.0(transitive)
- Removed@protobufjs/float@1.0.2(transitive)
- Removed@protobufjs/inquire@1.1.0(transitive)
- Removed@protobufjs/path@1.1.2(transitive)
- Removed@protobufjs/pool@1.1.0(transitive)
- Removed@protobufjs/utf8@1.1.0(transitive)
- Removed@tensorflow/tfjs-core@1.0.0-alpha3(transitive)
- Removed@types/long@3.0.324.0.2(transitive)
- Removed@types/node@10.17.60(transitive)
- Removedlong@4.0.0(transitive)
- Removedprotobufjs@6.8.9(transitive)