텐서플로우:: ops:: ResourceScatterNdAdd

#include <state_ops.h>

변수 의 개별 값 또는 슬라이스에 희소 덧셈을 적용합니다.

요약

ref 는 랭크가 P 인 Tensor 이고 indices 랭크가 Q 인 Tensor 입니다.

indices ref 에 대한 인덱스를 포함하는 정수 텐서여야 합니다. 모양은 [d_0, ..., d_{Q-2}, K] 이어야 하며, 여기서 0 < K <= P .

indices 의 가장 안쪽 차원(길이 K )은 ref 의 K 번째 차원을 따라 요소( K = P 인 경우) 또는 슬라이스( K < P 인 경우)에 대한 인덱스에 해당합니다.

updates 는 Q-1+PK 랭크의 Tensor 이며 형태는 다음과 같습니다.

[d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]]

예를 들어, 4개의 분산된 요소를 랭크 1 텐서의 총 8개 요소에 더한다고 가정해 보겠습니다. 파이썬에서 이 덧셈 연산은 다음과 같습니다.

ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8], use_resource=True)
indices = tf.constant([[4], [3], [1], [7]])
updates = tf.constant([9, 10, 11, 12])
add = tf.scatter_nd_add(ref, indices, updates)
with tf.Session() as sess:
  print sess.run(add)

ref에 대한 업데이트 결과는 다음과 같습니다.

[1, 13, 3, 14, 14, 6, 7, 20]

슬라이스를 업데이트하는 방법에 대한 자세한 내용은 tf.scatter_nd 참조하세요.

논거:

  • 범위: Scope 객체
  • 참조: 리소스 핸들입니다. VarHandleOp에서 가져온 것이어야 합니다.
  • indices: 텐서입니다 . int32 또는 int64 유형 중 하나여야 합니다. ref에 대한 인덱스 텐서입니다.
  • 업데이트: 텐서입니다 . ref와 동일한 유형이어야 합니다. ref에 추가할 값들의 텐서입니다.

선택적 속성( Attrs 참조):

  • use_locking: 선택적 부울 값입니다. 기본값은 True입니다. True로 설정하면 할당 작업이 락으로 보호됩니다. 그렇지 않으면 동작은 정의되지 않지만, 경합이 줄어들 수 있습니다.

보고:

생성자와 소멸자

ResourceScatterNdAdd (const :: tensorflow::Scope & scope, :: tensorflow::Input ref, :: tensorflow::Input indices, :: tensorflow::Input updates)
ResourceScatterNdAdd (const :: tensorflow::Scope & scope, :: tensorflow::Input ref, :: tensorflow::Input indices, :: tensorflow::Input updates, const ResourceScatterNdAdd::Attrs & attrs)

공개 속성

operation

공공 기능

operator::tensorflow::Operation () const

공개 정적 함수

UseLocking (bool x)

구조

텐서플로우:: ops:: ResourceScatterNdAdd:: Attrs

ResourceScatterNdAdd 에 대한 선택적 속성 설정기입니다.

공개 속성

작업

Operation operation

공공 기능

리소스 스캐터NdAdd

 ResourceScatterNdAdd(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input ref,
  ::tensorflow::Input indices,
  ::tensorflow::Input updates
)

리소스 스캐터NdAdd

 ResourceScatterNdAdd(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input ref,
  ::tensorflow::Input indices,
  ::tensorflow::Input updates,
  const ResourceScatterNdAdd::Attrs & attrs
)

연산자::텐서플로우::작업

 operator::tensorflow::Operation() const 

공개 정적 함수

잠금 사용

Attrs UseLocking(
  bool x
)