This repository was archived by the owner on Nov 17, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1950,7 +1950,7 @@ struct ReverseParam : public dmlc::Parameter<ReverseParam> {
1950
1950
#define REVERSE_MAX_DIM 10U
1951
1951
1952
1952
struct reverse {
1953
- MSHADOW_XINLINE static int ReverseIndex (index_t idx,
1953
+ MSHADOW_XINLINE static index_t ReverseIndex (index_t idx,
1954
1954
index_t nreversedim,
1955
1955
const index_t * stride_,
1956
1956
const index_t * trailing_) {
Original file line number Diff line number Diff line change @@ -279,6 +279,19 @@ def test_diag():
279
279
assert_almost_equal (r .asnumpy (), np .diag (a_np , k = k ))
280
280
281
281
282
+ def test_transpose ():
283
+ a = nd .arange (0 , LARGE_X ).reshape (LARGE_X , 1 )
284
+ b = nd .broadcast_to (a , shape = (a .shape [0 ], SMALL_Y ))
285
+ t = b .T
286
+ assert t .shape == (SMALL_Y , LARGE_X )
287
+ assert np .sum (t [:,- 1 ].asnumpy () == LARGE_X ) == b .shape [1 ]
288
+ t = nd .swapaxes (b , dim1 = 0 , dim2 = 1 )
289
+ assert t .shape == (SMALL_Y , LARGE_X )
290
+ assert np .sum (t [:,- 1 ].asnumpy () == LARGE_X ) == b .shape [1 ]
291
+ t = nd .flip (b , axis = 0 )
292
+ assert np .sum (t [- 1 ,:].asnumpy () == 0 ) == b .shape [1 ]
293
+
294
+
282
295
if __name__ == '__main__' :
283
296
import nose
284
297
nose .runmodule ()
You can’t perform that action at this time.
0 commit comments