LoL I have figured it out, my bad tbh. channels needs to be integer and a scalar. The solution is as follows if someone needs it,
test_layer = nn.Conv2d(in_channels=256, out_channels=T_times*(torch.prod(torch.tensor(T, dtype=torch.int)).item()), kernel_size=1)
But this error message tricked me at first when I tried without .item(). Or i did misunderstand it,

test_layer = nn.Conv2d(in_channels=256, out_channels=T_times*(torch.prod(torch.tensor(T, dtype=torch.int))), kernel_size=1)


Traceback (most recent call last):
File “/Applications/PyCharm.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_exec2.py”, line 3, in Exec
exec(exp, global_vars, local_vars)
File “”, line 1, in 
File “/Users/barisozcan/.virtualenvs/CapsuleNetworks/lib/python3.7/site-packages/torch/nn/modules/conv.py”, line 315, in init
False, _pair(0), groups, bias)
File “/Users/barisozcan/.virtualenvs/CapsuleNetworks/lib/python3.7/site-packages/torch/nn/modules/conv.py”, line 40, in init
self.bias = Parameter(torch.Tensor(out_channels))
TypeError: expected torch.FloatTensor (got torch.LongTensor)

I am not an expert but as an end user, I would prefer something indicating about float/int issue or tensor input.
Thank you for the insight !