How to programmatically use 'mx.symbol.concat' for many variables?


Hi Guys,

I know the following code worked fine:

a = Variable('a')
b = Variable('b')
c = mx.symbol.concat(a, b, dim=1)

My question is:

How can I use mx.symbol.concat if I had many variables? I have tried to put them into a list but doesn’t seem to work. The following logic doesn’t work for me:

variables = []
for ii in range(100):

c = mx.symbol.concat(variables, dim=1)

I also tried:

c = mx.symbol.concat(tuple(variables), dim=1), not working either

Found the answer:
c = mx.symbol.concat(*variables, dim=1) worked


Yes it takes the input as individual arguments.
Putting the solution here for visibility:
c = mx.symbol.concat(*variables, dim=1)