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 |
|---|---|---|
| TensorShape | shape | The shape of the tensor. |
| DataType | dataType | The data type of the tensor. |
| DeviceType | deviceType | The device type to allocate the tensor on. |
| AllocScope | 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 |
|---|---|---|
| TensorShape | shape | The shape of the tensor. |
| DataType | dataType | The data type of the tensor. |
| ITensorData | buffer | The buffer to use for the tensor. |
| AllocScope | scope | Whether the tensor is an output from a layer or internal to the layer. |
Returns
| Type | Description |
|---|---|
| Tensor | The allocated tensor. |