pub unsafe extern "C" fn nn_tensor_assign(
tensor: *mut NNTensor,
type_: NNTensorType,
n_dims: i32,
shape: *const i32,
data: *mut c_void,
) -> NNErrorExpand description
Assigns the tensor parameters and optionally data pointer. The default implementation uses the data buffer as the internal storage for tensor data and it MUST outlive the tensor. For engine plugins they may choose how to use the data but for the OpenCL example if data is provided it will be copied into the OpenCL buffer then otherwise never used again. If NULL is provided for data the OpenCL engine would create the memory and leave it unassigned.
If using the default implementation and leaving data NULL then all operations which require data will fail. The most dynamic tensor setup with optional data would be to call assign to setup the parameters with NULL data, then calling @ref nn_tensor_native_handle to see if one was created, if not the data buffer can be malloc’ed followed by a call to @ref nn_tensor_set_native_handle with this buffer. One could also call nn_tensor_assign a second time with data set to the malloc’ed data.
@param tensor Pointer to the given tensor object. @param type The data type that the tensor is storing (The type of the provided data). @param n_dims The number of dimensions in the provided tensor. @param shape The shape of the given tensor. @param data The new tensor data to be placed within the tensor provided.
@public @memberof NNTensor @since 2.0