@@ -526,24 +526,37 @@ bool VerifyConverterSupportForBlock(const torch::jit::Block* b, bool suppress_er
526
526
unsupported_msg << " https://www.github.com/nvidia/Torch-TensorRT/issues" << std::endl;
527
527
unsupported_msg << std::endl << " In Module:" << std::endl;
528
528
529
- if (suppress_errors) {
529
+ if (! suppress_errors) {
530
530
LOG_ERROR (unsupported_msg.str ());
531
531
}
532
532
533
+ std::unordered_map<std::string, std::unordered_set<std::string>> unsupported_node_locations;
533
534
for (const auto n : b->nodes ()) {
534
535
auto schema = n->maybeSchema ();
535
536
if (schema) {
536
537
for (const auto & x : unsupported_ops) {
537
538
if (x.first == schema->operator_name ()) {
538
- if (suppress_errors) {
539
- LOG_ERROR (
540
- " Unsupported operator: " << *schema << std::endl
541
- << torch_tensorrt::core::util::GetPyTorchSourceCode (n) << std::endl);
539
+ auto loc = unsupported_node_locations.find (x.second );
540
+ if (loc == unsupported_node_locations.end ()) {
541
+ unsupported_node_locations.insert ({x.second , {torch_tensorrt::core::util::GetPyTorchSourceCode (n)}});
542
+ } else {
543
+ loc->second .insert (torch_tensorrt::core::util::GetPyTorchSourceCode (n));
542
544
}
543
545
}
544
546
}
545
547
}
546
548
}
549
+
550
+ for (const auto & type : unsupported_node_locations) {
551
+ std::stringstream traceback;
552
+ traceback << " Unsupported operator: " << type.first << std::endl;
553
+ for (const auto & str : type.second ) {
554
+ traceback << str;
555
+ }
556
+ auto tb_str = traceback.str ();
557
+ LOG_ERROR (tb_str);
558
+ }
559
+
547
560
return false ;
548
561
}
549
562
@@ -555,7 +568,7 @@ bool VerifyConverterSupportForBlock(const torch::jit::Block* b, bool suppress_er
555
568
unsupported_msg
556
569
<< " This may be because there are no operators that can be added to the TensorRT graph or all operators have a resolved compile time value."
557
570
<< std::endl;
558
- if (suppress_errors) {
571
+ if (! suppress_errors) {
559
572
LOG_ERROR (unsupported_msg.str ());
560
573
}
561
574
return false ;
0 commit comments