mxnet2——NDArray and autograd
2017-12-25 21:31
225 查看
form mxnet import ndarray as nd
NDArray
0 矩阵
nd.zeros((3,4))
1 矩阵
nd.ones((3,4))
创建矩阵
nd.array([[1,2],[3,4]])
随机矩阵 均值 a 方差 b nxm
nd.random_normal(a,b,shape=(n,m))
大小 shape
个数 size
运算
+ × 指数 nd.exp() 点乘 nd.dot() 转置 y.T
广播
形状不一样,复制
与NumPy的转换
import numpy as np x = np.ones((2,3)) y = nd.array(x) # numpy -> mxnet z = y.asnumpy() # mxnet -> numpy
替换
通过[:]写到一个之前开好的数组里 z[:] = x + y
截取
从a到b行:x[a:b] 指定位置:x[a,b] 多维:x[1:2,1:3]
autograd
import mxnet.ndrray as nd import mxnet.autograd as ag
申请空间
x.attah_grad()
显式求导的程序
with ag.record(): y = x * 2 z = y * x
进行求导
z.backward()
相关文章推荐
- a_func_a_day_in_python_numpy.ndarray与mxnet.ndarray.NDArray的转换
- MXNet官方文档中文版教程(2):GPUCPU张量计算(NDArray)
- MXNet设计和实现简介 a short introduction to mxnet design and implementation
- MxNet系列——how_to——develop_and_hack
- mxnet运行时报错:AttributeError: module 'mxnet.ndarray' has no attribute 'random'
- mxnet.ndarray进行矩阵拼接,使用concat命令。
- MxNet 学习笔记(1):MxNet中的NDArray
- Creating CustomBinding for WCFBasicHTTP for SSL and BasicAuthentication in BizTalk 转载自:http://geekswithblogs.net/mipsen
- MXNet框架的SSD算法代码介绍(一):train.py
- Microsoft .Net Micro Framework 3.0 and BIC Survey(2008 WinHEC)
- [Asp.Net]Understanding Built-In User and Group Accounts in IIS
- HTTP Handlers and HTTP Modules in ASP.NET(Reship)
- A Primer on COM Programming Frameworks(Chapter 3 of COM and .NET Interoperability)
- Json.NET Updates: Merge, Dependency Injection, F# and JSONPath Support
- .NET Framework Standard Library Annotated Reference, Volume 1: Base Class Library and Extended Numer
- ASP.NET 2.0 Membership and Roles Tutorial Series
- MxNet系列——model_zoo——index
- Pro SharePoint Solution Development: Combining .NET, SharePoint and Office 2007
- How does NDepend help me have a better understanding and control over my .NET code?