diff --git a/src/pystencils_autodiff/backends/astnodes.py b/src/pystencils_autodiff/backends/astnodes.py
index 3355271a7d716187638ae8162cddacce05c6952f..4c6c41d0f0eca8f5a4cff1908864e1dce29355b2 100644
--- a/src/pystencils_autodiff/backends/astnodes.py
+++ b/src/pystencils_autodiff/backends/astnodes.py
@@ -148,9 +148,9 @@ class TensorflowModule(TorchModule):
     def compile(self):
         from pystencils_autodiff.tensorflow_jit import compile_sources_and_load
         if self.is_cuda:
-            self.compiled_file = compile_sources_and_load([], cuda_sources=[str(self)])
+            self.compiled_file = compile_sources_and_load([], cuda_sources=[str(self)], compile_only=True)
         else:
-            self.compiled_file = compile_sources_and_load([str(self)])
+            self.compiled_file = compile_sources_and_load([str(self)], compile_only=True)
         import tensorflow as tf
         return tf.load_op_library(self.compiled_file)