Composing functions in Chainer

57 Views Asked by At

I wish to create a new Function object in Chainer by composing a number of existing functions. I haven't been able to find any method to do this in the docs. I could implement the composite function directly, this might be computationally more efficient. Or I could use the existing forward and backward methods of the existing functions.

What is the recommended approach?

1

There are 1 best solutions below

0
On

If you can achieve the computation by existing chainer functions, I think it is ok to create your function by just compositing the existing functions at first. You can consider optimizing the code later, once you found it becomes the bottleneck of computation.