mxnet随笔 -broadcast,shape,ndim

 # -*- coding: utf-8 -*-
"""
Spyder Editor

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

x = mx.nd.arange(0,3).reshape((1,3,1))
print x
y = x.broadcast_to((2,3,3))
print y

x = mx.nd.array([1, 2, 3, 4])
print x.ndim
x = mx.nd.array([[1, 2], [3, 4]])
print x.ndim
print y.shape

shape:形状

ndim:维度

broadcast:广播,但不改变维度

[[[0.]
[1.]
[2.]]]

[[[0. 0. 0.]
[1. 1. 1.]
[2. 2. 2.]]

[[0. 0. 0.]
[1. 1. 1.]
[2. 2. 2.]]]

1
2
(2L, 3L, 3L)

你可能感兴趣的:(mxnet,AI)