Still able to access raw tensor data after close() is called
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 928
- Fork
- 227
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách lần theo các điểm vào Tensor.close() và Tensor.asRawTensor().data() liên quan đến reproduction được cung cấp, bao gồm cả vòng đời của ConcreteFunction.close(). Xác nhận rằng việc truy cập dữ liệu thô sau output.close() tạo ra IllegalStateException như mong đợi, và thêm hoặc cập nhật coverage cho hành vi này nếu tìm thấy các test liên quan.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- machine-learning
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 45/100