Unexpected problem in creating a tensor on saved model session.
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- java
研究方向
使用 issue 中的 SavedModelBundle、Graph、Ops 和 tf.constant 重現該失敗,然後檢查第 413 行附近的 core/op/Constant.java,並將 MetaGraphDef 中的圖節點與 Ops 使用的圖進行比較。當可以從已儲存模型的圖建立所提供的 labels 張量,且不會出現重複節點錯誤時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
System information
- OS Platform and Distribution: Linux Ubuntu 20.04 x64
- TensorFlow installed from: pip for Python 3.9; Maven for Java
- TensorFlow version : 2.7.0 on Python; 0.3.3 on Java
- Java version : openjdk 11.0.11 2021-04-20
- Python version : 3.9
- CUDA/cuDNN version: cuda_11.5.r11.5/compiler.30411180_0
- GPU model and memory: Nvidia Geforce 960m
Describe the current behavior
The model (a Keras Sequential) is saved using python's "tf.saved_model.save". This model is then loaded in Java using SavedModelBundle from which the related graph is extracted. Then and Ops is created using this graph. When trying to create a tensor using .constant method, an exception is thrown on line 413, /core/op/Constant.java saying
Duplicate node name in graph: 'Const'
I checked my graph nodes using getNodeList of MetaGraph and there is only one node named "Const".
Describe the expected behavior
Successful creation of Tensor as there is no duplicate in the graph nodes.
Code to reproduce the issue
SavedModelBundle model = SavedModelBundle.load("/path/to/model");
Graph graph = model.graph();
MetaGraphDef mataGF = model.metaGraphDef();
var nodes = mataGF.getGraphDef().getNodeList().toArray();
Ops tf = Ops.create(graph);
double[] labels = {0.52,0.65,0.23,0.54,0.65,0.16,0.97};
var input = tf.constant(labels);
Other info / logs
Here is a list of all the 37 nodes. Only node 31 is called Const;

- 主要語言
- 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
-
area-deployment area-integrations triage:bot-seen
難度 2/5 半天 新手友好度 86/100
-
難度 2/5 1-3 小時 新手友好度 75/100
apache/flink-agents#1156 ·
-
area/connectors autoteam community connectors/source/shopify needs-triage team/use type/bug
難度 2/5 1-3 小時 新手友好度 84/100
-
難度 2/5 1-3 小時 新手友好度 70/100
-
難度 1/5 1 小時以內 新手友好度 85/100