forked from mindspore-Ecosystem/mindspore
!26989 change tensor.virtual_flag and parameter.is_init interfaces to inner api
Merge pull request !26989 from liutongtong9/api_change_ma
This commit is contained in:
commit
8623310442
|
@ -183,7 +183,7 @@ class Parameter(Tensor_):
|
|||
# this flag for tensor copy data.
|
||||
self.init_flag = False
|
||||
# this flag is for ge variable copy data.
|
||||
self._is_init = False
|
||||
self.is_init = False
|
||||
self._inited_param = None
|
||||
self._sliced = False
|
||||
self.is_param_ps = False
|
||||
|
@ -394,25 +394,6 @@ class Parameter(Tensor_):
|
|||
def unique(self, unique_):
|
||||
self._unique = unique_
|
||||
|
||||
@property
|
||||
def is_init(self):
|
||||
"""
|
||||
Get the initialization status of the parameter.
|
||||
|
||||
This flag only work in GE, and it will be set to False in other backend.
|
||||
"""
|
||||
return self._is_init
|
||||
|
||||
@is_init.setter
|
||||
def is_init(self, is_init_):
|
||||
"""
|
||||
Set init status of the parameter.
|
||||
|
||||
Args:
|
||||
is_init_ (bool): The init status of the parameter.
|
||||
"""
|
||||
self._is_init = is_init_
|
||||
|
||||
def clone(self, init='same'):
|
||||
"""
|
||||
Clone the parameter.
|
||||
|
|
|
@ -143,7 +143,7 @@ class Tensor(Tensor_):
|
|||
else:
|
||||
Tensor_.__init__(self, dtype, shape)
|
||||
|
||||
self._virtual_flag = False
|
||||
self.virtual_flag = False
|
||||
self.init = init
|
||||
self.init_finished = True
|
||||
|
||||
|
@ -163,7 +163,7 @@ class Tensor(Tensor_):
|
|||
def __deepcopy__(self, memodict):
|
||||
new_obj = Tensor(self)
|
||||
new_obj.init = self.init
|
||||
new_obj._virtual_flag = self._virtual_flag # pylint:disable=w0212
|
||||
new_obj.virtual_flag = self.virtual_flag
|
||||
return new_obj
|
||||
|
||||
def __repr__(self):
|
||||
|
@ -366,18 +366,6 @@ class Tensor(Tensor_):
|
|||
"""Return the transposed tensor."""
|
||||
return self.transpose()
|
||||
|
||||
@property
|
||||
def virtual_flag(self):
|
||||
"""Used to mark whether the tensor is virtual. If the tensor is virtual, return True."""
|
||||
return self._virtual_flag
|
||||
|
||||
@virtual_flag.setter
|
||||
def virtual_flag(self, value):
|
||||
"""The setter of virtual_flag."""
|
||||
if not isinstance(value, bool):
|
||||
raise TypeError("virtual_flag must be bool.")
|
||||
self._virtual_flag = value
|
||||
|
||||
@staticmethod
|
||||
def from_numpy(array):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue