# -*- coding: utf-8 -*-"""Spyder EditorThis is a temporary script file."""import mxnet as mximport numpy as npx = mx.nd.arange(0,3).reshape((1,3,1))print xy = x.broadcast_to((2,3,3))print yx = mx.nd.array([1, 2, 3, 4])print x.ndimx = mx.nd.array([[1, 2], [3, 4]])print x.ndimprint y.shape
shape:形状
ndim:维度
broadcast:广播,但不改变维度
[[[0.]
[1.]
[2.]]]
<NDArray 1x3x1 @cpu(0)>
[[[0. 0. 0.]
[1. 1. 1.]
[2. 2. 2.]]
[[0. 0. 0.]
[1. 1. 1.]
[2. 2. 2.]]]
<NDArray 2x3x3 @cpu(0)>
1
2
(2L, 3L, 3L)
mxnet-broadcast,shape,ndim
原文地址:http://blog.51cto.com/13959448/2316492