tensorflow::ops::ScatterNdUpdate

#include <state_ops.h>

Applica updates sparsi a singoli valori o sezioni all'interno di un dato insieme.

Riepilogo

variabile secondo indices .

ref è un Tensor di rango P e indices è un Tensor di rango Q

indices devono essere un tensore intero, contenente gli indici in ref . Deve avere forma \([d_0, ..., d_{Q-2}, K]\) dove 0 < K <= P .

La dimensione più interna degli indices (di lunghezza K ) corrisponde agli indici degli elementi (se K = P ) o delle sezioni (se K < P ) lungo la K -esima dimensione del ref .

updates è Tensor di rango Q-1+PK con forma:

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

Ad esempio, supponiamo di voler aggiornare un tensore di rango 1 con 4 elementi sparsi, portandolo a 8 elementi. In Python, l'aggiornamento sarebbe simile a questo:

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

L'aggiornamento risultante al riferimento sarebbe simile a questo:

[1, 11, 3, 10, 9, 6, 7, 12]

Per ulteriori dettagli su come aggiornare le slice, consultare tf.scatter_nd .

Vedi anche tf.scatter_update e tf.batch_scatter_update .

Argomentazioni:

  • ambito: un oggetto Scope
  • Riferimento: un tensore mutabile. Dovrebbe provenire da un nodo Variabile .
  • indici: Un tensore . Deve essere di uno dei seguenti tipi: int32, int64. Un tensore di indici in ref.
  • aggiornamenti: Un tensore . Deve avere lo stesso tipo di ref. Un tensore di valori aggiornati da aggiungere a ref.

Attributi opzionali (vedere Attrs ):

  • use_locking: Un valore booleano opzionale. Il valore predefinito è True. Se True, l'assegnazione sarà protetta da un blocco; altrimenti il ​​comportamento non è definito, ma potrebbe presentare una minore contesa.

Resi:

  • Output : Uguale a ref. Restituito per comodità per le operazioni che desiderano utilizzare i valori aggiornati dopo che l'aggiornamento è stato completato.

Costruttori e distruttori

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

attributi pubblici

operation
output_ref

Funzioni pubbliche

node () const
::tensorflow::Node *
operator::tensorflow::Input () const
operator::tensorflow::Output () const

Funzioni statiche pubbliche

UseLocking (bool x)

Strutture

tensorflow::ops::ScatterNdUpdate::Attrs

Impostatori di attributi opzionali per ScatterNdUpdate .

attributi pubblici

operazione

Operation operation

output_ref

::tensorflow::Output output_ref

Funzioni pubbliche

ScatterNdUpdate

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

ScatterNdUpdate

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

nodo

::tensorflow::Node * node() const 

operatore::tensorflow::Input

 operator::tensorflow::Input() const 

operatore::tensoreflusso::output

 operator::tensorflow::Output() const 

Funzioni statiche pubbliche

UseLocking

Attrs UseLocking(
  bool x
)