TensorFlow学习笔记1.8:tf.assign()

assign: 赋值

Update 'ref' by assigning 'value' to it.
通过给它赋值来更新“ref”。
This operation outputs a Tensor that holds the new value of 'ref' after the value has been assigned.
这个操作输出一个张量,这个张量在赋值之后获取“ref”的新值。
This makes it easier to chain operations that need to use the reset value.
这使得需要使用重置值的链式操作更加容易。

tf.assign(
    ref,    value,    validate_shape=None,    use_locking=None,    name=None
)
  • ref:
    A mutable Tensor. 一个可变的张量
    Should be from a Variable node. 应该来自一个变量节点
    May be uninitialized. 可能是未初始化的

  • value:
    A Tensor.
    Must have the same type as ref. 必须具有与ref相同的类型。
    The value to be assigned to the variable. 分配给该变量的值。

  • validate_shape:
    An optional bool. 一个可选的布尔值。
    Defaults to True.默认值为True。
    If true, the operation will validate that the shape of 'value' matches the shape of the Tensor being assigned to.
    If false, 'ref' will take on the shape of 'value'.

  • use_locking:
    An optional bool.一个可选的布尔值。
    Defaults to True. 默认值为True。
    If True, the assignment will be protected by a lock; otherwise the behavior is undefined, but may exhibit less contention.

  • name:
    A name for the operation (optional). 操作的名称(可选)

你可能感兴趣的:(TensorFlow学习笔记1.8:tf.assign())