ngraph-python icon indicating copy to clipboard operation
ngraph-python copied to clipboard

[Question] - How to extend graph functions?

Open pedronahum opened this issue 9 years ago • 2 comments

Dear Nervana team,

First and foremost, great work!

If someone would like to use ngraph for GPP, instead of solely for DL, how could he/she add additional graph functions? Is there a document / example that describes the steps?

Thanks,

Pedro N.

pedronahum avatar Nov 27 '16 09:11 pedronahum

First, this is an area quite likely to change significantly.

Look at op_graph.py. For a tensor operation, you can either just define a function that constructs a few ops, or define a new op. If you define a new op, you need to add something in the cpu transformer and gpu transformer to tell how to execute the op. In the future, I expect that you'll be able to do that without modifying existing functions/methods. For GPU, you need to reshape your tensor dimensions from arbitrary to whatever the kernels you are using expect, while for NumPy you just need tensor striding that NumPy can work with.

If you need autodiff to work for your new op, there's a partial explanation in the docs about how autodiff works, and there are a lot of examples. Docs on this will be more extensive in the future.

diyessi avatar Nov 28 '16 17:11 diyessi

Thank you! Greatly appreciate the insights.

pedronahum avatar Nov 28 '16 17:11 pedronahum