![](/img/trans.png)
[英]"ValueError: No gradients provided for any variable: ['Variable:0']." in Tensorflow2.0
[英]Is there any contiguous function in tensorflow2.0?
在 PyTorch 中,人们通常调用tensor.permute(2,0,1,3).contiguous()
。 如果我在 tensorflow 2.0 中调用这个 function,只调用tf.reshape(tensor, perm = [2, 0, 1, 3])
就足够了吗?
或者 tensorflow 2.0 中的连续 function 是什么?
来自tf.transpose的官方文档,
在
NumPy
中,转置是内存高效的常数时间操作,因为它们只是返回具有调整步幅的相同数据的新视图。TensorFlow
不支持步幅,因此 transpose 返回一个新的张量,其中的项目是 permuted 。
此外, TensorFlow
似乎不支持 Fortran(列主要)排序。 因此,我认为我们会自动获得 Contiguous (Row-Major) 排序张量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.