File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -485,9 +485,15 @@ void OperatorWithKernel::Run(const Scope& scope,
485
485
// }
486
486
487
487
auto expected_kernel_key = this ->GetExpectedKernelType (ctx);
488
-
489
488
VLOG (3 ) << " expected_kernel_key:" << expected_kernel_key;
490
489
490
+ auto kernel_iter = kernels.find (expected_kernel_key);
491
+ if (kernel_iter == kernels.end ()) {
492
+ PADDLE_THROW (" op %s does not have kernel for %s" , type_,
493
+ KernelTypeToString (expected_kernel_key));
494
+ }
495
+
496
+ // do data transform
491
497
Scope& new_scope = scope.NewScope ();
492
498
493
499
for (auto & var_name_item : this ->Inputs ()) {
@@ -520,8 +526,6 @@ void OperatorWithKernel::Run(const Scope& scope,
520
526
}
521
527
}
522
528
523
- auto kernel_iter = kernels.find (expected_kernel_key);
524
-
525
529
auto * new_dev_ctx = pool.Get (expected_kernel_key.place_ );
526
530
kernel_iter->second ->Compute (
527
531
ExecutionContext (*this , new_scope, *new_dev_ctx));
You can’t perform that action at this time.
0 commit comments