gx
chenyc
2025-06-12 7b72ac13a83764a662159d4a49b7fffb90476ecb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
 * @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.
 * =============================================================================
 */
/// <amd-module name="@tensorflow/tfjs-converter/dist/executor/model_analysis" />
import { NamedTensorMap } from '@tensorflow/tfjs-core';
import { NamedTensorsMap } from '../data/types';
import { Graph, Node } from '../operations/types';
export interface ExecutionInfo {
    inputs: NamedTensorMap;
    outputs: Node[];
    usedNodes: Set<string>;
    missingInputs: string[];
    dynamicNode: Node;
    syncInputs: string[];
}
/**
 * Given graph inputs and desired outputs, find the minimal set of nodes
 * to execute in order to compute the outputs. In addition return other useful
 * info such:
 * - Missing inputs needed to compute the output.
 * - Whether the subgraph contains dynamic ops (control flow, dynamic shape).
 * - Alternative inputs in order to avoid async (dynamic op) execution.
 */
export declare function getExecutionSubgraph(inputs: NamedTensorMap, outputs: Node[], weightMap: NamedTensorsMap, initNodes?: Node[]): ExecutionInfo;
/**
 * Given the execution info, return a list of nodes in topological order that
 * need to be executed to compute the output.
 */
export declare function getNodesInTopologicalOrder(graph: Graph, executionInfo: ExecutionInfo): Node[];
/**
 * Given the execution info, return a map from node name to the disposable
 * node name list after its execution.
 *
 * @returns A map from node name to disposable nodes after its
 *     execution. That is, for a node `x`, `nodeLiveUntilMap[x]` indicates
 *     all nodes which their intermediate tensors should be disposed after `x`
 *     being executed.
 */
export declare function getNodeLiveUntilMap(orderedNodes: Node[]): Map<string, Node[]>;
export declare function isControlFlow(node: Node): boolean;
export declare function isDynamicShape(node: Node): boolean;
export declare function isHashTable(node: Node): boolean;