Warning: This API is deprecated and will be removed in a future
version of TensorFlow after
the replacement is stable.
TensorArrayGrad
Stay organized with collections
Save and categorize content based on your preferences.
Creates a TensorArray for storing the gradients of values in the given handle.
If the given TensorArray gradient already exists, returns a reference to it.
Locks the size of the original TensorArray by disabling its dynamic size flag.
**A note about the input flow_in:**
The handle flow_in forces the execution of the gradient lookup to occur
only after certain other operations have occurred. For example, when
the forward TensorArray is dynamically sized, writes to this TensorArray
may resize the object. The gradient TensorArray is statically sized based
on the size of the forward TensorArray when this operation executes.
Furthermore, the size of the forward TensorArray is frozen by this call.
As a result, the flow is used to ensure that the call to generate the gradient
TensorArray only happens after all writes are executed.
In the case of dynamically sized TensorArrays, gradient computation should
only be performed on read operations that have themselves been chained via
flow to occur only after all writes have executed. That way the final size
of the forward TensorArray is known when this operation is called.
**A note about the source attribute:**
TensorArray gradient calls use an accumulator TensorArray object. If
multiple gradients are calculated and run in the same session, the multiple
gradient nodes may accidentally flow through the same accumulator TensorArray.
This double counts and generally breaks the TensorArray gradient flow.
The solution is to identify which gradient call this particular
TensorArray gradient is being called in. This is performed by identifying
a unique string (e.g. "gradients", "gradients_1", ...) from the input
gradient Tensor's name. This string is used as a suffix when creating
the TensorArray gradient object here (the attribute `source`).
The attribute `source` is added as a suffix to the forward TensorArray's
name when performing the creation / lookup, so that each separate gradient
calculation gets its own TensorArray accumulator.
Inherited Methods
From class
java.lang.Object
boolean
|
equals(Object arg0)
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
Public Methods
public
static
TensorArrayGrad
create
(Scope scope, Operand<?> handle, Operand<Float> flowIn, String source)
Factory method to create a class wrapping a new TensorArrayGrad operation.
Parameters
scope |
current scope |
handle |
The handle to the forward TensorArray. |
flowIn |
A float scalar that enforces proper chaining of operations. |
source |
The gradient source string, used to decide which gradient TensorArray
to return. |
Returns
- a new instance of TensorArrayGrad
public
Output<Float>
flowOut
()
public
Output<?>
gradHandle
()
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-02-12 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-02-12 UTC."],[],[],null,["# TensorArrayGrad\n\npublic final class **TensorArrayGrad** \nCreates a TensorArray for storing the gradients of values in the given handle.\n\n\nIf the given TensorArray gradient already exists, returns a reference to it.\n\n\nLocks the size of the original TensorArray by disabling its dynamic size flag.\n\n\n\\*\\*A note about the input flow_in:\\*\\*\n\n\nThe handle flow_in forces the execution of the gradient lookup to occur\nonly after certain other operations have occurred. For example, when\nthe forward TensorArray is dynamically sized, writes to this TensorArray\nmay resize the object. The gradient TensorArray is statically sized based\non the size of the forward TensorArray when this operation executes.\nFurthermore, the size of the forward TensorArray is frozen by this call.\nAs a result, the flow is used to ensure that the call to generate the gradient\nTensorArray only happens after all writes are executed.\n\n\nIn the case of dynamically sized TensorArrays, gradient computation should\nonly be performed on read operations that have themselves been chained via\nflow to occur only after all writes have executed. That way the final size\nof the forward TensorArray is known when this operation is called.\n\n\n\\*\\*A note about the source attribute:\\*\\*\n\n\nTensorArray gradient calls use an accumulator TensorArray object. If\nmultiple gradients are calculated and run in the same session, the multiple\ngradient nodes may accidentally flow through the same accumulator TensorArray.\nThis double counts and generally breaks the TensorArray gradient flow.\n\n\nThe solution is to identify which gradient call this particular\nTensorArray gradient is being called in. This is performed by identifying\na unique string (e.g. \"gradients\", \"gradients_1\", ...) from the input\ngradient Tensor's name. This string is used as a suffix when creating\nthe TensorArray gradient object here (the attribute \\`source\\`).\n\n\nThe attribute \\`source\\` is added as a suffix to the forward TensorArray's\nname when performing the creation / lookup, so that each separate gradient\ncalculation gets its own TensorArray accumulator.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### Public Methods\n\n|---------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [TensorArrayGrad](/api_docs/java/org/tensorflow/op/core/TensorArrayGrad) | [create](/api_docs/java/org/tensorflow/op/core/TensorArrayGrad#create(org.tensorflow.op.Scope,%20org.tensorflow.Operand\u003c?\u003e,%20org.tensorflow.Operand\u003cjava.lang.Float\u003e,%20java.lang.String))([Scope](/api_docs/java/org/tensorflow/op/Scope) scope, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003c?\\\u003e handle, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003cFloat\\\u003e flowIn, String source) Factory method to create a class wrapping a new TensorArrayGrad operation. |\n| [Output](/api_docs/java/org/tensorflow/Output)\\\u003cFloat\\\u003e | [flowOut](/api_docs/java/org/tensorflow/op/core/TensorArrayGrad#flowOut())() |\n| [Output](/api_docs/java/org/tensorflow/Output)\\\u003c?\\\u003e | [gradHandle](/api_docs/java/org/tensorflow/op/core/TensorArrayGrad#gradHandle())() |\n\n### Inherited Methods\n\nFrom class [org.tensorflow.op.PrimitiveOp](/api_docs/java/org/tensorflow/op/PrimitiveOp) \n\n|------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|\n| final boolean | [equals](/api_docs/java/org/tensorflow/op/PrimitiveOp#equals(java.lang.Object))(Object obj) |\n| final int | [hashCode](/api_docs/java/org/tensorflow/op/PrimitiveOp#hashCode())() |\n| [Operation](/api_docs/java/org/tensorflow/Operation) | [op](/api_docs/java/org/tensorflow/op/PrimitiveOp#op())() Returns the underlying [Operation](/api_docs/java/org/tensorflow/Operation) |\n| final String | [toString](/api_docs/java/org/tensorflow/op/PrimitiveOp#toString())() |\n\nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| boolean | equals(Object arg0) |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Methods\n--------------\n\n#### public static [TensorArrayGrad](/api_docs/java/org/tensorflow/op/core/TensorArrayGrad)\n**create**\n([Scope](/api_docs/java/org/tensorflow/op/Scope) scope, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003c?\\\u003e handle, [Operand](/api_docs/java/org/tensorflow/Operand)\\\u003cFloat\\\u003e flowIn, String source)\n\nFactory method to create a class wrapping a new TensorArrayGrad operation. \n\n##### Parameters\n\n| scope | current scope |\n| handle | The handle to the forward TensorArray. |\n| flowIn | A float scalar that enforces proper chaining of operations. |\n| source | The gradient source string, used to decide which gradient TensorArray to return. |\n|--------|----------------------------------------------------------------------------------|\n\n##### Returns\n\n- a new instance of TensorArrayGrad \n\n#### public [Output](/api_docs/java/org/tensorflow/Output)\\\u003cFloat\\\u003e\n**flowOut**\n()\n\n\u003cbr /\u003e\n\n#### public [Output](/api_docs/java/org/tensorflow/Output)\\\u003c?\\\u003e\n**gradHandle**\n()\n\n\u003cbr /\u003e"]]