I am trying to implement a multi-agent decentralized execution algorithm in Keras. Each agent is supposed to observe only a part of the observation vector. To this end, I am using concatenate to pick up certain elements from the vector and combine them as an input vector to a certain agent. Here x2 is the global observation vector
for i in range(nagents):
x2 = concatenate(inputs = [x2[:,i*5:(i*5+5)],x2[:,i+50:i+51],x2[:,60:61]])
vars()['inp_p%d'%i]=x2
vars()['x_p%d'%i]= Dense(20, activation='relu')(vars()['inp_p%d'%i])
vars()['x_p%d'%i]= Dense(20, activation='relu')(vars()['x_p%d'%i])
vars()['out_p%d'%i] = Dense(2,activation = 'softmax')(vars()['x_p%d'%i])
out = list(np.zeros(ncomp))
for i in range(ncomp):
out[i] = vars()['out_p%d'%i]
However, I get the following error:
--> 234 vars()['x_p%d'%i]= Dense(20, activation='relu')(vars()['inp_p%d'%i])
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
It works when we use the whole x2 vector as an input.