tensoreflusso:: ops:: Punto dinamico parallelo
#include <data_flow_ops.h>
Interlaccia i valori dai tensori data
in un singolo tensore.
Riepilogo
Costruisce un tensore unito in questo modo
merged[indices[m][i, ..., j], ...] = data[m][i, ..., j, ...]
Ad esempio, se ogni indices[m]
è scalare o vettoriale, abbiamo
# Scalar indices:
merged[indices[m], ...] = data[m][...]
# Vector indices:
merged[indices[m][i], ...] = data[m][i, ...]
Ogni data[i].shape
deve iniziare con gli indices[i].shape
corrispondenti e il resto di data[i].shape
deve essere costante rispetto a i
. Cioè, dobbiamo avere data[i].shape = indices[i].shape + constant
. In termini di questa constant
, la forma dell'output è
merged.shape = [max(indices)] + constant
I valori possono essere uniti in parallelo, quindi se un indice appare sia in indices[m][i]
che indices[n][j]
, il risultato potrebbe non essere valido. Ciò differisce dal normale operatore DynamicStitch che definisce il comportamento in quel caso.
Per esempio:
indices[0] = 6
indices[1] = [4, 1]
indices[2] = [[5, 2], [0, 3]]
data[0] = [61, 62]
data[1] = [[41, 42], [11, 12]]
data[2] = [[[51, 52], [21, 22]], [[1, 2], [31, 32]]]
merged = [[1, 2], [11, 12], [21, 22], [31, 32], [41, 42],
[51, 52], [61, 62]]
Questo metodo può essere utilizzato per unire le partizioni create da dynamic_partition
come illustrato nell'esempio seguente:
# Apply function (increments x_i) on elements for which a certain condition
# apply (x_i != -1 in this example).
x=tf.constant([0.1, -1., 5.2, 4.3, -1., 7.4])
condition_mask=tf.not_equal(x,tf.constant(-1.))
partitioned_data = tf.dynamic_partition(
x, tf.cast(condition_mask, tf.int32) , 2)
partitioned_data[1] = partitioned_data[1] + 1.0
condition_indices = tf.dynamic_partition(
tf.range(tf.shape(x)[0]), tf.cast(condition_mask, tf.int32) , 2)
x = tf.dynamic_stitch(condition_indices, partitioned_data)
# Here x=[1.1, -1., 6.2, 5.3, -1, 8.4], the -1. values remain
# unchanged.

Argomenti:
- scope: un oggetto Scope
Resi:
-
Output
: il tensore unito.
Costruttori e distruttori | |
---|---|
ParallelDynamicStitch (const :: tensorflow::Scope & scope, :: tensorflow::InputList indices, :: tensorflow::InputList data) |
Funzioni pubbliche | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
Attributi pubblici
fusi
::tensorflow::Output merged
operazione
Operation operation
Funzioni pubbliche
Punto dinamico parallelo
ParallelDynamicStitch(
const ::tensorflow::Scope & scope,
::tensorflow::InputList indices,
::tensorflow::InputList data
)
nodo
::tensorflow::Node * node() const
operatore::tensorflow::Input
operator::tensorflow::Input() const
operatore::tensorflow::Output
operator::tensorflow::Output() const