In PyTorch, people usually call tensor.permute(2,0,1,3).contiguous(). If I call this function in tensorflow 2.0, is it enough to just call tf.reshape(tensor, perm = [2, 0, 1, 3])?
or what is a contiguous function in tensorflow 2.0?
In PyTorch, people usually call tensor.permute(2,0,1,3).contiguous(). If I call this function in tensorflow 2.0, is it enough to just call tf.reshape(tensor, perm = [2, 0, 1, 3])?
or what is a contiguous function in tensorflow 2.0?
From the official docs of tf.transpose,
In
NumPy, transposes are memory-efficient constant time operations as they simply return a new view of the same data with adjusted strides.TensorFlowdoes not support strides, so transpose returns a new tensor with the items permuted.
Also, TensorFlow doesn't seem to support Fortran (Column-Major) ordering. Hence, I think we automatically get Contiguous (Row-Major) ordering tensor.