From 8ad4bdfa06022fbefefec19d15de2bd7bcd31a8e Mon Sep 17 00:00:00 2001 From: Ross Wightman Date: Thu, 28 Jul 2022 16:18:18 -0700 Subject: [PATCH] Allow ntuple to be used with string values --- timm/models/layers/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/timm/models/layers/helpers.py b/timm/models/layers/helpers.py index cc54ca7f..4a10ca0c 100644 --- a/timm/models/layers/helpers.py +++ b/timm/models/layers/helpers.py @@ -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