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

Method __init__

tensorflow/python/ops/data_flow_ops.py:1263–1297  ·  view source on GitHub ↗

Creates a new ConditionalAccumulator. Args: dtype: Datatype of the accumulated gradients. shape: Shape of the accumulated gradients. shared_name: Optional. If non-empty, this accumulator will be shared under the given name across multiple sessions. name: Optional

(self,
               dtype,
               shape=None,
               shared_name=None,
               name="conditional_accumulator",
               reduction_type="MEAN")

Source from the content-addressed store, hash-verified

1261 """
1262
1263 def __init__(self,
1264 dtype,
1265 shape=None,
1266 shared_name=None,
1267 name="conditional_accumulator",
1268 reduction_type="MEAN"):
1269 """Creates a new ConditionalAccumulator.
1270
1271 Args:
1272 dtype: Datatype of the accumulated gradients.
1273 shape: Shape of the accumulated gradients.
1274 shared_name: Optional. If non-empty, this accumulator will be shared under
1275 the given name across multiple sessions.
1276 name: Optional name for the accumulator.
1277 reduction_type: Reduction type to use when taking the gradient.
1278 """
1279 if compat.forward_compatible(2019, 8, 8):
1280 accumulator_ref = gen_data_flow_ops.resource_conditional_accumulator(
1281 dtype=dtype,
1282 shape=shape,
1283 shared_name=shared_name,
1284 name=name,
1285 reduction_type=reduction_type)
1286 if context.executing_eagerly():
1287 self._resource_deleter = resource_variable_ops.EagerResourceDeleter(
1288 handle=accumulator_ref, handle_device=context.context().device_name)
1289 else:
1290 accumulator_ref = gen_data_flow_ops.conditional_accumulator(
1291 dtype=dtype,
1292 shape=shape,
1293 shared_name=shared_name,
1294 name=name,
1295 reduction_type=reduction_type)
1296
1297 super(ConditionalAccumulator, self).__init__(dtype, shape, accumulator_ref)
1298
1299 def apply_grad(self, grad, local_step=0, name=None):
1300 """Attempts to apply a gradient to the accumulator.

Callers

nothing calls this directly

Calls 3

executing_eagerlyMethod · 0.80
contextMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected