Skip to content

Commit 3789759

Browse files
committed
update name
1 parent 37806b9 commit 3789759

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

python/paddle/__init__.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,26 +97,30 @@
9797
else:
9898
Tensor = framework.core.eager.Tensor
9999
Tensor.__qualname__ = 'Tensor'
100-
super_init = Tensor.__init__
100+
original_init = Tensor.__init__
101101

102102
def new_init(self, *args, **kwargs):
103103
try:
104-
super_init(self, *args, **kwargs)
104+
original_init(self, *args, **kwargs)
105105
except Exception as e:
106106
default_dtype = kwargs.get("dtype", "float32")
107107
if len(args) == 0:
108-
super_init(self, paddle.empty(shape=[0], dtype=default_dtype))
108+
original_init(
109+
self, paddle.empty(shape=[0], dtype=default_dtype)
110+
)
109111
return
110112
elif len(args) == 1 and isinstance(args[0], (list, tuple)):
111-
super_init(self, paddle.tensor(args[0], dtype=default_dtype))
113+
original_init(self, paddle.tensor(args[0], dtype=default_dtype))
112114
return
113115
is_all_int = True
114116
for arg in args:
115117
if not isinstance(arg, int):
116118
is_all_int = False
117119
break
118120
if is_all_int:
119-
super_init(self, paddle.empty(list(args), dtype=default_dtype))
121+
original_init(
122+
self, paddle.empty(list(args), dtype=default_dtype)
123+
)
120124
return
121125
raise ValueError(e)
122126

0 commit comments

Comments
 (0)