If I would use torch.autograd.Function like this:
class CustomLayerFunction(torch.autograd.Function):
@staticmethod
def symbolic(g, features):
return g.op("CustomLib::CustomLayer", features)
@staticmethod
def forward(ctx, features):
return 10 * features;
@staticmethod
def backward(ctx, grad_output):
pass
Pytorch will create CustomLayer node while exporting to ONNX.
Is there another way (without subclassing torch.autograd.Function) to tell Pytorch stop tracing further and insert CustomLayer node?