Gets or creates a sharded variable list with these parameters. The `partitioner` must be a callable that accepts a fully defined `TensorShape` and returns a sequence of integers (the `partitions`). These integers describe how to partition the given sharded `Variable` along the given dimensi
(name,
shape=None,
dtype=None,
initializer=None,
regularizer=None,
trainable=True,
collections=None,
caching_device=None,
partitioner=None,
validate_shape=True,
use_resource=None,
constraint=None,
synchronization=VariableSynchronization.AUTO,
aggregation=VariableAggregation.NONE)
| 2413 | ht_partition_num=ht_partition_num) |
| 2414 | |
| 2415 | def _get_partitioned_variable(name, |
| 2416 | shape=None, |
| 2417 | dtype=None, |
| 2418 | initializer=None, |
| 2419 | regularizer=None, |
| 2420 | trainable=True, |
| 2421 | collections=None, |
| 2422 | caching_device=None, |
| 2423 | partitioner=None, |
| 2424 | validate_shape=True, |
| 2425 | use_resource=None, |
| 2426 | constraint=None, |
| 2427 | synchronization=VariableSynchronization.AUTO, |
| 2428 | aggregation=VariableAggregation.NONE): |
| 2429 | """Gets or creates a sharded variable list with these parameters. |
| 2430 | |
| 2431 | The `partitioner` must be a callable that accepts a fully defined |
| 2432 | `TensorShape` and returns a sequence of integers (the `partitions`). |
| 2433 | These integers describe how to partition the given sharded `Variable` |
| 2434 | along the given dimension. That is, `partitions[1] = 3` means split |
| 2435 | the `Variable` into 3 shards along dimension 1. Currently, sharding along |
| 2436 | only one axis is supported. |
| 2437 | |
| 2438 | If the list of variables with the given name (prefix) is already stored, |
| 2439 | we return the stored variables. Otherwise, we create a new one. |
| 2440 | |
| 2441 | If initializer is `None` (the default), the default initializer passed in |
| 2442 | the constructor is used. If that one is `None` too, we use a new |
| 2443 | `glorot_uniform_initializer`. If initializer is a Tensor, we use |
| 2444 | it as a value and derive the shape from the initializer. |
| 2445 | |
| 2446 | If the initializer is a callable, then it will be called for each |
| 2447 | shard. Otherwise the initializer should match the shape of the entire |
| 2448 | sharded Variable, and it will be sliced accordingly for each shard. |
| 2449 | |
| 2450 | Some useful partitioners are available. See, e.g., |
| 2451 | `variable_axis_size_partitioner` and `min_max_variable_partitioner`. |
| 2452 | |
| 2453 | Args: |
| 2454 | name: The name of the new or existing variable. |
| 2455 | shape: Shape of the new or existing variable. |
| 2456 | dtype: Type of the new or existing variable (defaults to `DT_FLOAT`). |
| 2457 | initializer: Initializer for the variable if one is created. |
| 2458 | regularizer: A (Tensor -> Tensor or None) function; the result of applying |
| 2459 | it on a newly created variable will be added to the collection |
| 2460 | GraphKeys.REGULARIZATION_LOSSES and can be used for regularization. |
| 2461 | trainable: If `True` also add the variable to the graph collection |
| 2462 | `GraphKeys.TRAINABLE_VARIABLES` (see `tf.Variable`). |
| 2463 | collections: List of graph collections keys to add the Variable to. Defaults |
| 2464 | to `[GraphKeys.GLOBAL_VARIABLES]` (see `tf.Variable`). |
| 2465 | caching_device: Optional device string or function describing where the |
| 2466 | Variable should be cached for reading. Defaults to the Variable's device. |
| 2467 | If not `None`, caches on another device. Typical use is to cache on the |
| 2468 | device where the Ops using the Variable reside, to deduplicate copying |
| 2469 | through `Switch` and other conditional statements. |
| 2470 | partitioner: Optional callable that accepts a fully defined `TensorShape` |
| 2471 | and `dtype` of the Variable to be created, and returns a list of |
| 2472 | partitions for each axis (currently only one axis can be partitioned). |
nothing calls this directly
no test coverage detected