更新device参数替换方式

This commit is contained in:
shibo19
2022-05-25 11:16:35 +08:00
parent c742413a3c
commit 0f3e3fcabe
3 changed files with 29 additions and 58 deletions
+1 -3
View File
@@ -1221,9 +1221,7 @@ def dispatch_lambda_exprs(
f'{f.func}: incomplete tensor options args: {tensor_options_args_names}')
inits.append(f'''\
_r.args[{arg_parser_outputs['device'].index}] = npu_device_prase(_r.args[{arg_parser_outputs['device'].index}]);
auto local_device = {arg_parser_outputs['device'].expr};
auto device = local_device.is_cuda() ? c10::Device(at_npu::key::NativeDeviceType, local_device.index()) : local_device;
auto device = npu_device_prase(_r.args[{arg_parser_outputs['device'].index}]);
const auto options = TensorOptions()
.dtype({arg_parser_outputs['dtype'].expr})
.device(device)