get_captured_tensor

Applicable Products

All processors

Function Usage

Returns the captured tensor indexed by capture_index in the capture_tensor sequence.

Prototype

1
get_captured_tensor(capture_index: int) -> NodeIo

Parameters

Parameter

Input/Output

Description

capture_index

Input

Capture sequence number, which must be consistent with the call sequence of capture_tensor.

Returns

Type

Description

NodeIo

The captured tensor, which includes the node and index attributes.

Restrictions

The sequence of capture_index must be the same as that of capture_tensor. Otherwise, the C++ layer fails and an exception is thrown.

Example

1
2
3
4
5
# match_result is replacement(self, match_result) or
# Input parameter of meet_requirements(self, match_result)
nodes = match_result.get_matched_nodes()
tensor0 = match_result.get_captured_tensor(0)  #NodeIo
n0, idx0 = tensor0.node, tensor0.index