Still able to access raw tensor data after close() is called
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 928
- Fork
- 227
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
System information
- Have I written custom code: see simple test case below to reproduce
- OS Platform and Distribution: Windows 10, 64-bit operating system, x64-based processor
- TensorFlow installed from (source or binary): binary via Maven
- TensorFlow version: v0.4.1
- Java version (i.e., the output of
java -version): AdoptOpenJDK-11.0.11+9 - Java command line flags (e.g., GC parameters): N/A
- CUDA/cuDNN version: N/A - using pure CPU version
- GPU model and memory: N/A - using pure CPU version
Describe the current behavior
After closing a tensor output from a concrete function (and the concrete function itself), am still able to access the tensor's raw data.
Describe the expected behavior
Expect an IllegalStateException when accessing the raw tensor data because close() was already called on the tensor.
Code to reproduce the issue
// Create simple (a + b) function
ConcreteFunction addTwoInts = ConcreteFunction.create((tf) -> {
Placeholder<TInt32> inputA = tf.placeholder(TInt32.class);
Placeholder<TInt32> inputB = tf.placeholder(TInt32.class);
Add<TInt32> output = tf.math.add(inputA, inputB);
return Signature.builder().key("add")
.input("a", inputA)
.input("b", inputB)
.output("out", output)
.build();
});
// Apply to input
Map<String, Tensor> input = Map.of(
"a", TInt32.scalarOf(1),
"b", TInt32.scalarOf(2));
Tensor output = addTwoInts.call(input).get("out");
// Close everything
addTwoInts.close();
output.close();
// Expect java.lang.IllegalStateException: close() was called on the Tensor
output.asRawTensor().data(); // However, no exception is thrown here
Have recently upgraded from v0.2.0, where the same test case setup would throw the excepted exception.
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.
Direzione di ricerca
Inizia tracciando i punti di ingresso Tensor.close() e Tensor.asRawTensor().data() coinvolti nella riproduzione fornita, incluso il ciclo di vita di ConcreteFunction.close(). Conferma che l’accesso ai dati grezzi dopo output.close() produca l’IllegalStateException prevista e aggiungi o aggiorna la copertura per questo comportamento se vengono trovati i test pertinenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- machine-learning
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 45/100