Skip to content

Instantly share code, notes, and snippets.

@danijar
danijar / share_variables_decorator.py
Last active November 20, 2021 17:21
TensorFlow decorator to share variables between calls. Works for both functions and methods.
import functools
import tensorflow as tf
class share_variables(object):
def __init__(self, callable_):
self._callable = callable_
self._wrappers = {}