padreofthegame commented on issue #13796:
URL: https://github.com/apache/tvm/issues/13796#issuecomment-1449667605
Yes and no. Why don't return integer result (as numpy does), which will
represent number of True values in corresponding axis. For example:
`data = np.array([[True, True, True], [False, True, True], [False, False,
True]])`
`result = np.sum(data, (0,))`
`print(result)`
`print(result.dtype)`
======================
`array([1, 2, 3])`
`dtype('int64')`
Difference with the example above is that there we explicitly requested
output to be boolean in the call of `np.sum(x,dtype=bool)`, providing the
`dtype` parameter. I also suggest maybe to keep it simple and in the case of
boolean inputs to cast them to int and provide them to `sum` operator. It
should result also with integer output. But if someone wants output to be of
other type, it should say that explicitly in the relay or topi definition (by
calling `cast` on obtained result).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]