How to get a gradient node with mxnet.jl and Julia?

Viewed 287

I'm trying to replicate the following example from the mxnet main docs with mxnet.jl in Julia:

A = Variable('A')
B = Variable('B')
C = B * A
D = C + Constant(1)
# get gradient node.
gA, gB = D.grad(wrt=[A, B])
# compiles the gradient function.
f = compile([gA, gB])
grad_a, grad_b = f(A=np.ones(10), B=np.ones(10)*2)

The example shows how to autodiff a symoblic expression and obtain its gradients.

What is the equivalent in mxnet.jl (latest version 2016-03-07)?

1 Answers
Related