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

Class Initializer

tensorflow/python/ops/init_ops.py:55–97  ·  view source on GitHub ↗

Initializer base class: all initializers inherit from this class.

Source from the content-addressed store, hash-verified

53
54
55class Initializer(object):
56 """Initializer base class: all initializers inherit from this class."""
57
58 def __call__(self, shape, dtype=None, partition_info=None):
59 """Returns a tensor object initialized as specified by the initializer.
60
61 Args:
62 shape: Shape of the tensor.
63 dtype: Optional dtype of the tensor. If not provided use the initializer
64 dtype.
65 partition_info: Optional information about the possible partitioning of a
66 tensor.
67 """
68 raise NotImplementedError
69
70 def get_config(self):
71 """Returns the configuration of the initializer as a JSON-serializable dict.
72
73 Returns:
74 A JSON-serializable Python dict.
75 """
76 return {}
77
78 @classmethod
79 def from_config(cls, config):
80 """Instantiates an initializer from a configuration dictionary.
81
82 Example:
83
84 ```python
85 initializer = RandomUniform(-1, 1)
86 config = initializer.get_config()
87 initializer = RandomUniform.from_config(config)
88 ```
89
90 Args:
91 config: A Python dictionary. It will typically be the output of
92 `get_config`.
93
94 Returns:
95 An Initializer instance.
96 """
97 return cls(**config)
98
99
100@tf_export(v1=["initializers.zeros", "zeros_initializer"])

Callers 15

TestSimpleAddMethod · 0.50
TestOpExclusionAddMethod · 0.50
TestShapePropagationMethod · 0.50
TestReplaceSendRecvsMethod · 0.50
TestRemoveUnusedNodesMethod · 0.50
TestFuseResizeAndConvMethod · 0.50
TestFusePadAndConvMethod · 0.50
TestIgnoreOpsMethod · 0.50
TestQuantizeMatMulMethod · 0.50
TestQuantizeMulMethod · 0.50

Calls

no outgoing calls

Tested by 15

TestSimpleAddMethod · 0.40
TestOpExclusionAddMethod · 0.40
TestShapePropagationMethod · 0.40
TestReplaceSendRecvsMethod · 0.40
TestRemoveUnusedNodesMethod · 0.40
TestFuseResizeAndConvMethod · 0.40
TestFusePadAndConvMethod · 0.40
TestIgnoreOpsMethod · 0.40
TestQuantizeMatMulMethod · 0.40
TestQuantizeMulMethod · 0.40