Symbol ''for loop''

#1

How can I do something similar to following code using mxnet symbol:

y = mx.sym.var('y')
x = mx.sym.var('x')
output = 1.0
for i in range(y):
    if i > 1 and i < 5:
        output = output * x
#2

You could use the foreach operator that allows to run a for-loop over symbols. The operator is part of the contrib package: https://mxnet.incubator.apache.org/api/python/symbol/contrib.html#mxnet.symbol.contrib.foreach

#3

Could you plz provide the code that can do what I want?