diff --git a/src/parser/tokenizer.h b/src/parser/tokenizer.h index e26c97429d6b..d7b3b3f6f681 100644 --- a/src/parser/tokenizer.h +++ b/src/parser/tokenizer.h @@ -62,7 +62,9 @@ bool IsNumeric(char c) { !IsWhitespace(c); } -bool IsIdentLetter(char c) { return '_' == c || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'); } +bool IsIdentLetter(char c) { + return '_' == c || c == '/' || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'); +} bool IsIdent(char c) { return IsIdentLetter(c) || IsDigit(c); } diff --git a/tests/python/relay/test_ir_text_printer.py b/tests/python/relay/test_ir_text_printer.py index af3c737fccd6..2834bba9248b 100644 --- a/tests/python/relay/test_ir_text_printer.py +++ b/tests/python/relay/test_ir_text_printer.py @@ -284,5 +284,14 @@ def test_optional_info(): assert txt.count("/* ty=int32 */") == 3 +def test_slash_in_identifier(): + x = relay.var("base/x") + y = relay.var("base/y") + z = x + y + txt = astext(z) + assert "base/x" in txt + assert "base/y" in txt + + if __name__ == "__main__": pytest.main([__file__])