You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2020/10/19 22:07:07 UTC
[GitHub] [incubator-mxnet] Zha0q1 opened a new pull request #19381: numpy tril_indixes large tensor fix
Zha0q1 opened a new pull request #19381:
URL: https://github.com/apache/incubator-mxnet/pull/19381
This pr fixes tril_indices against large tensors. I think for this op there might be room for optimization for later
local run:
```
ubuntu@ip-172-31-38-169:~/workspace$ pytest tests/nightly/test_np_large_array.py::test_tril_indices
=================================================== test session starts ====================================================
platform linux -- Python 3.7.7, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
rootdir: /home/ubuntu/workspace, inifile: pytest.ini
plugins: remotedata-0.3.2, openfiles-0.4.0, astropy-header-0.1.2, hypothesis-5.8.3, arraydiff-0.3, doctestplus-0.5.0
collected 1 item
tests/nightly/test_np_large_array.py . [100%]
=============================================== 1 passed in 97.86s (0:01:37) ===========================================
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-mxnet] sandeep-krishnamurthy merged pull request #19381: numpy tril_indices large tensor fix
Posted by GitBox <gi...@apache.org>.
sandeep-krishnamurthy merged pull request #19381:
URL: https://github.com/apache/incubator-mxnet/pull/19381
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #19381: numpy tril_indixes large tensor fix
Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #19381:
URL: https://github.com/apache/incubator-mxnet/pull/19381#issuecomment-712468846
Hey @Zha0q1 , Thanks for submitting the PR
All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands:
- To trigger all jobs: @mxnet-bot run ci [all]
- To trigger specific jobs: @mxnet-bot run ci [job1, job2]
***
**CI supported jobs**: [windows-gpu, miscellaneous, edge, windows-cpu, sanity, centos-gpu, centos-cpu, clang, unix-gpu, unix-cpu, website]
***
_Note_:
Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin.
All CI tests must pass before the PR can be merged.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-mxnet] Zha0q1 commented on pull request #19381: numpy tril_indices large tensor fix
Posted by GitBox <gi...@apache.org>.
Zha0q1 commented on pull request #19381:
URL: https://github.com/apache/incubator-mxnet/pull/19381#issuecomment-716877514
> @Zha0q1 Can you update the Heading of PR to `tril_indices` instead of `tril_indixes` ?
Right! I changed it
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-mxnet] access2rohit commented on a change in pull request #19381: numpy tril_indices large tensor fix
Posted by GitBox <gi...@apache.org>.
access2rohit commented on a change in pull request #19381:
URL: https://github.com/apache/incubator-mxnet/pull/19381#discussion_r512334334
##########
File path: src/operator/numpy/np_matrix_op.cc
##########
@@ -1151,17 +1151,14 @@ inline bool TrilindicesOpShape(const nnvm::NodeAttrs& attrs,
int m = param.m;
int k = param.k;
- int length = 0;
+ index_t length = 0;
int end = k;
for (int i = 0; i < n; i++) {
- int tmpCount = 0;
- for (int j = 0; j <= std::min(end, m - 1); j++) {
- tmpCount++;
- }
- length += tmpCount;
+ int mi = std::min(end, m - 1);
Review comment:
Good !
you can remove `if` by
```
int mi = std::max(std::min(end, m - 1), 0);
```
Looks clean IMO, upto you if you think if condition improves readability you can keep it
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-mxnet] access2rohit commented on pull request #19381: numpy tril_indixes large tensor fix
Posted by GitBox <gi...@apache.org>.
access2rohit commented on pull request #19381:
URL: https://github.com/apache/incubator-mxnet/pull/19381#issuecomment-716874024
@Zha0q1 Can you update the Heading of PR to `tril_indices` instead of `tril_indixes` ?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-mxnet] access2rohit commented on a change in pull request #19381: numpy tril_indices large tensor fix
Posted by GitBox <gi...@apache.org>.
access2rohit commented on a change in pull request #19381:
URL: https://github.com/apache/incubator-mxnet/pull/19381#discussion_r512334334
##########
File path: src/operator/numpy/np_matrix_op.cc
##########
@@ -1151,17 +1151,14 @@ inline bool TrilindicesOpShape(const nnvm::NodeAttrs& attrs,
int m = param.m;
int k = param.k;
- int length = 0;
+ index_t length = 0;
int end = k;
for (int i = 0; i < n; i++) {
- int tmpCount = 0;
- for (int j = 0; j <= std::min(end, m - 1); j++) {
- tmpCount++;
- }
- length += tmpCount;
+ int mi = std::min(end, m - 1);
Review comment:
Good !
you can remove `if` by
```
int mi = std::max(std::min(end, m - 1), 0);
```
Looks clean IMO, upto you if you think `if` condition improves readability you can keep it
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-mxnet] access2rohit commented on pull request #19381: numpy tril_indices large tensor fix
Posted by GitBox <gi...@apache.org>.
access2rohit commented on pull request #19381:
URL: https://github.com/apache/incubator-mxnet/pull/19381#issuecomment-717585446
restarted unix-cpu
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #19381: numpy tril_indices large tensor fix
Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #19381:
URL: https://github.com/apache/incubator-mxnet/pull/19381#issuecomment-716964007
Jenkins CI successfully triggered : [unix-gpu, unix-cpu]
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-mxnet] access2rohit commented on pull request #19381: numpy tril_indices large tensor fix
Posted by GitBox <gi...@apache.org>.
access2rohit commented on pull request #19381:
URL: https://github.com/apache/incubator-mxnet/pull/19381#issuecomment-716881145
```
tril_indices(n, k=0, m=None)
Return the indices for the lower-triangle of an (n, m) array.
Parameters
----------
n : int
The row dimension of the arrays for which the returned
indices will be valid.
k : int, optional
Diagonal offset (see `tril` for details).
m : int, optional
.. versionadded:: 1.9.0
The column dimension of the arrays for which the returned
arrays will be valid.
By default `m` is taken equal to `n`.
```
Don't you think params `n` and `m` should be of type `index_t` either could be >= 2^31
also since `k` is offset this needs to be `index_t` as well
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-mxnet] access2rohit edited a comment on pull request #19381: numpy tril_indices large tensor fix
Posted by GitBox <gi...@apache.org>.
access2rohit edited a comment on pull request #19381:
URL: https://github.com/apache/incubator-mxnet/pull/19381#issuecomment-716881145
```
tril_indices(n, k=0, m=None)
Return the indices for the lower-triangle of an (n, m) array.
Parameters
----------
n : int
The row dimension of the arrays for which the returned
indices will be valid.
k : int, optional
Diagonal offset (see `tril` for details).
m : int, optional
.. versionadded:: 1.9.0
The column dimension of the arrays for which the returned
arrays will be valid.
By default `m` is taken equal to `n`.
```
Don't you think params `n` and `m` should be of type `index_t` either could be >= 2^31 ?
also since `k` is offset this needs to be `index_t` as well
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-mxnet] Zha0q1 commented on pull request #19381: numpy tril_indices large tensor fix
Posted by GitBox <gi...@apache.org>.
Zha0q1 commented on pull request #19381:
URL: https://github.com/apache/incubator-mxnet/pull/19381#issuecomment-716963975
@mxnet-bot run ci [unix-cpu, unix-gpu]
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org