首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

tensorflow: tf.reshape探究

tf.reshape(tensor,shape,name=None)

  给定一个tensor,这个操作会返回一个有着跟原tensor一样的值且经过shape重塑过的张量。

  如果shape中存在值为-1的组成,被计算过的维度总和的大小将保持恒定。尤其是当一个为[-1]的shape被展平为一维,且shape最多只能存在一个-1。

  如果shape是一维或者是更高维度,那么这个操作将会返回一个形状为shape,填充满value值的张量。在这种情况下,shape的元素的数量必须与tensor的元素数量一样。

Args

Annotations

tensor

A Tensor.

shape

A Tensor. Must be one of the following types: int32, int64. Defines the shape of the output tensor.

name

A name for the operation (optional).

Returns:

  A Tensor. Has the same type as tensor.



下一篇
举报
领券