ml-agents icon indicating copy to clipboard operation
ml-agents copied to clipboard

Argmax not recognized?

Open lagidigu opened this issue 8 years ago • 10 comments

Hi!

There seems to be an issue when importing a graph with graph.import(Graphmodel.bytes), as I get this error:

TFException: NodeDef mentions attr 'output_type' not in Op<name=ArgMax; signature=input:T, dimension:Tidx -> output:int64; attr=T:type,allowed=[DT_FLOAT, DT_DOUBLE, DT_INT64, DT_INT32, DT_UINT8, DT_UINT16, DT_INT16, DT_INT8, DT_COMPLEX64, DT_COMPLEX128, DT_QINT8, DT_QUINT8, DT_QINT32, DT_HALF]; attr=Tidx:type,default=DT_INT32,allowed=[DT_INT32, DT_INT64]>; NodeDef: ArgMax_1 = ArgMax[T=DT_FLOAT, Tidx=DT_INT32, output_type=DT_INT64](Softmax, ArgMax_1/dimension). (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.). TensorFlow.TFStatus.CheckMaybeRaise (TensorFlow.TFStatus incomingStatus, System.Boolean last) (at <6ed6db22f8874deba74ffe3e566039be>:0) TensorFlow.TFGraph.Import (TensorFlow.TFBuffer graphDef, TensorFlow.TFImportGraphDefOptions options, TensorFlow.TFStatus status) (at <6ed6db22f8874deba74ffe3e566039be>:0) TensorFlow.TFGraph.Import (System.Byte[] buffer, TensorFlow.TFImportGraphDefOptions options, TensorFlow.TFStatus status) (at <6ed6db22f8874deba74ffe3e566039be>:0) TensorFlow.TFGraph.Import (System.Byte[] buffer, System.String prefix, TensorFlow.TFStatus status) (at <6ed6db22f8874deba74ffe3e566039be>:0)

Is argmax, or even softmax supported, or am I doing something wrong?

Cheers

lagidigu avatar Jan 19 '18 08:01 lagidigu

Hi ! A few questions : Did you import a graph made with the ppo.py script ? Are you sure you have the latest TensorflowSharp Plugin in your Unity Project? It could be due to the version of Tensorflow you are using to generate the graph, what version do you use ?

vincentpierre avatar Jan 19 '18 21:01 vincentpierre

Didn't use the ppo.py script to import a graph.

As far as the TensorflowSharp Plugin, I used the one that is currently linked in the "Using TensorflowSharp with Unity Doc".

I am currently on Version 1.3.0 of Tensorflow.

lagidigu avatar Jan 22 '18 08:01 lagidigu

Hello !

Any news regarding this issue ? I ran into the exact same issue as lagidigu using the ppo.py script and the TensorflowSharp Plugin given in the Unity doc.

Cheers

vincentlorant avatar Jan 30 '18 08:01 vincentlorant

Just to make sure, do you have the latest TensorFlow version? Haven't gotten around to it, as the computer that I am using it on cannot update it yet...

lagidigu avatar Jan 30 '18 08:01 lagidigu

My bad, I checked and reinstalled the requirements and it's working fine now (Just had to reinstall tensorflow v1.0).

vincentlorant avatar Jan 30 '18 10:01 vincentlorant

Tried it with TF 1.4.1, still having the same error.

I saved my CNN as follows:

tf.train.write_graph(session.graph_def, ".", "MeditationShallowConvNet.pb")
    freeze_graph.freeze_graph(input_graph = "MeditationShallowConvNet.pb",
                              input_binary = False,
                              input_checkpoint = "tmp/shallow_convnet_meditation_weights.ckpt",
                              output_node_names = "action",
                              output_graph = "frozen_shallow_convnet_meditation.bytes",
                              clear_devices = True,
                              initializer_nodes = "",
                              input_saver = "",
                              filename_tensor_name = "save/Const:0",
                              restore_op_name = "save/restore_all")

With "Action" being as follows:

y_pred_cls = tf.argmax(y_pred, axis=1)

output = tf.identity(y_pred_cls, name = "action")

Does anyone have a pointer as to why this doesn't work?

Thanks a lot in advance...

Cheers

lagidigu avatar Jan 30 '18 13:01 lagidigu

If it comes from packages installation, try to install Tensorflow 1.0 this way ? and also check if you meet all requirements of the link I posted above (using pip list).

And you might give ppo.py a try to to see if the error comes from your imported graph.

Hope it helps

vincentlorant avatar Jan 30 '18 13:01 vincentlorant

Works with 1.0! Thanks!

lagidigu avatar Feb 03 '18 01:02 lagidigu

Thanks for reaching out to us. Hopefully you were able to resolve your issue. We are closing this due to inactivity.

shihzy avatar Mar 28 '18 21:03 shihzy

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 03 '20 15:01 lock[bot]