From a7d2bf41e84bfd840e46c3648f97d9fe2d6fdfe4 Mon Sep 17 00:00:00 2001 From: Stephan Seitz <stephan.seitz@fau.de> Date: Thu, 8 Aug 2019 03:24:29 +0200 Subject: [PATCH] Add AutoDiffOp.create_torch_op --- docs/index.rst | 5 +++-- src/pystencils_autodiff/autodiff.py | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index d45732a..879d768 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,9 +1,10 @@ =================== -pystencils_autodiff +pystencils-autodiff =================== -This is the documentation of **pystencils_autodiff**. +This is the documentation of **pystencils-autodiff**. +.. include:: ../README.rst Contents diff --git a/src/pystencils_autodiff/autodiff.py b/src/pystencils_autodiff/autodiff.py index a81929b..1195b30 100644 --- a/src/pystencils_autodiff/autodiff.py +++ b/src/pystencils_autodiff/autodiff.py @@ -21,6 +21,11 @@ class DiffModes(str, Enum): class AutoDiffOp: + """ + Class to generate code for forward and backward kernels for automatic + differentiation operators. + """ + _REPR_TEMPLATE = jinja2.Template( """Forward: {{ forward_assignments | indent(4) }} @@ -432,6 +437,9 @@ Backward: def time_constant_fields(self): return self._time_constant_fields + def create_torch_op(self, *args, **kwags): + return self.create_tensorflow_op(*args, backend='torch_native', **kwags) + def create_tensorflow_op(self, inputfield_tensor_dict, forward_loop=None, -- GitLab