Change the in_data in CustomOp

Hi, I’m writing my own Costom Operator Op following the tutorials here: https://github.com/apache/incubator-mxnet/blob/master/example/numpy-ops/custom_softmax.py

I want to change the “in_data” because my custom loss needs the outputs from anther network.
for this moment it has “data” and “label”.

I changed the Data Batch in “forward” of Sequential module. However, when the data_batch was passed into CustomOp, there is only “data” and "label’ part.

I couldn’t figure it out how the data batch was passed from the forward function of Module to the Custom Op.

So ideally I can get another part of data besides data and label by

data = in_data[0]
label = in_data[1]
pred = in_data[2]

when I asked this on Github (This was actually is not a good idea), and I was told

I can pass more arguments like following:

mx.sym.Custom([a, b, c, d, e], …)
mx.nd.Custom(
[a, b, c, d, e], …)
in which a = in_data[0], b = in_data[1], c = in_data[2], d = in_data[3], e = in_data[4].

But here because I write my own Module and was going to pass the data directly to the forward function in Module, but not “outside”.

Maybe I missed something?
Can anyone give me some advice. Thank you.

Hi @wshuail, it would be great if you could provide a simple runnable example of this (showing how your operator interacts with sequential module). You say that you’ve written your own module, could you clarify this?

One idea is for you to update the arguments in the list_arguments method of your custom operator, or you could try bundling the different inputs into data itself.