feed

Applicable Products

Product

Supported

Atlas A3 training products/Atlas A3 inference products

√

Atlas A2 training products/Atlas A2 inference products

√

Atlas 200I/500 A2 inference products

x

Atlas inference products

x

Atlas training products

x

Function Description

Inputs data to a graph. A serializable input is supported.

Prototype

1
feed(feed_dict, timeout=-1, partial_inputs = False) -> int

Parameters

Parameter

Data Type

Value Description

feed_dict

Dict[FlowData, Any]

The key is a FlowData node, and the value can be any input that can be serialized.

To connect to the NPU model, the input must be of the dataflow.Tensor type.

timeout

int

Timeout period for inputting data, in ms. The value range is [0, 2147483647), and the value -1 indicates that no timeout will occur.

partial_inputs

bool

Whether feed_dict supports containing only partial inputs of the model whenever the feed API is called. The value can be:

  • True: The feed_dict parameter can contain only partial inputs of the model.
  • False: The feed_dict parameter must contain all inputs of the model.

The default value is False.

Returns

0 is returned in normal scenarios.

A specific error code is returned and error logs are printed in abnormal scenarios.

Examples

1
2
3
import dataflow as df
graph = df.FlowGraph(...)
graph.feed(...)

Constraints

If an input of the non-dataflow.Tensor type is used, decorators @pyflow and @method must be used together.