Pushed Variable.from_proto implementation to RefVariable
It was not generic enough to be in the base class. PiperOrigin-RevId: 222966856
This commit is contained in:
parent
e4efa68f3c
commit
5bb5d6db8a
tensorflow/python/ops
@ -1433,7 +1433,7 @@ def _from_proto_fn(v, import_scope=None):
|
||||
"""Creates Variable or ResourceVariable from VariableDef as needed."""
|
||||
if v.is_resource:
|
||||
return ResourceVariable.from_proto(v, import_scope=import_scope)
|
||||
return variables.Variable.from_proto(v, import_scope=import_scope)
|
||||
return variables.RefVariable.from_proto(v, import_scope=import_scope)
|
||||
|
||||
|
||||
ops.register_proto_function(
|
||||
|
@ -968,8 +968,7 @@ class Variable(six.with_metaclass(VariableMetaclass,
|
||||
@staticmethod
|
||||
def from_proto(variable_def, import_scope=None):
|
||||
"""Returns a `Variable` object created from `variable_def`."""
|
||||
return RefVariable(variable_def=variable_def,
|
||||
import_scope=import_scope)
|
||||
raise NotImplementedError
|
||||
|
||||
class SaveSliceInfo(object):
|
||||
"""Information on how to save this Variable as a slice.
|
||||
@ -2344,6 +2343,12 @@ class RefVariable(VariableV1):
|
||||
else:
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def from_proto(variable_def, import_scope=None):
|
||||
"""Returns a `Variable` object created from `variable_def`."""
|
||||
return RefVariable(variable_def=variable_def,
|
||||
import_scope=import_scope)
|
||||
|
||||
def __iadd__(self, other):
|
||||
logging.log_first_n(
|
||||
logging.WARN,
|
||||
|
Loading…
Reference in New Issue
Block a user