Skip to content

Commit 7a0a479

Browse files
committed
refactor(//core/conversion): Seperate out special op cases
Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
1 parent 6552f10 commit 7a0a479

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

core/conversion/conversion.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ namespace conversion {
2020
bool isNodeConversionIgnored(const torch::jit::Node* n);
2121

2222
bool OpSupported(const torch::jit::Node* n) {
23-
return evaluators::shouldEvalAtConversionTime(n) || converters::node_is_convertable(n) ||
24-
n->kind() == torch::jit::prim::Loop || n->kind() == torch::jit::prim::If;
23+
return evaluators::shouldEvalAtConversionTime(n) || converters::node_is_convertable(n);
24+
}
25+
26+
bool SpecialCaseSupport(const torch::jit::Node* n) {
27+
return n->kind() == torch::jit::prim::Loop || n->kind() == torch::jit::prim::If;
2528
}
2629

2730
c10::optional<torch::jit::IValue> EvaluateNode(ConversionCtx* ctx, const torch::jit::Node* n, int level, int limit) {
@@ -500,7 +503,7 @@ std::unordered_map<c10::OperatorName, std::string> GetUnsupportedOpsInBlock(cons
500503
auto schema = n->maybeSchema();
501504
// Some ops like torch::jit::prim::Loop, torch::jit::prim::If, torch::jit::prim::DictConstruct don't have a schema
502505
// but they are supported. torch::jit::prim::DictConstruct is supported via fallback only
503-
if (!OpSupported(n)) {
506+
if (!OpSupported(n) && !SpecialCaseSupport(n)) {
504507
if (schema) {
505508
std::stringstream ss;
506509
ss << *schema;

0 commit comments

Comments
 (0)