RafLit opened a new pull request #20419:
URL: https://github.com/apache/incubator-mxnet/pull/20419
## Description ##
- deleted the numpy transpose
- moved numpy transpose to ndarray implementation
- speedup of numpy transpose thanks to the ONEdnn transpose operator:
### Transpose operator benchmark results
<table>
<tr>
<td> </ td>
<td colspan=2 align="center"> This PR </ td>
<td colspan=2 align="center"> Master </ td>
</tr>
<tr>
<td> tensor shape </td>
<td> numpy [ms] </ td>
<td> ndarray [ms]</ td>
<td> numpy [ms] </ td>
<td> ndarray [ms] </ td>
</tr>
<tr>
<td> (128, 128)</td>
<td> 0.5742</ td>
<td> 0.5906 </ td>
<td> 0.5274 </ td>
<td> 0.5942 </ td>
</tr>
<tr>
<td> (2048, 2048)</td>
<td> 1.3554</ td>
<td> 1.3458 </ td>
<td> 1.7525 </ td>
<td> 1.3128 </ td>
</tr>
<tr>
<td> (4096, 4096)</td>
<td> 4.6793</ td>
<td> 4.6705 </ td>
<td> 6.0797 </ td>
<td> 4.6172 </ td>
</tr>
<td> (256, 256, 256)</td>
<td> 4.0402</ td>
<td> 3.9367 </ td>
<td> 118.3312 </ td>
<td> 3.9208 </ td>
</tr>
<td> (64, 64, 64, 64)</td>
<td> 4.1867</ td>
<td> 4.2186 </ td>
<td> 137.0017 </ td>
<td> 4.1942 </ td>
</tr>
</table>
## Checklist ##
### Essentials ###
- [ ] PR's title starts with a category (e.g. [BUGFIX], [MODEL], [TUTORIAL],
[FEATURE], [DOC], etc)
- [ ] Changes are complete (i.e. I finished coding on this PR)
- [ ] All changes have test coverage
- [ ] Code is well-documented
## Question ##
I also have a question regarding the axes parameter in numpy and ndarray
transpose. Numpy axes supports negative indices in the axes parameter, so one
can for example use:
```
x = mx.np.arange(20).reshape(2,5,2)
y = mx.np.transpose(x, axes=(-3,-2,-1)
```
and it will work fine, but giving the same axes parameter to ndarray
transpose is not supported, so for example:
```
x = mx.nd.arange(20).reshape(2,5,2)
y = mx.nd.transpose(x, axes=(-3,-2,-1))
```
ends with an error.
should support for negative indices be added to ndarray transpose?
--
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]