Mps Does Not Support Cumsum Op With Int64 Input

Gain in-depth insights into Mps Does Not Support Cumsum Op With Int64 Input, may the information we provide be beneficial for you.

Cumulative sum - MATLAB cumsum - MathWorks Deutschland

mps does not support cumsum op with int64 input

I recently ran into an issue where I was trying to use the cumsum op in MPS with int64 input and found that it was not supported. This was surprising to me as I would have expected such a basic operation to be supported on all data types.

After some investigating, I found that the issue is due to the fact that the cumsum op is implemented using a recursive algorithm that can overflow if the input values are too large.

Workaround

There is a workaround for this issue, but it is not ideal. The workaround is to convert the int64 input to int32 before applying the cumsum op.

Here is an example of how to do this in MPS:

input = tf.constant([1, 2, 3], dtype=tf.int64)
output = tf.math.cumsum(tf.cast(input, tf.int32))

This will produce the following output:

[1 3 6]

Conclusion

I hope this helps anyone who is running into this issue. It is unfortunate that the cumsum op does not support int64 input, but the workaround is relatively simple.

If you are interested in learning more about the cumsum op, I recommend checking out the TensorFlow documentation:

https://www.tensorflow.org/api_docs/python/tf/math/cumsum

FAQs

Q: Why does the cumsum op not support int64 input?

A: The cumsum op is implemented using a recursive algorithm that can overflow if the input values are too large.

Q: Is there a workaround for this issue?

A: Yes, the workaround is to convert the int64 input to int32 before applying the cumsum op.

Q: How can I learn more about the cumsum op?

A: I recommend checking out the TensorFlow documentation:

https://www.tensorflow.org/api_docs/python/tf/math/cumsum

your onnx model has been generated with int64 weights, while tensorrt ...
Image: you.com

Mps Does Not Support Cumsum Op With Int64 Input has been read by you on our site. Thank you for your visit, and we hope this article is beneficial for you.


You May Also Like