Still able to access raw tensor data after close() is called
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- java
调研方向
首先追踪所提供复现中涉及的入口点 Tensor.close() 和 Tensor.asRawTensor().data(),包括 ConcreteFunction.close() 的生命周期。确认在 output.close() 后访问原始数据会产生预期的 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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
tensorflow/java 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
tensorflow/java#653 · 1 条评论 · 4 个 reaction ·
-
难度 5/5 一周以上 新手友好度 25/100
tensorflow/java#621 · 4 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
tensorflow/java#617 · 3 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 55/100
tensorflow/java#615 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
tensorflow/java#614 · 1 条评论 ·
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
elastic/gradle-plugins#157 ·
-
enhancement Tools
难度 1/5 1 小时以内 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 70/100
apache/rocketmq-dashboard#5008 ·
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
-
DETECT_PARAMETER_NAMES=false silently disables @ConstructorProperties-based Creator detection too 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
FasterXML/jackson-databind#6229 ·