Variables inside a graph are mutable if you fetch them
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- java
- Ambito
- machine-learning
Direzione di ricerca
Inizia con l’esempio mutableVariablesTest nell’issue e riproducilo sui backend CPU e GPU descritti lì. Traccia il modo in cui vengono gestiti i tensori Variable recuperati, quindi verifica che il recupero non modifichi inaspettatamente lo stato del grafo e che il comportamento sia coerente tra i backend.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
System information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): macOS, Oracle Linux 7.
- TensorFlow installed from (source or binary): binary
- TensorFlow version (use command below): v0.3.1
Describe the current behavior
This test fails as initial = 3.0f and after = 9.0f.
public void mutableVariablesTest() {
try (Graph g = new Graph();
Session s = new Session(g);
TFloat32 inputTensor = TFloat32.vectorOf(1.0f,1.0f,1.0f)) {
Ops tf = Ops.create(g);
Placeholder<TFloat32> input =
tf.withName("input").placeholder(TFloat32.class, Placeholder.shape(Shape.of(3)));
Variable<TFloat32> a = tf.variable(tf.constant(new float[]{1.0f,1.0f,1.0f}));
ReduceSum<TFloat32> output = tf.withName("output").reduceSum(tf.math.mul(a,input),tf.constant(0));
Init init = tf.init();
s.run(init);
Tensor t = s.runner().feed(input,inputTensor).fetch(output).run().get(0);
float initial = ((TFloat32)t).getFloat();
t.close();
TFloat32 aTensor = (TFloat32) s.runner().fetch(a).run().get(0);
aTensor.setFloat(3.0f,0);
aTensor.setFloat(3.0f,1);
aTensor.setFloat(3.0f,2);
aTensor.close();
t = s.runner().feed(input,inputTensor).fetch(output).run().get(0);
float after = ((TFloat32)t).getFloat();
t.close();
assertEquals(initial,after);
}
}
It fails when running on CPU on macOS and Linux. I checked on Linux on a GPU and the test passes.
Describe the expected behavior
The test should pass consistently across all backends, as I would expect to get a copy of the weights back rather than something that lets me directly mutate the state of the graph in all cases rather than just on GPU. At the very least it should fail consistently on both CPU and GPU, but I think we should disallow direct mutation of variables outside of a graph.
- Lingua principale
- Java
- Stelle
- 928
- Fork
- 227
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di tensorflow/java
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
tensorflow/java#653 · 1 commento · 4 reazioni ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
tensorflow/java#621 · 4 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
tensorflow/java#617 · 3 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 55/100
tensorflow/java#615 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
tensorflow/java#614 · 1 commento ·
Tutte le issue di tensorflow/java
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
checkstyle/test-configs#263 ·
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
apache/cloudstack#14222 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Cannot differ own consent and managed consents in My Consents view and detailed consent view. Aperta1.0.0-alpha2 Type/Improvement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
wso2/dpdp-accelerator#272 ·