W3cubDocs

/TensorFlow 1.15

tf.contrib.framework.model_variable

Gets an existing model variable with these parameters or creates a new one.

Args
name the name of the new or existing variable.
shape shape of the new or existing variable.
dtype type of the new or existing variable (defaults to DT_FLOAT).
initializer initializer for the variable if one is created.
regularizer a (Tensor -> Tensor or None) function; the result of applying it on a newly created variable will be added to the collection GraphKeys.REGULARIZATION_LOSSES and can be used for regularization.
trainable If True also add the variable to the graph collection GraphKeys.TRAINABLE_VARIABLES (see tf.Variable).
collections A list of collection names to which the Variable will be added. Note that the variable is always also added to the GraphKeys.GLOBAL_VARIABLES and GraphKeys.MODEL_VARIABLES collections.
caching_device Optional device string or function describing where the Variable should be cached for reading. Defaults to the Variable's device.
device Optional device to place the variable. It can be an string or a function that is called to get the device for the variable.
partitioner Optional callable that accepts a fully defined TensorShape and dtype of the Variable to be created, and returns a list of partitions for each axis (currently only one axis can be partitioned).
custom_getter Callable that allows overwriting the internal get_variable method and has to have the same signature.
use_resource If True use a ResourceVariable instead of a Variable.
synchronization Indicates when a distributed a variable will be aggregated. Accepted values are constants defined in the class tf.VariableSynchronization. By default the synchronization is set to AUTO and the current DistributionStrategy chooses when to synchronize.
aggregation Indicates how a distributed variable will be aggregated. Accepted values are constants defined in the class tf.VariableAggregation.
Returns
The created or existing variable.

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/framework/model_variable