handsfree
Version:
Quickly integrate face, hand, and/or pose tracking to your frontend projects in a snap ✨👌
1,271 lines (1,256 loc) • 324 kB
JavaScript
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tensorflow/tfjs-core')) :
typeof define === 'function' && define.amd ? define(['exports', '@tensorflow/tfjs-core'], factory) :
(global = global || self, factory(global.tf = global.tf || {}, global.tf));
}(this, (function (exports, tfc) { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. 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
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var __assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
function __awaiter(thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
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];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
/** 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 || (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 || (SaverDef = {}));
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
var CUSTOM_OPS = {};
/**
* Register an Op for graph model executor. This allow you to register
* TensorFlow custom op or override existing op.
*
* Here is an example of registering a new MatMul Op.
* ```js
* const customMatmul = (node) =>
* tf.matMul(
* node.inputs[0], node.inputs[1],
* node.attrs['transpose_a'], node.attrs['transpose_b']);
*
* tf.registerOp('MatMul', customMatmul);
* ```
* The inputs and attrs of the node object is based on the TensorFlow op
* registry.
*
* @param name The Tensorflow Op name.
* @param opFunc An op function which is called with the current graph node
* during execution and needs to return a tensor or a list of tensors. The node
* has the following attributes:
* - attr: A map from attribute name to its value
* - inputs: A list of input tensors
*/
/** @doc {heading: 'Models', subheading: 'Op Registry'} */
function registerOp(name, opFunc) {
var opMapper = {
tfOpName: name,
category: 'custom',
inputs: [],
attrs: [],
customExecutor: opFunc
};
CUSTOM_OPS[name] = opMapper;
}
/**
* Retrieve the OpMapper object for the registered op.
*
* @param name The Tensorflow Op name.
*/
/** @doc {heading: 'Models', subheading: 'Op Registry'} */
function getRegisteredOp(name) {
return CUSTOM_OPS[name];
}
/**
* Deregister the Op for graph model executor.
*
* @param name The Tensorflow Op name.
*/
/** @doc {heading: 'Models', subheading: 'Op Registry'} */
function deregisterOp(name) {
delete CUSTOM_OPS[name];
}
/**
* @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.
* =============================================================================
*/
function getParamValue(paramName, node, tensorMap, context) {
var inputParam = node.inputParams[paramName];
if (inputParam && inputParam.inputIndexStart !== undefined) {
var start = inputParam.inputIndexStart;
var end = inputParam.inputIndexEnd === 0 ?
undefined :
(inputParam.inputIndexEnd === undefined ? start + 1 :
inputParam.inputIndexEnd);
if (inputParam.type === 'tensor') {
return getTensor(node.inputNames[inputParam.inputIndexStart], tensorMap, context);
}
if (inputParam.type === 'tensors') {
var inputs = node.inputNames.slice(start, end);
return inputs.map(function (name) { return getTensor(name, tensorMap, context); });
}
var tensor = getTensor(node.inputNames.slice(start)[0], tensorMap, context);
var data = tensor.dataSync();
return inputParam.type === 'number' ?
data[0] :
tfc.util.toNestedArray(tensor.shape, data);
}
var attrParam = node.attrParams[paramName];
return attrParam && attrParam.value;
}
/**
* Retrieve the tensor based on input name by extracting the node name and
* output index information.
* @param name Node input name
* @param tensorsMap Tensors map keyed by the node
*/
function getTensor(name, tensorsMap, context) {
var _a = parseNodeName(name), nodeName = _a[0], index = _a[1];
var contextId = context.currentContextIds.find(function (contextId) {
return !!tensorsMap[getNodeNameWithContextId(nodeName, contextId)];
});
return contextId !== undefined ?
tensorsMap[getNodeNameWithContextId(nodeName, contextId)][index] :
undefined;
}
/**
* Retrieve the tensors based on input name for current context.
* @param name Node input name
* @param tensorsMap Tensors map keyed by the node
*/
function getTensorsForCurrentContenxt(name, tensorsMap, context) {
return tensorsMap[getNodeNameWithContextId(name, context.currentContextId)];
}
/**
* Returns the node name and index from the Node input name.
* @param inputName The input name of the node, in format of
* node_name:output_index, i.e. MatMul:0, if the output_index is not set, it is
* default to 0.
*/
function getNodeNameAndIndex(inputName, context) {
var _a = parseNodeName(inputName), nodeName = _a[0], index = _a[1];
return [
getNodeNameWithContextId(nodeName, context && context.currentContextId),
index
];
}
function getNodeNameWithContextId(name, contextId) {
return !!contextId ? name + "-" + contextId : name;
}
function parseNodeName(name) {
var parts = name.split(':');
if (parts.length === 1) {
return [name, 0];
}
var nodeName = parts[0];
return [nodeName, Number(parts[parts.length - 1])];
}
function getPadding(node, tensorMap, context) {
var pad = getParamValue('pad', node, tensorMap, context);
if (pad === 'explicit') {
// This is 1d array, we need to convert it to 2d array
pad = getParamValue('explicitPaddings', node, tensorMap, context);
var explicitPadding = [[0, 0], [0, 0], [0, 0], [0, 0]];
for (var i = 0; i < 4; i++) {
explicitPadding[i][0] = pad[i * 2];
explicitPadding[i][1] = pad[i * 2 + 1];
}
return explicitPadding;
}
return pad;
}
/**
* @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.
* =============================================================================
*/
var json = [
{
'tfOpName': 'Add',
'category': 'arithmetic',
'inputs': [
{ 'start': 0, 'name': 'a', 'type': 'tensor' },
{ 'start': 1, 'name': 'b', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'AddV2',
'category': 'arithmetic',
'inputs': [
{ 'start': 0, 'name': 'a', 'type': 'tensor' },
{ 'start': 1, 'name': 'b', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'AddN',
'category': 'arithmetic',
'inputs': [{ 'start': 0, 'end': 0, 'name': 'tensors', 'type': 'tensors' }]
},
{
'tfOpName': 'BiasAdd',
'category': 'arithmetic',
'inputs': [
{ 'start': 0, 'name': 'a', 'type': 'tensor' },
{ 'start': 1, 'name': 'b', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Sub',
'category': 'arithmetic',
'inputs': [
{ 'start': 0, 'name': 'a', 'type': 'tensor' },
{ 'start': 1, 'name': 'b', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'RealDiv',
'category': 'arithmetic',
'inputs': [
{ 'start': 0, 'name': 'a', 'type': 'tensor' },
{ 'start': 1, 'name': 'b', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Div',
'category': 'arithmetic',
'inputs': [
{ 'start': 0, 'name': 'a', 'type': 'tensor' },
{ 'start': 1, 'name': 'b', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'DivNoNan',
'category': 'arithmetic',
'inputs': [
{ 'start': 0, 'name': 'a', 'type': 'tensor' },
{ 'start': 1, 'name': 'b', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'FloorDiv',
'category': 'arithmetic',
'inputs': [
{ 'start': 0, 'name': 'a', 'type': 'tensor' },
{ 'start': 1, 'name': 'b', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Mul',
'category': 'arithmetic',
'inputs': [
{ 'start': 0, 'name': 'a', 'type': 'tensor' },
{ 'start': 1, 'name': 'b', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Maximum',
'category': 'arithmetic',
'inputs': [
{ 'start': 0, 'name': 'a', 'type': 'tensor' },
{ 'start': 1, 'name': 'b', 'type': 'tensor' }
]
},
{
'tfOpName': 'Minimum',
'category': 'arithmetic',
'inputs': [
{ 'start': 0, 'name': 'a', 'type': 'tensor' },
{ 'start': 1, 'name': 'b', 'type': 'tensor' }
]
},
{
'tfOpName': 'Pow',
'category': 'arithmetic',
'inputs': [
{ 'start': 0, 'name': 'a', 'type': 'tensor' },
{ 'start': 1, 'name': 'b', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'SquaredDifference',
'category': 'arithmetic',
'inputs': [
{ 'start': 0, 'name': 'a', 'type': 'tensor' },
{ 'start': 1, 'name': 'b', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Mod',
'category': 'arithmetic',
'inputs': [
{ 'start': 0, 'name': 'a', 'type': 'tensor' },
{ 'start': 1, 'name': 'b', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'FloorMod',
'category': 'arithmetic',
'inputs': [
{ 'start': 0, 'name': 'a', 'type': 'tensor' },
{ 'start': 1, 'name': 'b', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
}
];
var arithmetic = {
__proto__: null,
json: json
};
/**
* @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.
* =============================================================================
*/
var json$1 = [
{
'tfOpName': 'Abs',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Acos',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Asin',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Atan',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Atan2',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
{ 'start': 1, 'name': 'y', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Ceil',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'ClipByValue',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'clip_value_min', 'name': 'clipValueMin', 'type': 'number' },
{ 'tfName': 'clip_value_max', 'name': 'clipValueMax', 'type': 'number' }
]
},
{
'tfOpName': 'Complex',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'real', 'type': 'tensor' },
{ 'start': 1, 'name': 'imag', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'ComplexAbs',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Cos',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Cosh',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Elu',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Exp',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Floor',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Log',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Imag',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }, {
'tfName': 'Tout',
'name': 'outputType',
'type': 'dtype',
'notSupported': true
}
]
},
{
'tfOpName': 'Neg',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Real',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }, {
'tfName': 'Tout',
'name': 'outputType',
'type': 'dtype',
'notSupported': true
}
]
},
{
'tfOpName': 'Prelu',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
{ 'start': 1, 'name': 'alpha', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Relu',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Relu6',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }, {
'tfName': 'clipValueMin',
'name': 'clipValueMin',
'type': 'number',
'defaultValue': 0
},
{
'tfName': 'clipValueMax',
'name': 'clipValueMax',
'type': 'number',
'defaultValue': 6
}
]
},
{
'tfOpName': 'Selu',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Sigmoid',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Sin',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Sinh',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Sqrt',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Rsqrt',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Square',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Tan',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Tanh',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Sign',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Round',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Expm1',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Log1p',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Reciprocal',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Softplus',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Asinh',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Acosh',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Atanh',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Erf',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'Prod',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
{ 'start': 1, 'name': 'axes', 'type': 'number[]' },
],
'attrs': [
{
'tfName': 'keep_dims',
'name': 'keepDims',
'type': 'bool',
'notSupported': true
},
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'LeakyRelu',
'category': 'basic_math',
'inputs': [
{ 'start': 0, 'name': 'x', 'type': 'tensor' },
],
'attrs': [
{
'tfName': 'alpha',
'name': 'alpha',
'type': 'number',
'defaultValue': 0.2
},
{
'tfName': 'T',
'name': 'dtype',
'type': 'dtype',
'notSupported': true
}
]
}
];
var basicMath = {
__proto__: null,
json: json$1
};
/**
* @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.
* =============================================================================
*/
var json$2 = [
{
'tfOpName': 'LoopCond',
'category': 'control',
'inputs': [{ 'start': 0, 'name': 'pred', 'type': 'tensor' }]
},
{
'tfOpName': 'Switch',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'data', 'type': 'tensor' },
{ 'start': 1, 'name': 'pred', 'type': 'tensor' }
]
},
{
'tfOpName': 'Merge',
'category': 'control',
'inputs': [{ 'start': 0, 'end': 0, 'name': 'tensors', 'type': 'tensors' }]
},
{
'tfOpName': 'Enter',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'tensor', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true },
{ 'tfName': 'frame_name', 'name': 'frameName', 'type': 'string' },
{ 'tfName': 'is_constant', 'name': 'isConstant', 'type': 'bool' }
]
},
{
'tfOpName': 'Exit',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'tensor', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'NextIteration',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'tensor', 'type': 'tensor' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'TensorArrayV3',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'size', 'type': 'number' },
],
'attrs': [
{ 'tfName': 'dtype', 'name': 'dtype', 'type': 'dtype' },
{ 'tfName': 'element_shape', 'name': 'elementShape', 'type': 'shape' },
{ 'tfName': 'dynamic_size', 'name': 'dynamicSize', 'type': 'bool' },
{ 'tfName': 'clear_after_read', 'name': 'clearAfterRead', 'type': 'bool' },
{
'tfName': 'identical_element_shapes',
'name': 'identicalElementShapes',
'type': 'bool'
},
{ 'tfName': 'tensor_array_name', 'name': 'name', 'type': 'string' }
]
},
{
'tfOpName': 'TensorArrayWriteV3',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'tensorArrayId', 'type': 'tensor' },
{ 'start': 1, 'name': 'index', 'type': 'number' },
{ 'start': 2, 'name': 'tensor', 'type': 'tensor' },
{ 'start': 3, 'name': 'flowIn', 'type': 'number' },
],
'attrs': [
{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype', 'notSupported': true }
]
},
{
'tfOpName': 'TensorArrayReadV3',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'tensorArrayId', 'type': 'tensor' },
{ 'start': 1, 'name': 'index', 'type': 'number' },
{ 'start': 2, 'name': 'flowIn', 'type': 'number' },
],
'attrs': [{
'tfName': 'dtype',
'name': 'dtype',
'type': 'dtype',
'notSupported': true
}]
},
{
'tfOpName': 'TensorArrayGatherV3',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'tensorArrayId', 'type': 'tensor' },
{ 'start': 1, 'name': 'indices', 'type': 'number[]' },
{ 'start': 2, 'name': 'flowIn', 'type': 'number' },
],
'attrs': [
{ 'tfName': 'dtype', 'name': 'dtype', 'type': 'dtype' },
{ 'tfName': 'element_shape', 'name': 'elementShape', 'type': 'shape' }
]
},
{
'tfOpName': 'TensorArrayScatterV3',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'tensorArrayId', 'type': 'tensor' },
{ 'start': 1, 'name': 'indices', 'type': 'number[]' },
{ 'start': 2, 'name': 'tensor', 'type': 'tensor' },
{ 'start': 3, 'name': 'flowIn', 'type': 'number' },
],
'attrs': [{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype' }]
},
{
'tfOpName': 'TensorArrayConcatV3',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'tensorArrayId', 'type': 'tensor' },
{ 'start': 1, 'name': 'flowIn', 'type': 'number' },
],
'attrs': [
{ 'tfName': 'dtype', 'name': 'dtype', 'type': 'dtype' }, {
'tfName': 'element_shape_except0',
'name': 'elementShapeExcept0',
'type': 'shape',
'notSupported': true
}
]
},
{
'tfOpName': 'TensorArraySplitV3',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'tensorArrayId', 'type': 'tensor' },
{ 'start': 1, 'name': 'tensor', 'type': 'tensor' },
{ 'start': 2, 'name': 'lengths', 'type': 'number[]' },
{ 'start': 3, 'name': 'flowIn', 'type': 'number' },
],
'attrs': [{ 'tfName': 'T', 'name': 'dtype', 'type': 'dtype' }]
},
{
'tfOpName': 'TensorArraySizeV3',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'tensorArrayId', 'type': 'tensor' },
{ 'start': 1, 'name': 'flowIn', 'type': 'number' }
]
},
{
'tfOpName': 'TensorArrayCloseV3',
'category': 'control',
'inputs': [{ 'start': 0, 'name': 'tensorArrayId', 'type': 'tensor' }]
},
{
'tfOpName': 'StatelessIf',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'cond', 'type': 'tensor' },
{ 'start': 1, 'end': 0, 'name': 'args', 'type': 'tensors' }
],
'attrs': [
{ 'tfName': 'then_branch', 'name': 'thenBranch', 'type': 'func' },
{ 'tfName': 'else_branch', 'name': 'elseBranch', 'type': 'func' }
]
},
{
'tfOpName': 'If',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'cond', 'type': 'tensor' },
{ 'start': 1, 'end': 0, 'name': 'args', 'type': 'tensors' }
],
'attrs': [
{ 'tfName': 'then_branch', 'name': 'thenBranch', 'type': 'func' },
{ 'tfName': 'else_branch', 'name': 'elseBranch', 'type': 'func' }
]
},
{
'tfOpName': 'StatelessWhile',
'category': 'control',
'inputs': [
{ 'start': 0, 'end': 0, 'name': 'args', 'type': 'tensors' },
],
'attrs': [
{ 'tfName': 'cond', 'name': 'cond', 'type': 'func' },
{ 'tfName': 'body', 'name': 'body', 'type': 'func' }
]
},
{
'tfOpName': 'While',
'category': 'control',
'inputs': [
{ 'start': 0, 'end': 0, 'name': 'args', 'type': 'tensors' },
],
'attrs': [
{ 'tfName': 'cond', 'name': 'cond', 'type': 'func' },
{ 'tfName': 'body', 'name': 'body', 'type': 'func' }
]
},
{
'tfOpName': 'TensorListScatter',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'tensor', 'type': 'tensor' },
{ 'start': 1, 'name': 'indices', 'type': 'number[]' },
{ 'start': 2, 'name': 'elementShape', 'type': 'shape' }
],
'attrs': [{ 'tfName': 'element_dtype', 'name': 'elementDType', 'type': 'dtype' }]
},
{
'tfOpName': 'TensorListScatterV2',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'tensor', 'type': 'tensor' },
{ 'start': 1, 'name': 'indices', 'type': 'number[]' },
{ 'start': 2, 'name': 'elementShape', 'type': 'shape' },
{ 'start': 3, 'name': 'numElements', 'type': 'number' },
],
'attrs': [{ 'tfName': 'element_dtype', 'name': 'elementDType', 'type': 'dtype' }]
},
{
'tfOpName': 'TensorListGather',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'tensorListId', 'type': 'tensor' },
{ 'start': 1, 'name': 'indices', 'type': 'number[]' },
{ 'start': 2, 'name': 'elementShape', 'type': 'shape' },
],
'attrs': [{ 'tfName': 'element_dtype', 'name': 'elementDType', 'type': 'dtype' }]
},
{
'tfOpName': 'TensorListGetItem',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'tensorListId', 'type': 'tensor' },
{ 'start': 1, 'name': 'index', 'type': 'number' },
{ 'start': 2, 'name': 'elementShape', 'type': 'shape' },
],
'attrs': [{ 'tfName': 'element_dtype', 'name': 'elementDType', 'type': 'dtype' }]
},
{
'tfOpName': 'TensorListSetItem',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'tensorListId', 'type': 'tensor' },
{ 'start': 1, 'name': 'index', 'type': 'number' },
{ 'start': 2, 'name': 'tensor', 'type': 'tensor' },
],
'attrs': [{ 'tfName': 'element_dtype', 'name': 'elementDType', 'type': 'dtype' }]
},
{
'tfOpName': 'TensorListReserve',
'category': 'control',
'inputs': [
{ 'start': 0, 'name': 'elementShape', 'type': 'shape' },