MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / export_constant

Method export_constant

tensorflow/python/util/tf_export.py:349–380  ·  view source on GitHub ↗

Store export information for constants/string literals. Export information is stored in the module where constants/string literals are defined. e.g. ```python foo = 1 bar = 2 tf_export("consts.foo").export_constant(__name__, 'foo') tf_export("consts.bar").export_con

(self, module_name, name)

Source from the content-addressed store, hash-verified

347 setattr(func, api_names_attr, names)
348
349 def export_constant(self, module_name, name):
350 """Store export information for constants/string literals.
351
352 Export information is stored in the module where constants/string literals
353 are defined.
354
355 e.g.
356 ```python
357 foo = 1
358 bar = 2
359 tf_export("consts.foo").export_constant(__name__, 'foo')
360 tf_export("consts.bar").export_constant(__name__, 'bar')
361 ```
362
363 Args:
364 module_name: (string) Name of the module to store constant at.
365 name: (string) Current constant name.
366 """
367 module = sys.modules[module_name]
368 api_constants_attr = API_ATTRS[self._api_name].constants
369 api_constants_attr_v1 = API_ATTRS_V1[self._api_name].constants
370
371 if not hasattr(module, api_constants_attr):
372 setattr(module, api_constants_attr, [])
373 # pylint: disable=protected-access
374 getattr(module, api_constants_attr).append(
375 (self._names, name))
376
377 if not hasattr(module, api_constants_attr_v1):
378 setattr(module, api_constants_attr_v1, [])
379 getattr(module, api_constants_attr_v1).append(
380 (self._names_v1, name))
381
382
383def kwarg_only(f):

Callers 15

setUpMethod · 0.80
array_ops.pyFile · 0.80
variable_scope.pyFile · 0.80
distribution.pyFile · 0.80
versions.pyFile · 0.80
errors_impl.pyFile · 0.80
dtypes.pyFile · 0.80
dataset_ops.pyFile · 0.80
cardinality.pyFile · 0.80
constants.pyFile · 0.80
tag_constants.pyFile · 0.80

Calls 1

appendMethod · 0.45

Tested by 3

setUpMethod · 0.64