asc2.ravel

asc2.ravel(input: LocalTensor) LocalTensor

Flatten a tensor into a 1D tensor.

This is equivalent to reshape(input, input.size).

The supported data types are: int8, int16, int32, int64, float16, bfloat16, float32, float64.

Parameters:

input – The input tensor

Returns:

A 1D tensor with all elements from the input

Return type:

LocalTensor

Raises:

TypeError – If input is not a LocalTensor

Examples

Flatten a 2D tensor to 1D:

input = asc2.copy_in(x, [0, 0], [32, 16])
result = input.ravel()

This function can also be called as a member function on LocalTensor, as input.ravel(...) instead of ravel(input, ...).