tensorflow :: ops :: ResourceScatterNdAdd

#include <state_ops.h>

Menerapkan penambahan renggang ke nilai atau irisan individual dalam Variabel .

Ringkasan

ref adalah Tensor dengan peringkat P dan indices adalah Tensor peringkat Q

indices harus berupa tensor integer, yang berisi indeks menjadi ref . Harus berbentuk [d_0, ..., d_{Q-2}, K] mana 0 < K <= P

Dimensi paling dalam dari indices (dengan panjang K ) sesuai dengan indeks menjadi elemen (jika K = P ) atau irisan (jika K < P ) sepanjang dimensi K dari ref .

updates Tensor rank Q-1+PK dengan bentuk:

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

Misalnya, kita ingin menambahkan 4 elemen tersebar ke tensor peringkat-1 hingga 8 elemen. Di Python, penambahan itu akan terlihat seperti ini:

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)

Pembaruan yang dihasilkan untuk ref akan terlihat seperti ini:

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

Lihat tf.scatter_nd untuk detail selengkapnya tentang cara memperbarui slice.

Argumen:

  • scope: Objek Scope
  • ref: Sebuah pegangan sumber daya. Harus dari VarHandleOp.
  • indeks: A Tensor . Harus salah satu dari jenis berikut: int32, int64. Tensor indeks menjadi ref.
  • update: Tensor . Harus memiliki tipe yang sama dengan ref. Tensor nilai yang akan ditambahkan ke ref.

Atribut opsional (lihat Attrs ):

  • use_locking: Bool opsional. Default-nya adalah True. Jika Benar, tugas akan dilindungi oleh kunci; jika tidak, perilakunya tidak ditentukan, tetapi mungkin menunjukkan lebih sedikit perselisihan.

Pengembalian:

Pembuat dan Penghancur

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)

Atribut publik

operation

Fungsi publik

operator::tensorflow::Operation () const

Fungsi statis publik

UseLocking (bool x)

Structs

tensorflow :: ops :: ResourceScatterNdAdd :: Attrs

Penyetel atribut opsional untuk ResourceScatterNdAdd .

Atribut publik

operasi

Operation operation

Fungsi publik

ResourceScatterNdAdd

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

ResourceScatterNdAdd

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

operator :: tensorflow :: Operasi

 operator::tensorflow::Operation() const 

Fungsi statis publik

UseLocking

Attrs UseLocking(
  bool x
)