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

オープン
#460 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
java

調査の方向性

まず、提供された再現手順に関係するエントリポイント Tensor.close() と Tensor.asRawTensor().data() を、ConcreteFunction.close() のライフサイクルを含めて追跡します。output.close() 後に raw data にアクセスすると想定どおり IllegalStateException が発生することを確認し、関連するテストが見つかった場合は、この動作のカバレッジを追加または更新します。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Java
スター
928
フォーク
227
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

tensorflow/java のほかの issue

tensorflow/java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。