Method Alloc
Alloc(TensorShape, DataType, DeviceType, AllocScope)
Allocates a tensor of a given shape, data type on a given device type, and given scope.
Declaration
Tensor Alloc(TensorShape shape, DataType dataType, DeviceType deviceType, AllocScope scope = AllocScope.LayerOutput)
Parameters
Type | Name | Description |
---|---|---|
Tensor |
shape | The shape of the tensor. |
Data |
dataType | The data type of the tensor. |
Device |
deviceType | The device type to allocate the tensor on. |
Alloc |
scope | Whether the tensor is an output from a layer or internal to the layer. |
Returns
Type | Description |
---|---|
Tensor | The allocated tensor. |
Alloc(TensorShape, DataType, ITensorData, AllocScope)
Allocates a tensor of a given shape, data type, and a given scope from an existing ITensorData
buffer.
Declaration
Tensor Alloc(TensorShape shape, DataType dataType, ITensorData buffer, AllocScope scope = AllocScope.LayerOutput)
Parameters
Type | Name | Description |
---|---|---|
Tensor |
shape | The shape of the tensor. |
Data |
dataType | The data type of the tensor. |
ITensor |
buffer | The buffer to use for the tensor. |
Alloc |
scope | Whether the tensor is an output from a layer or internal to the layer. |
Returns
Type | Description |
---|---|
Tensor | The allocated tensor. |