mxnet随笔-repeat

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010255642/article/details/82056100
 # -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""
import mxnet as mx

x = mx.nd.array([[ 1, 2],[ 3, 4]])

print mx.nd.repeat(x, repeats=2) 

print mx.nd.repeat(x, repeats=2, axis=1) 

print mx.nd.repeat(x, repeats=2, axis=0)
print mx.nd.repeat(x, repeats=2, axis=-1)
[1. 1. 2. 2. 3. 3. 4. 4.]
<NDArray 8 @cpu(0)>

[[1. 1. 2. 2.]
 [3. 3. 4. 4.]]
<NDArray 2x4 @cpu(0)>

[[1. 2.]
 [1. 2.]
 [3. 4.]
 [3. 4.]]
<NDArray 4x2 @cpu(0)>

[[1. 1. 2. 2.]
 [3. 3. 4. 4.]]
<NDArray 2x4 @cpu(0)>
>>> 

猜你喜欢

转载自blog.csdn.net/u010255642/article/details/82056100