How to merge by avg multiple inputs to layer?

I try to apt the merge(mode=‘avg’) of keras. What is the torch way of doing this? I try to sum and divide by the count but it raises RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation

 def forward(self, inputs):
            outputs = []
            for x in inputs:
                x = self.conv_column(x)
                x = self.clf_layer(x)
                # avg all outputs here !
            return outputs followed by torch.mean over the dimension to merge.

1 Like