You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the max-graph-api example in the mnist.mojo file the compiler warns about a missing operation for a Tensor.
specifically probs.argmax(axis=1) 'Tensor[float32]' value has no attribute 'argmax'. Later use of the predicted variable is then recognized as not possible.
There is an arg_max operation for Graphs, but I would like to follow the example and not add the argmax to the Graph itself.
The mojo changelog mentions for version 24.2 that
The Tensor type now has argmax() and argmin() functions to compute the position of the max or min value. Note: this should return a Tensor[Int] but currently the output tensor is the same type as the input tensor. This will be fixed in a future release.
Since these operations are no longer implemented for the Tensor type, what should an idiomatic mojo solution look like?
probs = output.get[DType.float32]("output0")
predicted = probs.argmax(axis=1) # this won't compile with max & mojo 24.6
label_ = Tensor[DType.index](TensorShape(1), int(label))
correct +=int(predicted == label_)
Anything else?
I'm using the currently latest release of max and mojo (24.6).
The text was updated successfully, but these errors were encountered:
It was removed in 24.6 in favour of better implementation later. Also discussed here. The Mojo API is unstable so please use the Python API. We'll update the examples later.
Where is the problem?
https://docs.modular.com/max/tutorials/get-started-with-max-graph
What can we do better?
In the max-graph-api example in the mnist.mojo file the compiler warns about a missing operation for a Tensor.
specifically probs.argmax(axis=1) 'Tensor[float32]' value has no attribute 'argmax'. Later use of the predicted variable is then recognized as not possible.
There is an arg_max operation for Graphs, but I would like to follow the example and not add the argmax to the Graph itself.
The mojo changelog mentions for version 24.2 that
Since these operations are no longer implemented for the Tensor type, what should an idiomatic mojo solution look like?
Anything else?
I'm using the currently latest release of max and mojo (24.6).
The text was updated successfully, but these errors were encountered: