raskr / rust-autograd

Tensors and differentiable operations (like TensorFlow) in Rust
MIT License
487 stars 37 forks source link

Fix argmax index bug when multiple max args #5

Closed shanegibbs closed 6 years ago

shanegibbs commented 6 years ago

Potential fix for https://github.com/raskr/rust-autograd/issues/4. You may be able to come up with a more elegant solution. I am not super familiar with ndarray.

This adds a found switch, which, when flipped causes the fn in apply() to only return 0.. This ensures we have a maximum of 1.

raskr commented 6 years ago

Thank you a lot! The trigger of this bug is exactly what you mentioned in #4, and changes looks good to me 👍