컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
텐서플로우:: 작전:: TensorArrayGrad
#include <data_flow_ops.h>
지정된 핸들에 값의 기울기를 저장하기 위한 TensorArray를 만듭니다.
요약
주어진 TensorArray 그래디언트가 이미 존재하는 경우 이에 대한 참조를 반환합니다.
동적 크기 플래그를 비활성화하여 원래 TensorArray 의 크기를 잠급니다.
입력 flow_in에 대한 참고 사항:
flow_in 핸들은 특정 다른 작업이 발생한 후에만 그래디언트 조회가 실행되도록 강제합니다. 예를 들어, 전방 TensorArray의 크기가 동적으로 조정되면 이 TensorArray 에 쓰기를 하면 객체의 크기가 조정될 수 있습니다. 그래디언트 TensorArray는 이 작업이 실행될 때 전방 TensorArray 의 크기에 따라 정적으로 크기가 지정됩니다. 또한 이 호출로 인해 전방 TensorArray 의 크기가 고정됩니다. 결과적으로 흐름은 모든 쓰기가 실행된 후에만 그래디언트 TensorArray를 생성하는 호출이 발생하도록 보장하는 데 사용됩니다.
동적으로 크기가 조정된 TensorArray의 경우 그라데이션 계산은 모든 쓰기가 실행된 후에만 발생하도록 흐름을 통해 자체적으로 연결된 읽기 작업에서만 수행되어야 합니다. 이렇게 하면 이 작업이 호출될 때 정방향 TensorArray 의 최종 크기가 알려집니다.
소스 속성에 대한 참고 사항:
TensorArray 그래디언트 호출은 누산기 TensorArray 객체를 사용합니다. 여러 그래디언트가 동일한 세션에서 계산되고 실행되는 경우 여러 그래디언트 노드가 실수로 동일한 누산기 TensorArray를 통해 흐를 수 있습니다. 이는 TensorArray 그래디언트 흐름을 이중으로 계산하고 일반적으로 중단시킵니다.
해결책은 이 특정 TensorArray 그래디언트가 호출되는 그래디언트 호출을 식별하는 것입니다. 이는 입력 그래디언트 Tensor 의 이름에서 고유한 문자열(예: "gradients", "gradients_1", ...)을 식별하여 수행됩니다. 이 문자열은 여기서 TensorArray 그래디언트 객체(attribute source
)를 생성할 때 접미사로 사용됩니다.
속성 source
생성/조회를 수행할 때 정방향 TensorArray 의 이름에 접미사로 추가되므로 각 개별 그래디언트 계산은 자체 TensorArray 누산기를 얻습니다.
인수:
- 범위: 범위 개체
- 핸들: TensorArray 전달에 대한 핸들입니다.
- flow_in: 작업의 적절한 연결을 강제하는 부동 소수점 스칼라입니다.
- source: 반환할 그래디언트 TensorArray를 결정하는 데 사용되는 그래디언트 소스 문자열입니다.
보고:
공개 속성
공공 기능
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-25(UTC)
[null,null,["최종 업데이트: 2025-07-25(UTC)"],[],[],null,["# tensorflow::ops::TensorArrayGrad Class Reference\n\ntensorflow::ops::TensorArrayGrad\n================================\n\n`#include \u003cdata_flow_ops.h\u003e`\n\nCreates a [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) for storing the gradients of values in the given handle.\n\nSummary\n-------\n\nIf the given [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) gradient already exists, returns a reference to it.\n\nLocks the size of the original [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) by disabling its dynamic size flag.\n\n\n**A note about the input flow_in:**\n\nThe 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](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) is dynamically sized, writes to this [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) may resize the object. The gradient [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) is statically sized based on the size of the forward [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) when this operation executes. Furthermore, the size of the forward [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) is frozen by this call. As a result, the flow is used to ensure that the call to generate the gradient [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) only happens after all writes are executed.\n\nIn 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](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) is known when this operation is called.\n\n\n**A note about the source attribute:**\n\n[TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) gradient calls use an accumulator [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) object. If multiple gradients are calculated and run in the same session, the multiple gradient nodes may accidentally flow through the same accumulator [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array). This double counts and generally breaks the [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) gradient flow.\n\nThe solution is to identify which gradient call this particular [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) gradient is being called in. This is performed by identifying a unique string (e.g. \"gradients\", \"gradients_1\", ...) from the input gradient [Tensor](/versions/r2.1/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor)'s name. This string is used as a suffix when creating the [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) gradient object here (the attribute `source`).\n\nThe attribute `source` is added as a suffix to the forward [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array)'s name when performing the creation / lookup, so that each separate gradient calculation gets its own [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) accumulator.\n\nArguments:\n\n- scope: A [Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- handle: The handle to the forward [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array).\n- flow_in: A float scalar that enforces proper chaining of operations.\n- source: The gradient source string, used to decide which gradient [TensorArray](/versions/r2.1/api_docs/cc/class/tensorflow/ops/tensor-array#classtensorflow_1_1ops_1_1_tensor_array) to return.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) grad_handle\n- [Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) flow_out\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [TensorArrayGrad](#classtensorflow_1_1ops_1_1_tensor_array_grad_1a6240f50f9c7efdcf3bf8d48c4218d27b)`(const ::`[tensorflow::Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` handle, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` flow_in, StringPiece source)` ||\n\n| ### Public attributes ||\n|-------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [flow_out](#classtensorflow_1_1ops_1_1_tensor_array_grad_1a2499ef8bb9c633df24389a51f37654da) | `::`[tensorflow::Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [grad_handle](#classtensorflow_1_1ops_1_1_tensor_array_grad_1ab5be040d777eb52f767d58a83a3a345d) | `::`[tensorflow::Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [operation](#classtensorflow_1_1ops_1_1_tensor_array_grad_1ae7c0b0022fc4a44d321bf759c55413c2) | [Operation](/versions/r2.1/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n\nPublic attributes\n-----------------\n\n### flow_out\n\n```scdoc\n::tensorflow::Output flow_out\n``` \n\n### grad_handle\n\n```scdoc\n::tensorflow::Output grad_handle\n``` \n\n### operation\n\n```text\nOperation operation\n``` \n\nPublic functions\n----------------\n\n### TensorArrayGrad\n\n```gdscript\n TensorArrayGrad(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input handle,\n ::tensorflow::Input flow_in,\n StringPiece source\n)\n```"]]