目录

CreateFollowing

Function Description

Creates a tensor with the specified data type and size, whose data is continuously arranged after the tensor object.

Function Prototype

Parameters

Table 1 Parameters (passing element quantity and data type for Tensor creation)

Parameter Input/Output Description
shape_size Input Number of elements
dt Input Data type, which is of the DataType type.
total_size Output Length of the created tensor in the memory. Length of the tensor object and tensor data.

Table 2 Parameters (passing data type and tensor length for Tensor creation)

Parameter Input/Output Description
dt Input Data type, which is of the DataType type.
tensor_size Input Length of the tensor data, The unit is bytes.
total_size Output Length of the created tensor in the memory. Unlike tensor_size, total_size contains the length of the tensor object and tensor data. The unit is bytes.

Return Value

Pointer to the created tensor.

Restrictions

None

Calling Example

size_t total_size;
auto tensor_holder = Tensor::CreateFollowing(shape_size, tensor_desc.GetDataType(), total_size);