The equivalent of mm_out is torch.mm(..., out=...).
So is  the following correct? You have
x = x.view(70, 20, 1, 1, 1024)
g = g.view(70, 20, 96, 1, 1)
w = w.view(1, 1, 96, 16, 1024)

and want to conceptually compute
(x*g*w).sum(-1)

In this case, you might take a look at how F.bilinear is implemented (in Linear.cpp) - using a for lover the 96 entries. This avoids instantiating a too-large tensor.
One easy way to do something like this is to do
res = torch.empty(70, 20, 96, 16)
for i in range(96):
    res[:,:, i] = (x[:,:,0]*g[:,:,i]*w[:,:,i]).sum(-1)

Quite likely, the backward isn’t 100% efficient and you might use matmul instead of summing, but is should give you a reasonable performance.
For a small additional speedup, you can use matmul.
Viele Grüße
Thomas