UNPKG

2.12 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2018 Google Inc. All Rights Reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 * =============================================================================
16 */
17import { backend_util } from '@tensorflow/tfjs';
18export declare class TensorMetadata {
19 id: number;
20 shape: number[];
21 dtype: number;
22}
23export declare class TFEOpAttr {
24 name: string;
25 type: number;
26 value: boolean | number | object | string | number[];
27}
28export interface TFJSBinding {
29 TensorMetadata: typeof TensorMetadata;
30 TFEOpAttr: typeof TFEOpAttr;
31 createTensor(shape: number[], dtype: number, buffer: backend_util.BackendValues): number;
32 deleteTensor(tensorId: number): void;
33 tensorDataSync(tensorId: number): Float32Array | Int32Array | Uint8Array;
34 executeOp(opName: string, opAttrs: TFEOpAttr[], inputTensorIds: number[], numOutputs: number): TensorMetadata[];
35 loadSavedModel(exportDir: string, tags: string): number;
36 deleteSavedModel(savedModelId: number): void;
37 runSavedModel(savedModelId: number, inputTensorIds: number[], inputOpNames: string, outputOpNames: string): TensorMetadata[];
38 getNumOfSavedModels(): number;
39 isUsingGpuDevice(): boolean;
40 TF_FLOAT: number;
41 TF_INT32: number;
42 TF_INT64: number;
43 TF_BOOL: number;
44 TF_COMPLEX64: number;
45 TF_STRING: number;
46 TF_RESOURCE: number;
47 TF_UINT8: number;
48 TF_ATTR_STRING: number;
49 TF_ATTR_INT: number;
50 TF_ATTR_FLOAT: number;
51 TF_ATTR_BOOL: number;
52 TF_ATTR_TYPE: number;
53 TF_ATTR_SHAPE: number;
54 TF_ATTR_RESOURCE: number;
55 TF_Version: string;
56}