tensorflow / tensorflow/java

Still able to access raw tensor data after close() is called

Abierto
#460 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
Java
Estrellas
928
Forks
227
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza rastreando los puntos de entrada Tensor.close() y Tensor.asRawTensor().data() involucrados en la reproducción proporcionada, incluido el ciclo de vida de ConcreteFunction.close(). Confirma que acceder a los datos sin procesar después de output.close() produce la IllegalStateException esperada, y añade o actualiza la cobertura para este comportamiento si se encuentran las pruebas relevantes.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
machine-learning
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.