CreateFollowing
Function Usage
Creates a tensor with the specified data type and size. Its data is continuously arranged after the TensorV2 object.
Prototype
- Creates a tensor based on the passed element quantity and data type.
1static std::unique_ptr<uint8_t[]> CreateFollowing(const int64_t shape_size, const ge::DataType dt, size_t &total_size)
- Creates a tensor based on the passed data type and tensor length.
1static std::unique_ptr<uint8_t[]> CreateFollowing(const ge::DataType dt, const size_t tensor_size, size_t &total_size)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
shape_size |
Input |
Number of elements. |
dt |
Input |
Data type. The value is of the DataType type. |
total_size |
Output |
Length of the created tensor in the memory. Length of the tensor object and tensor data. |
Parameter |
Input/Output |
Description |
|---|---|---|
dt |
Input |
Data type. The value is of the DataType type. |
tensor_size |
Input |
Length of the tensor data, in 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, in bytes. |
Returns
Pointer to the created tensor
Constraints
None
Examples
1 2 | size_t total_size; auto tensor_holder = TensorV2::CreateFollowing(32, ge::DataType::DT_INT8, total_size); |
Parent topic: TensorV2