Make it possible to comment out lines with hash in expressions

This commit is contained in:
blepping
2025-05-19 02:29:14 -06:00
parent 6fc85f55f9
commit 6005b4208a
2 changed files with 5 additions and 1 deletions
+5
View File
@@ -97,6 +97,11 @@ class Expression:
@classmethod
def tokenize(cls, s):
s = "\n".join(
line.rstrip("\r")
for line in s.split("\n")
if not line.lstrip().startswith("#")
)
yield from (cls.fixup_token(m.group(1)) for m in cls.EXPR_RE.finditer(s))
-1
View File
@@ -159,7 +159,6 @@ class NewLikeHandler(NormHandler):
def handle(self, obj, getter):
tensor, values = self.safe_get_all(obj, getter)
print(f"\nNEW TENSOR: {values}")
return torch.tensor(values, dtype=tensor.dtype, device=tensor.device)