Defined in File tensor.h
Note that TensorND is built on TensorStorage, which has some lazy behavior.
allocate contiguous tensor
allocate contiguous tensor from given comp node and layout; layout is required to be contiguous, and its dtype and format would be used
get subtensor according to given slices
get subtensor according to spec
whether underlying storage is empty
whether tensor shape is valid (i.e. ndim != 0)
shape at given dimension, with boundary check
get ptr at given index
get ptr of buffer start; T must match dtype
change the shape without retaining old data, and initialize as contiguous stride
dtype and format would not be changed
totally reset the tensor to given storage and layout
change comp node; see TensorStorage::comp_node()
change the storage and invalidate all data, resulting in an empty tensor
get data type
get tensor format
change underlying dtype
layout would be cleared (reset to ndim=0) if dtype actually changes
change underlying tensor format
layout would be cleared (reset to ndim=0) if format actually changes
copy from another tensor and initialize contiguous layout
If the computing node is empty, it would be copied from src
To copy from device to host, if the two tensors reside on different computing nodes, the caller is responsible to perform sync before copying; a better way is to set empty computing node to host tensor.
For cross-device copy: copy would be synced on comp node of this, and the caller is responsible to sync this comp node with src comp node.
If dtype is valid, it would be checked to match the dtype of src.
Format would be reset to default and layout would be initialized to be contiguous.
copy from another tensor of the same shape, retaining current layout
If storage type of src and this are different and src is not contiguous, a temporary storage would be allocated to first make src contiguous.
non-const version of copy_from_fixlayout
convert to megdnn::TensorND
block host thread to synchronize with the CompNode
similar to HostTensorStorage::proxy_to_default_cpu
Public Static Functions
similar to TensorStorage<>::make_proxy