[MXNET-1410]Adding Large Tensor Support for tensor transpose#15059
Conversation
|
@mxnet-label-bot add [pr-work-in-progress] |
1976567 to
cc20e34
Compare
| struct reverse { | ||
| MSHADOW_XINLINE static int ReverseIndex(index_t idx, | ||
| MSHADOW_XINLINE static index_t ReverseIndex(index_t idx, | ||
| index_t nreversedim, |
There was a problem hiding this comment.
my bad .. will fix it
| t = b.T | ||
| assert t.shape == (SMALL_Y, LARGE_X) | ||
| assert np.sum(t[:,-1].asnumpy() == LARGE_X) == b.shape[1] | ||
| t = nd.swapaxes(b, dim1=0, dim2=1) |
There was a problem hiding this comment.
These are 3 different transpose operations all three are tested
There was a problem hiding this comment.
I thought transpose is a operator name? If you are testing swapaxes, maybe change the test name as well?
There was a problem hiding this comment.
flip(), swapaxes() and b.T are all transpose operations
| t = nd.swapaxes(b, dim1=0, dim2=1) | ||
| assert t.shape == (SMALL_Y, LARGE_X) | ||
| assert np.sum(t[:,-1].asnumpy() == LARGE_X) == b.shape[1] | ||
| t = nd.flip(b, axis=0) |
There was a problem hiding this comment.
test this operator in separate?
There was a problem hiding this comment.
try test operator invidually to avoid collateral failures.
d5443f0 to
e678461
Compare
| assert_almost_equal(r.asnumpy(), np.diag(a_np, k=k)) | ||
|
|
||
|
|
||
| def create_large_tensor(): |
There was a problem hiding this comment.
can we make this method more generic, so user can pass in values to create tensors with different dimension? Also, if it is limited to a 2D tensor, maybe you want to rename the method too.
There was a problem hiding this comment.
this is currently generic to 2D tensor. Can be used for other tests will update that in a separate PR. Apart from this do you think its good to go ?
e678461 to
2e1bd4e
Compare
0ff8c43 to
791db77
Compare
|
@access2rohit @apeforest this is causing nightly to fail on test large tensors |
Description
Adds tests for tensor transpose
Fix operators: flip
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.