且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在TensorFlow中更改变量的形状?

更新时间:2023-12-02 11:23:16

看看形状和形状" .它描述了可用的不同形状转换.

Take a look at shapes-and-shaping from TensorFlow documentation. It describes different shape transformations available.

最常见的功能可能是 tf.reshape ,类似于它的numpy等价物.只要元素数量保持不变,它就可以指定所需的任何形状.文档中有一些示例.

The most common function is probably tf.reshape, which is similar to its numpy equivalent. It allows you to specify any shape that you want as long as the number of elements stays the same. There are some examples available in the documentation.