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

Function _get_processor

tensorflow/python/training/optimizer.py:239–263  ·  view source on GitHub ↗

The processor of v.

(v)

Source from the content-addressed store, hash-verified

237
238
239def _get_processor(v):
240 """The processor of v."""
241 from tensorflow.python.ops import hash_table
242 if context.executing_eagerly():
243 if isinstance(v, ops.Tensor):
244 return _TensorProcessor(v)
245 else:
246 return _DenseResourceVariableProcessor(v)
247 if resource_variable_ops.is_resource_variable(v) and not v._in_graph_mode: # pylint: disable=protected-access
248 # True if and only if `v` was initialized eagerly.
249 return _DenseResourceVariableProcessor(v)
250 if isinstance(v, hash_table.HashTable):
251 return _HashTableProcessor(v)
252 if v.op.type == "VarHandleOp":
253 return _DenseResourceVariableProcessor(v)
254 if v.op.type == "KvVarHandleOp":
255 from tensorflow.core.framework import attr_value_pb2
256 from tensorflow.core.framework.embedding import config_pb2
257 slot_creator._set_init_op_embedding_type_attr(v, config_pb2.EmbeddingVariableType.MUTABLE)
258 return _DenseResourceVariableProcessor(v)
259 if isinstance(v, variables.Variable):
260 return _RefVariableProcessor(v)
261 if isinstance(v, ops.Tensor):
262 return _TensorProcessor(v)
263 raise NotImplementedError("Trying to optimize unsupported type ", v)
264
265
266@tf_export(v1=["train.Optimizer"])

Callers 3

compute_gradientsMethod · 0.70
apply_fnMethod · 0.70
updateMethod · 0.70

Calls 5

_HashTableProcessorClass · 0.85
executing_eagerlyMethod · 0.80
_TensorProcessorClass · 0.70

Tested by

no test coverage detected