tensorflow :: ops :: ResourceScatterNdSub
#include <state_ops.h>
Applica una sottrazione sparsa a singoli valori o sezioni in una variabile .
Sommario
ref
è un Tensor
di rango P
e gli indices
è un Tensor
di rango Q
indices
devono essere un tensore intero, contenente gli indici in ref
. Deve essere di forma [d_0, ..., d_{Q-2}, K]
dove 0 < K <= P
La dimensione più interna degli indices
(di lunghezza K
) corrisponde agli indici in elementi (se K = P
) o fette (se K < P
) lungo la K
esima dimensione di 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 sottrarre 4 elementi dispersi da un tensore di rango 1 con 8 elementi. In Python, quella sottrazione sarebbe simile a questa:
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]) sub = tf.scatter_nd_sub(ref, indices, updates) with tf.Session() as sess: print sess.run(sub)
L'aggiornamento risultante a ref sarebbe simile a questo:
[1, -9, 3, -6, -4, 6, 7, -4]
Vedi tf.scatter_nd
per maggiori dettagli su come apportare aggiornamenti alle sezioni.
Argomenti:
- scope: un oggetto Scope
- ref: un handle di risorsa. Deve provenire da un VarHandleOp.
- indici: un tensore . Deve essere uno dei seguenti tipi: int32, int64. Un tensore di indici in rif.
- aggiornamenti: A Tensor . Deve avere lo stesso tipo del rif. Un tensore di valori da aggiungere a ref.
Attributi opzionali (vedi Attrs
):
- use_locking: un bool opzionale. Il valore predefinito è True. Se True, l'assegnazione sarà protetta da un lucchetto; in caso contrario, il comportamento è indefinito, ma potrebbe presentare meno contese.
Ritorna:
- l'
Operation
creata
Costruttori e distruttori | |
---|---|
ResourceScatterNdSub (const :: tensorflow::Scope & scope, :: tensorflow::Input ref, :: tensorflow::Input indices, :: tensorflow::Input updates) | |
ResourceScatterNdSub (const :: tensorflow::Scope & scope, :: tensorflow::Input ref, :: tensorflow::Input indices, :: tensorflow::Input updates, const ResourceScatterNdSub::Attrs & attrs) |
Attributi pubblici | |
---|---|
operation |
Funzioni pubbliche | |
---|---|
operator::tensorflow::Operation () const |
Funzioni statiche pubbliche | |
---|---|
UseLocking (bool x) |
Structs | |
---|---|
tensorflow :: ops :: ResourceScatterNdSub :: Attrs | Setter attributi facoltativi per ResourceScatterNdSub . |
Attributi pubblici
operazione
Operation operation
Funzioni pubbliche
ResourceScatterNdSub
ResourceScatterNdSub( const ::tensorflow::Scope & scope, ::tensorflow::Input ref, ::tensorflow::Input indices, ::tensorflow::Input updates )
ResourceScatterNdSub
ResourceScatterNdSub( const ::tensorflow::Scope & scope, ::tensorflow::Input ref, ::tensorflow::Input indices, ::tensorflow::Input updates, const ResourceScatterNdSub::Attrs & attrs )
operator :: tensorflow :: Operation
operator::tensorflow::Operation() const
Funzioni statiche pubbliche
UseLocking
Attrs UseLocking( bool x )