@@ -183,24 +183,24 @@ def empty(*size, dtype=None, device=None, requires_grad=False, pin_memory=False,
183
183
if dtype is None :
184
184
dtype = get_default_dtype ()
185
185
186
- if device :
187
- if not isinstance (device , str ) and hasattr (device , "type" ):
188
- device = device .type
189
- if device .lower () == 'cpu' :
190
- device = 'CPU'
191
- elif device .lower () == 'npu' :
192
- device = 'Ascend'
193
- elif device .lower () == 'cuda' :
194
- device = 'GPU'
195
- else :
196
- device = 'meta'
197
-
198
- # To avoid the problem in irecv and recv of using empty.
199
- if device not in ['meta' , 'GPU' ]:
200
- out = mindspore .mint .empty (size , dtype = dtype , device = device )
201
- else :
202
- out = CTensor (dtype = dtype , shape = size )
203
- out = mindspore .Tensor (out )
186
+ # if device:
187
+ # if not isinstance(device, str) and hasattr(device, "type"):
188
+ # device = device.type
189
+ # if device.lower() == 'cpu':
190
+ # device = 'CPU'
191
+ # elif device.lower() == 'npu':
192
+ # device = 'Ascend'
193
+ # elif device.lower() == 'cuda':
194
+ # device = 'GPU'
195
+ # else:
196
+ # device = 'meta'
197
+
198
+ # # To avoid the problem in irecv and recv of using empty.
199
+ # if device not in ['meta', 'GPU']:
200
+ # out = mindspore.mint.empty(size, dtype=dtype, device=device)
201
+ # else:
202
+ out = CTensor (dtype = dtype , shape = size )
203
+ out = mindspore .Tensor (out )
204
204
# else:
205
205
# out = np.empty(size, dtype=dtype2np[dtype])
206
206
# out = mindspore.Tensor(out)
0 commit comments