forked from mindspore-Ecosystem/mindspore
!19490 fix python parameter del coredump if raise an error before init finished
Merge pull request !19490 from huanghui/fix-parameter
This commit is contained in:
commit
3a408218ec
|
@ -136,6 +136,7 @@ class Parameter(Tensor_):
|
|||
|
||||
def __init__(self, default_input, name=None, requires_grad=True, layerwise_parallel=False, parallel_optimizer=True):
|
||||
self.param_info = ParamInfo()
|
||||
self.init_param_info = True
|
||||
self.init_in_server = False
|
||||
self.cache_enable = False
|
||||
self.name = name
|
||||
|
@ -581,8 +582,9 @@ class Parameter(Tensor_):
|
|||
return obj
|
||||
|
||||
def __del__(self):
|
||||
if context.get_context("mode") == context.GRAPH_MODE:
|
||||
self.param_info = None
|
||||
if hasattr(self, "init_param_info"):
|
||||
if self.init_param_info is True and context.get_context("mode") == context.GRAPH_MODE:
|
||||
self.param_info = None
|
||||
|
||||
|
||||
class ParameterTuple(tuple):
|
||||
|
|
Loading…
Reference in New Issue