Unexpected problem in creating a tensor on saved model session.
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Java
- Sterne
- 928
- Forks
- 227
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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;

Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere den Fehler mit SavedModelBundle, Graph, Ops und tf.constant aus dem Issue und untersuche anschließend core/op/Constant.java um Zeile 413 herum. Vergleiche die Graph-Knoten aus MetaGraphDef mit dem von Ops verwendeten Graph. Fertig ist die Aufgabe, wenn der bereitgestellte labels-Tensor aus dem gespeicherten Modell-Graph ohne einen Duplicate-Node-Fehler erstellt werden kann.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- machine-learning
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100