W3cubDocs

/TensorFlow C++ 2.9

tensorflow::ops::Assign

#include <state_ops.h>

Update 'ref' by assigning 'value' to it.

Summary

This operation outputs "ref" after the assignment is done. This makes it easier to chain operations that need to use the reset value.

Args:

  • scope: A Scope object
  • ref: Should be from a Variable node. May be uninitialized.
  • value: The value to be assigned to the variable.

Optional attributes (see Attrs):

  • validate_shape: 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: If True, the assignment will be protected by a lock; otherwise the behavior is undefined, but may exhibit less contention.

Returns:

  • Output: = Same as "ref". Returned as a convenience for operations that want to use the new value after the variable has been reset.
Constructors and Destructors
Assign(const ::tensorflow::Scope & scope, ::tensorflow::Input ref, ::tensorflow::Input value)
Assign(const ::tensorflow::Scope & scope, ::tensorflow::Input ref, ::tensorflow::Input value, const Assign::Attrs & attrs)
Public attributes
operation
output_ref
Public functions
node() const
::tensorflow::Node *
operator::tensorflow::Input() const
operator::tensorflow::Output() const
Public static functions
UseLocking(bool x)
ValidateShape(bool x)
Structs
tensorflow::ops::Assign::Attrs

Optional attribute setters for Assign.

Public attributes

operation

Operation operation

output_ref

::tensorflow::Output output_ref

Public functions

Assign

 Assign(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input ref,
  ::tensorflow::Input value
)

Assign

 Assign(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input ref,
  ::tensorflow::Input value,
  const Assign::Attrs & attrs
)

node

::tensorflow::Node * node() const 

operator::tensorflow::Input

operator::tensorflow::Input() const 

operator::tensorflow::Output

operator::tensorflow::Output() const 

Public static functions

UseLocking

Attrs UseLocking(
  bool x
)

ValidateShape

Attrs ValidateShape(
  bool x
)

© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.9/api_docs/cc/class/tensorflow/ops/assign