Tensorflow with Python code
Yes, theoretically that's what tf.function does. This uses a tensorflow module called AutoGraph to basically convert your python/numpy operations to tensorflow ops.
However not all python operations can be converted. Things like printing, appending to lists and mutating global variables won't work in graph mode!
I suggest you take a look at the official guide to see how it is used and if it is applicable in your situation.