How to implement gating?

I am reading Rethinking Spatiotemporal Feature Learning paper and would like to implement some part of it.
in the paper they have this gating thing which is defined as:

where X in image .
i know how to use the sigma or elementwise product, but im not sure how to do
for 2D or 3D tensor?
can someone please explain to me how to do it in code?
I think if x is 1D i should use nn.linear, but for 2D and 3D i dont know.

I think you are looking for this?

Thanks for your reply!
hmmm they are using the convolution version, I am not 100% sure if this is exactly the same :thinking:

any suggestion regarding this question?