mars.tensor.ascontiguousarray#
- mars.tensor.ascontiguousarray(a, dtype=None, chunk_size=None)[source]#
Return a contiguous tensor (ndim >= 1) in memory (C order).
- Parameters
- Returns
out – Contiguous tensor of same shape and content as a, with type dtype if specified.
- Return type
Tensor
See also
asfortranarray
Convert input to a tensor with column-major memory order.
Tensor.flags
Information about the memory layout of the tensor.
Examples
>>> import mars.tensor as mt >>> x = mt.arange(6).reshape(2,3) >>> mt.ascontiguousarray(x, dtype=mt.float32) array([[ 0., 1., 2.], [ 3., 4., 5.]], dtype=float32) >>> x.flags['C_CONTIGUOUS'] True
Note: This function returns a tensor with at least one-dimension (1-d) so it will not preserve 0-d tensors.