Closed MLnick closed 7 years ago
Thanks for finding this out! I just got back from traveling. I'll look into this today and let you know what I find. :)
@MLnick It turns out there were a couple problems. One related to string tensors and one related to empty savers. If you use savers it would be great if you couple add a few simple unit tests based on your usage if you get the chance. In either case, thanks a lot for reporting this. :)
@eaplatanios another issue seems to have cropped up:
Exception in thread "main" java.lang.IllegalArgumentException: Input tensor_names and shape_and_slices should be an 1-D tensors, got [1,1] and [1,1] instead.
[[Node: Saver/Save = SaveV2[_class=[], dtypes=[DT_DOUBLE], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_Saver/Constant_0_0, Saver/Constant_1, Saver/Constant_2, weights/weights/ReadVariable)]]
at org.platanios.tensorflow.jni.Session$.run(Native Method)
at org.platanios.tensorflow.api.core.client.Session.runHelper(Session.scala:127)
at org.platanios.tensorflow.api.core.client.Session.run(Session.scala:66)
at org.platanios.tensorflow.api.ops.variables.Saver.save(Saver.scala:176)
I haven't used to saver much and am not that familiar with even the Python / native version of it. I am trying to play around with it to see if I can export graphs from this lib and re-use them in say Python or TF serving, etc. And ran into the issue.
Will see if I can put together some test cases.
@MLnick This had to do with not managing string tensors very well, but I think it's been fixed in the last two commits.
Sorry to be the bearer of bad news, but still getting an error. Seems the shape of the relevant string tensors is still not correct (I have 2 variables that are getting saved hence the [1,2]
shapes, that should I think be 1-D tensors of length 2?)
Exception in thread "main" java.lang.IllegalArgumentException: Input tensor_names and shape_and_slices should be an 1-D tensors, got [1,2] and [1,2] instead.
[[Node: Saver/Save = SaveV2[_class=[], dtypes=[DT_DOUBLE, DT_DOUBLE], _device="/job:localhost/replica:0/task:0/cpu:0"](_arg_Saver/Constant_0_0, Saver/Constant_1, Saver/Constant_2, weights/weights/ReadVariable, intercept/intercept/ReadVariable)]]
at org.platanios.tensorflow.jni.Session$.run(Native Method)
at org.platanios.tensorflow.api.core.client.Session.runHelper(Session.scala:127)
at org.platanios.tensorflow.api.core.client.Session.run(Session.scala:66)
at org.platanios.tensorflow.api.ops.variables.Saver.save(Saver.scala:176)
at TensorFlowTest$.delayedEndpoint$TensorFlowTest$1(Test.scala:53)
at TensorFlowTest$delayedInit$body.apply(Test.scala:13)
at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.collection.immutable.List.foreach(List.scala:392)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
at scala.App$class.main(App.scala:76)
at TensorFlowTest$.main(Test.scala:13)
at TensorFlowTest.main(Test.scala)
@MLnick Thanks a lot for pointing out all these issues. They only serve to point out the usefulness of unit tests. I'll try to add unit tests for ops after I get support for some more ops.
I fixed this issue, but I'll leave it open until you confirm all seems to work fine for you. :) Feel free to close it when you feel the bug is fixed.
Thanks, that seems to have allowed me to save successfully. Now going to try loading a saved model and predicting with it :)
That's great! The restoring ops are sort of symmetric to the save ops and I changed them too in my last fix, so I hope this will work fine for you. :)
Came across this when trying to use
tf.Saver()
. Simple to reproduce using