🚀 Feature
nn.Unflatten 's unflattened_size requires a tuple -- trying to create on using a list fails with:
>>> nn.Unflatten(1, [5, 5])
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-b881e5cda02d> in <module>
----> 1 nn.Unflatten(1, [5, 5])
/opt/anaconda/envs/ctrldev/lib/python3.6/site-packages/torch/nn/modules/flatten.py in __init__(self, dim, unflattened_size)
102
103 if isinstance(dim, int):
--> 104 self._require_tuple_int(unflattened_size)
105 elif isinstance(dim, str):
106 self._require_tuple_tuple(unflattened_size)
/opt/anaconda/envs/ctrldev/lib/python3.6/site-packages/torch/nn/modules/flatten.py in _require_tuple_int(self, input)
128 "but found element of type {} at pos {}".format(type(elem).__name__, idx))
129 return
--> 130 raise TypeError("unflattened_size must be a tuple of ints, but found type {}".format(type(input).__name__))
131
132 def forward(self, input: Tensor) -> Tensor:
TypeError: unflattened_size must be a tuple of ints, but found type list
I think this is a little too restrictive -- is there any reason we couldn't accept an arbitrary Sequence instead of specificlaly a tuple? If necessary, it should be easy to convert them to tuples in the constructor.
cc @albanD @mruberry @jbschlosser
🚀 Feature
nn.Unflatten'sunflattened_sizerequires a tuple -- trying to create on using a list fails with:I think this is a little too restrictive -- is there any reason we couldn't accept an arbitrary
Sequenceinstead of specificlaly a tuple? If necessary, it should be easy to convert them totuples in the constructor.cc @albanD @mruberry @jbschlosser