Keras MXNet - Causal Convolution

Im playing around with keras mxnet - and I tried this. Let me know if it helps/is right:

class CausalConv1D(AtrousConvolution1D):
    def get_output_shape_for(self, input_shape):
        dim = conv_output_length(input_shape[1] + self.atrous_rate * (self.filter_length - 1),
                                    self.filter_length,
                                    self.border_mode,
                                    self.subsample[0],
                                    dilation=self.atrous_rate)

        return (input_shape[0], dim, self.nb_filter)

    def call(self, x, mask=None):
        x = K.asymmetric_temporal_padding(x, self.atrous_rate * (self.filter_length - 1), 0)
        return super(CausalConv1D, self).call(x, mask)

@skm Might be of some use?

1 Like

Thank you this will be super useful. Will get back with correctness. Thanks @dmadeka