numpy

Applicability

Product

Supported

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

x

Atlas inference product

x

Atlas training product

x

Function Description

Converts a tensor into an ndarray of NumPy.

Prototype

1
numpy(copy=False)

Parameters

Parameter

Data Type

Description

copy

bool

The default value is False, indicating that tensors are converted into numpy.ndarray and data is not copied. If the value is True, data needs to be copied.

If the tensor is of the string type, set this parameter to True. Otherwise, an exception is reported.

Returns

numpy.array is returned.

A DfException is thrown upon exceptions. You can catch DfException and retrieve its error_code and message attributes to check the specific error code and error details. For details, see DataFlow Error Codes.

Examples

1
2
tensor = Tensor(1)
array = tensor.numpy()

Constraints

None