Allow ntuple to be used with string values

pull/1420/head
Ross Wightman 2 years ago
parent 7430a85d07
commit 8ad4bdfa06

@ -9,7 +9,7 @@ import collections.abc
# From PyTorch internals
def _ntuple(n):
def parse(x):
if isinstance(x, collections.abc.Iterable):
if isinstance(x, collections.abc.Iterable) and not isinstance(x, str):
return x
return tuple(repeat(x, n))
return parse

Loading…
Cancel
Save