Fixing suggestions from cupy group.
@@ -314,13 +314,16 @@ def _get_output(output, input, shape=None):
def _fix_sequence_arg(arg, ndim, name, conv=lambda x: x):
- if hasattr(arg, '__iter__') and not isinstance(arg, str):
+ if isinstance(arg, str):
+ return [conv(arg)] * ndim
+ try:
+ arg = iter(arg)
+ except TypeError:
+ return [conv(arg)] * ndim
lst = [conv(x) for x in arg]
if len(lst) != ndim:
msg = "{} must have length equal to input rank".format(name)
raise RuntimeError(msg)
- else:
- lst = [conv(arg)] * ndim
return lst
