numpy

Applicability

Product

Supported (Yes/No)

Atlas 350 Accelerator Card

No

Atlas A3 training product/Atlas A3 inference product

Yes

Atlas A2 training product/Atlas A2 inference product

Yes

Atlas 200I/500 A2 inference product

No

Atlas inference product

No

Atlas training product

No

Note: For the Atlas A2 training product/Atlas A2 inference product, only the Atlas 800I A2 inference server and A200I A2 Box heterogeneous subrack are supported.

Function Description

Obtains the NumPy data of a tensor.

Prototype

1
numpy(copy=False)

Parameters

Parameter

Data Type

Description

copy

bool

The value can be False or True.

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 thrown.

Example

1
2
tensor = Tensor(numpy.array([1]))
np_arr = tensor.numpy()

Returns

Returns numpy.array.

Constraints

None