Creates an op that assigns the provided value to this variable and returns its value.
Creates an op that assigns the provided value to this variable and returns its value.
Value to assign the variable to.
Name for created op.
Variable value read op, after the assignment.
Creates an op that adds the provided value to the current value of the variable and returns its value.
Creates an op that adds the provided value to the current value of the variable and returns its value.
Value to add to the current variable value.
Name for created op.
Variable value read op, after the addition.
Creates an op that applies updates the provided sparse value updates to this variable and returns its value.
Creates an op that applies updates the provided sparse value updates to this variable and returns its value.
Indices corresponding to the values
used for the update.
Values to use for updating, corresponding to the provided indices
.
Name for created op.
Variable value read op, after the addition.
Creates an op that adds the provided sparse value to the current value of the variable and returns its value.
Creates an op that adds the provided sparse value to the current value of the variable and returns its value.
Indices corresponding to the values
being added.
Values to be added, corresponding to the provided indices
.
Name for created op.
Variable value read op, after the addition.
Creates an op that subtracts the provided sparse value from the current value of the variable and returns its value.
Creates an op that subtracts the provided sparse value from the current value of the variable and returns its value.
Indices corresponding to the values
being subtracted.
Values to be subtracted, corresponding to the provided indices
.
Name for created op.
Variable value read op, after the subtraction.
Creates an op that subtracts the provided value from the current value of the variable and returns its value.
Creates an op that subtracts the provided value from the current value of the variable and returns its value.
Value to subtract from the current variable value.
Name for created op.
Variable value read op, after the subtraction.
Returns the overall concatenated value as an Output.
Returns the overall concatenated value as an Output.
This is different from using the partitioned variable directly as an op output (through implicit conversion or
toOutput
) in that it creates a new set of ops that retain the control dependencies from its scope.
Concatenated op output.
IllegalArgumentException
If having more than one partition axes.
Data type of the variables.
Data type of the variables.
Creates an op that reads the value of this variable sparsely, using the provided indices
.
Creates an op that reads the value of this variable sparsely, using the provided indices
.
This method should be used when there are multiple reads, or when it is desirable to read the value only after some condition is true.
Indices to use for the sparse read.
Name for the created op.
Created op.
Graph where this variable is defined.
Graph where this variable is defined.
Value of the initialized variable.
Value of the initialized variable. You should use this instead of the variable itself to initialize another variable with a value that depends on the value of this variable.
Example:
// Initialize `v` with random values, and then use `initializedValue` to guarantee that `v` has been initialized // before its value is used to initialize `w`. The random tensor will only be sampled once. val v = tf.variable("v", FLOAT32, Shape(10, 40), tf.RandomTruncatedNormalInitializer()) val w = tf.variable("w", initializer = tf.ConstantInitializer(v.initializedValue * 2.0))
Op responsible for initializing this variable.
Op responsible for initializing this variable.
Op output that is true
when the variable has been initialized and false
otherwise.
Op output that is true
when the variable has been initialized and false
otherwise.
Returns an iterator for accessing the underlying partition variables.
Returns an iterator for accessing the underlying partition variables.
This iterator is necessary to control order of access when variables are not partitioned in a standard way along a single axis.
Returns the number of partitions of this partitioned variable.
Returns the number of partitions of this partitioned variable.
IllegalArgumentException
If having more than one partition axes.
Overall name of the variables.
Overall name of the variables.
Number of partitions for each axis/dimension.
Creates an op that reads the value of this variable.
Creates an op that reads the value of this variable.
This method should be used when there are multiple reads, or when it is desirable to read the value only after some condition is true.
The returned value may be different from that of value depending on the device being used, the control dependencies, etc.
Created op.
(Changed in version 2.9.0) The behavior of scanRight
has changed. The previous behavior can be reproduced with scanRight.reverse.
Overall shape of the variables.
Overall shape of the variables.
Converts this variable to an op output.
Converts this variable to an op output. This function simply returns an op corresponding to the variable value.
(Changed in version 2.9.0) transpose
throws an IllegalArgumentException
if collections are not uniformly sized.
Returns a cached op which reads the last value of this partitioned variable.
Returns a cached op which reads the last value of this partitioned variable.
You can not assign a new value to the returned tensor as it is not a reference to the variable.
The returned op output will not inherit the control dependencies from the scope where the value is used, which is equivalent behavior to that of getting the value of a variable.
NOTE: You usually do not need to call this method directly, as all ops that use variables do so by internally converting them to tensors.
Partitioned variable wrapper.
Variables passed via
wrappedVariables
must contain a non-null save slice information field. Concatenation and iteration is in lexicographic order according to thevariableOffset
property of the save slice information.Accessing this object as an Output returns the variable parts concatenated along the partition axis.
This wrapper also acts as an iterator that allows accessing the underlying variables. This iterator is necessary to control the order of access when variables are not partitioned in a standard way along a single axis.
IllegalArgumentException
If the provided variables sequence is empty, or if their shapes do not match withshape
, or if their data types do not matchdataType
., or if they havenull
-valued save slice information