1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | import { Tensor } from '@tensorflow/tfjs-core';
|
18 | import * as tensorflow from '../data/compiled_api';
|
19 | import { NamedTensorsMap } from '../data/types';
|
20 | import { ExecutionContext } from '../executor/execution_context';
|
21 | import { ResourceManager } from '../executor/resource_manager';
|
22 | export declare type ParamType = 'number' | 'string' | 'string[]' | 'number[]' | 'bool' | 'bool[]' | 'shape' | 'shape[]' | 'tensor' | 'tensors' | 'dtype' | 'dtype[]' | 'func';
|
23 | export declare type Category = 'arithmetic' | 'basic_math' | 'control' | 'convolution' | 'creation' | 'custom' | 'dynamic' | 'evaluation' | 'graph' | 'hash_table' | 'image' | 'logical' | 'matrices' | 'normalization' | 'reduction' | 'slice_join' | 'sparse' | 'spectral' | 'string' | 'transformation';
|
24 | export declare interface ParamMapper {
|
25 | name: string;
|
26 | type: ParamType;
|
27 | defaultValue?: ValueType;
|
28 | notSupported?: boolean;
|
29 | }
|
30 | export declare interface InputParamMapper extends ParamMapper {
|
31 | start: number;
|
32 | end?: number;
|
33 | }
|
34 | export declare interface AttrParamMapper extends ParamMapper {
|
35 | tfName?: string;
|
36 | tfDeprecatedName?: string;
|
37 | }
|
38 | export interface InternalOpExecutor {
|
39 | (node: Node, tensorMap: NamedTensorsMap, context: ExecutionContext): Tensor | Tensor[];
|
40 | }
|
41 | export interface InternalOpAsyncExecutor {
|
42 | (node: Node, tensorMap: NamedTensorsMap, context: ExecutionContext, resourceManager?: ResourceManager): Promise<Tensor[]>;
|
43 | }
|
44 | export declare interface OpMapper {
|
45 | tfOpName: string;
|
46 | category?: Category;
|
47 | inputs?: InputParamMapper[];
|
48 | attrs?: AttrParamMapper[];
|
49 | outputs?: string[];
|
50 | customExecutor?: OpExecutor;
|
51 | }
|
52 | export declare interface Node {
|
53 | signatureKey?: string;
|
54 | name: string;
|
55 | op: string;
|
56 | category: Category;
|
57 | inputNames: string[];
|
58 | inputs: Node[];
|
59 | inputParams: {
|
60 | [key: string]: InputParamValue;
|
61 | };
|
62 | attrParams: {
|
63 | [key: string]: ParamValue;
|
64 | };
|
65 | children: Node[];
|
66 | rawAttrs?: {
|
67 | [k: string]: tensorflow.IAttrValue;
|
68 | };
|
69 | defaultOutput?: number;
|
70 | outputs?: string[];
|
71 | }
|
72 | export declare interface Graph {
|
73 | nodes: {
|
74 | [key: string]: Node;
|
75 | };
|
76 | placeholders: Node[];
|
77 | inputs: Node[];
|
78 | outputs: Node[];
|
79 | weights: Node[];
|
80 | signature?: tensorflow.ISignatureDef;
|
81 | functions?: {
|
82 | [key: string]: Graph;
|
83 | };
|
84 | initNodes?: Node[];
|
85 | }
|
86 | export declare type ValueType = string | string[] | number | number[] | number[][] | boolean | boolean[] | Tensor | Tensor[];
|
87 | export declare interface ParamValue {
|
88 | value?: ValueType;
|
89 | type: ParamType;
|
90 | }
|
91 | export declare interface InputParamValue extends ParamValue {
|
92 | inputIndexStart?: number;
|
93 | inputIndexEnd?: number;
|
94 | }
|
95 | export interface OpExecutor {
|
96 | (node: GraphNode): Tensor | Tensor[] | Promise<Tensor | Tensor[]>;
|
97 | }
|
98 | export interface GraphNode {
|
99 | inputs: Tensor[];
|
100 | attrs: {
|
101 | [key: string]: ValueType;
|
102 | };
|
103 | }
|