[GitHub] asitstands commented on issue #11031: Use dtype=int for the indices returned by TopK
asitstands commented on issue #11031: Use dtype=int for the indices returned by TopK URL: https://github.com/apache/incubator-mxnet/issues/11031#issuecomment-392798800 I think that `random.multinomial` also need to be in the list. I'm positive on the introducion of the new name `idx_dtype`, but using the old `dtype` also looks not bad for the consistency, as the operators in `random` package use `dtype` to specify the data type of the output array. We need to set the backward compatible default currently, but I agree on changing it as integer in 2.0. Anyway an index is an integer by its nature. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] asitstands commented on issue #11031: Use dtype=int for the indices returned by TopK
asitstands commented on issue #11031: Use dtype=int for the indices returned by TopK URL: https://github.com/apache/incubator-mxnet/issues/11031#issuecomment-392075252 This could break existing code. Sometimes the resulting array of indices is subject to another operation. Then the result can become different if the dtype of the index array changes. Or it can make an error as some opertions can be applied to only floating point arrays. ```python nd.topk(nd.arange(10), k=2).mean() ``` Currently the result is `[8.5]`, but the result is `[8]` if the dtype is integer. ```python nd.linalg.gemm2(nd.topk(x, k=2), y) ``` Currently this is allowed, but it'll cause an error if the dtype changes to integer. `multinomial` has a similar but opposite issue. It returns an index array of integer type, but it would be convenient to have floating point array sometimes (PR #10970). I think that it would be better if we can make `multinomial` and `topk` consistent. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] asitstands commented on issue #11031: Use dtype=int for the indices returned by TopK
asitstands commented on issue #11031: Use dtype=int for the indices returned by TopK URL: https://github.com/apache/incubator-mxnet/issues/11031#issuecomment-392075252 This could break existing code. Sometimes the resulting array of indices is subject to another operation. Then the result can become different if the dtype of the index array changes. Or it can make an error as some opertions can be applied to only floating point arrays. ```python nd.topk(nd.arange(10), k=2).mean() ``` Currently the result is `[8.5]`, but the result is `[8]` if the dtype is integer. ```python nd.gemm2(nd.topk(x, k=2), y) ``` Currently this is allowed, but it'll cause an error if the dtype changes to integer. `multinomial` has a similar but opposite issue. It returns an index array of integer type, but it would be convenient to have floating point array sometimes (PR #10970). I think that it would be better if we can make `multinomial` and `topk` consistent. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] asitstands commented on issue #11031: Use dtype=int for the indices returned by TopK
asitstands commented on issue #11031: Use dtype=int for the indices returned by TopK URL: https://github.com/apache/incubator-mxnet/issues/11031#issuecomment-392075252 This could break existing code. Sometimes the resulting array of indices is subject to another operation. Then the result can become different if the dtype of the index array changes. Or it can make an error as some opertions can be applied to only floating point arrays. ```python nd.topk(nd.arange(10), k=2).mean() ``` Currently the result is `[8.5]`, but the result is `[8]` if the dtype is integer. ```python nd.gemm2(nd.topk(x, k=2), y) ``` Currently this is allowed, but it'll cause an error if the dtype changes to integer. `multinomial` has a similar but opposite issue. It returns an index array of integer type, but it would be convenient to have floating point array sometimes (#10970). I think that it would be better if we can make `multinomial` and `topk` consistent. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] asitstands commented on issue #11031: Use dtype=int for the indices returned by TopK
asitstands commented on issue #11031: Use dtype=int for the indices returned by TopK URL: https://github.com/apache/incubator-mxnet/issues/11031#issuecomment-392075252 This could break existing code. Sometimes the resulting array of indices is subject to another operation. Then the result can become different if the dtype of the index array changes. Or it can make an error as some opertions can be applied to only floating point arrays. ```python nd.topk(nd.arange(10), k=2).mean() ``` Currently the result is `[8.5]`, but the result is `[8]` if the dtype is integer. ```python nd.gemm2(nd.topk(nd.arange(10), k=2), x) ``` Currently this is allowed, but it'll cause an error if the dtype changes to integer. `multinomial` has a similar but opposite issue. It returns an index array of integer type, but it would be convenient to have floating point array sometimes (#10970). I think that it would be better if we can make `multinomial` and `topk` consistent. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services