deepr.utils.TableContext
- class deepr.utils.TableContext[source]
Context Manager to reuse Tensorflow tables.
Tensorflow does not have a
tf.get_variable
equivalent for tables. TheTableContext
is here to provide this functionality.Example
>>> import deepr >>> with deepr.utils.TableContext() as tables: ... table = deepr.utils.table_from_mapping(name="my_table", mapping={1: 2}) ... tables.get("my_table") is table True
>>> with deepr.utils.TableContext(): ... table = deepr.utils.table_from_mapping(name="my_table", mapping={1: 2}) ... reused = deepr.utils.table_from_mapping(name="my_table", reuse=True) ... table is reused True
Methods
__init__
()active
()close
()get
(name)is_active
()set
(name, table)