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

Method _init_from_args

tensorflow/python/ops/variables.py:1906–2085  ·  view source on GitHub ↗

Creates a new variable from arguments. Args: initial_value: A `Tensor`, or Python object convertible to a `Tensor`, which is the initial value for the Variable. The initial value must have a shape specified unless `validate_shape` is set to False. Can also be a cal

(self,
                      initial_value=None,
                      trainable=None,
                      collections=None,
                      validate_shape=True,
                      caching_device=None,
                      name=None,
                      dtype=None,
                      expected_shape=None,
                      constraint=None,
                      synchronization=None,
                      aggregation=None,
                      shape=None)

Source from the content-addressed store, hash-verified

1904 self.name, self.get_shape(), self.dtype.name)
1905
1906 def _init_from_args(self,
1907 initial_value=None,
1908 trainable=None,
1909 collections=None,
1910 validate_shape=True,
1911 caching_device=None,
1912 name=None,
1913 dtype=None,
1914 expected_shape=None,
1915 constraint=None,
1916 synchronization=None,
1917 aggregation=None,
1918 shape=None):
1919 """Creates a new variable from arguments.
1920
1921 Args:
1922 initial_value: A `Tensor`, or Python object convertible to a `Tensor`,
1923 which is the initial value for the Variable. The initial value must have
1924 a shape specified unless `validate_shape` is set to False. Can also be a
1925 callable with no argument that returns the initial value when called.
1926 (Note that initializer functions from init_ops.py must first be bound to
1927 a shape before being used here.)
1928 trainable: If `True`, also adds the variable to the graph collection
1929 `GraphKeys.TRAINABLE_VARIABLES`. This collection is used as the default
1930 list of variables to use by the `Optimizer` classes. Defaults to `True`,
1931 unless `synchronization` is set to `ON_READ`, in which case it defaults
1932 to `False`.
1933 collections: List of graph collections keys. The new variable is added to
1934 these collections. Defaults to `[GraphKeys.GLOBAL_VARIABLES]`.
1935 validate_shape: If `False`, allows the variable to be initialized with a
1936 value of unknown shape. If `True`, the default, the shape of
1937 `initial_value` must be known.
1938 caching_device: Optional device string or function describing where the
1939 Variable should be cached for reading. Defaults to the Variable's
1940 device. If not `None`, caches on another device. Typical use is to
1941 cache on the device where the Ops using the Variable reside, to
1942 deduplicate copying through `Switch` and other conditional statements.
1943 name: Optional name for the variable. Defaults to `'Variable'` and gets
1944 uniquified automatically.
1945 dtype: If set, initial_value will be converted to the given type. If None,
1946 either the datatype will be kept (if initial_value is a Tensor) or
1947 float32 will be used (if it is a Python object convertible to a Tensor).
1948 expected_shape: Deprecated. Ignored.
1949 constraint: An optional projection function to be applied to the variable
1950 after being updated by an `Optimizer` (e.g. used to implement norm
1951 constraints or value constraints for layer weights). The function must
1952 take as input the unprojected Tensor representing the value of the
1953 variable and return the Tensor for the projected value (which must have
1954 the same shape). Constraints are not safe to use when doing asynchronous
1955 distributed training.
1956 synchronization: Indicates when a distributed a variable will be
1957 aggregated. Accepted values are constants defined in the class
1958 `tf.VariableSynchronization`. By default the synchronization is set to
1959 `AUTO` and the current `DistributionStrategy` chooses when to
1960 synchronize.
1961 aggregation: Indicates how a distributed variable will be aggregated.
1962 Accepted values are constants defined in the class
1963 `tf.VariableAggregation`.

Callers 1

__init__Method · 0.95

Calls 15

typeFunction · 0.85
initial_valueFunction · 0.85
executing_eagerlyMethod · 0.80
_attr_scopeMethod · 0.80
unknown_shapeMethod · 0.80
is_fully_definedMethod · 0.80
colocate_withMethod · 0.80
add_to_collectionsMethod · 0.80
name_scopeMethod · 0.45

Tested by

no test coverage detected