Is there a function similar to HybridConcurrent but with different input



I read the document about the HybridConcurrent and find it is very useful when deal with concatenation, e.g. in DenseNet.

However, HybridConcurrent is used to deal with only one input, I wonder is there a similar function can deal with different inputs?


Hi @Alpha,

You could combine and split the input, but I think it should be simple enough to adjust for multiple inputs like so (see x, y, z instead of just x as before):

class ModifiedHybridConcurrent(HybridSequential):
    def __init__(self, axis=-1, prefix=None, params=None):
        super(ModifiedHybridConcurrent, self).__init__(prefix=prefix, params=params)
        self.axis = axis

    def hybrid_forward(self, F, x, y, z):
        out = []
        for block in self._children.values():
            out.append(block(x, y, z))
        out = F.concat(*out, dim=self.axis)
        return out