The processor of v.
(v)
| 237 | |
| 238 | |
| 239 | def _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"]) |
no test coverage detected