Leopd
Leopd

Reputation: 42757

How to write a custom MXNet layer with learned parameters

I'm following the documentation in http://mxnet.io/how_to/new_op.html for how to define a new neural network layer in MXNet in python by subclassing themx.operator.CustomOp class. The example is of a loss layer that has no learned parameters. So how do the learned parameters get into the forward and backward methods?

Upvotes: 2

Views: 655

Answers (1)

Leopd
Leopd

Reputation: 42757

I figured this out. Learned parameters are configured like any other input to the op. They're configured in the list_arguments method. From the docs page on writing custom symbols:

Note that list arguments declares both input and parameter and we recommend ordering them as ['input1', 'input2', ... , 'weight1', 'weight2', ...]

Upvotes: 3

Related Questions