(x, weights)
return weights.unsqueeze(1).bmm(x).squeeze(1)
x = batch * len * d
    weights = batch * len
x = batch * len * d
    weights = batch * len
x = batch * len * d weights = batch * len
def weighted_avg(x, weights):
    """x = batch * len * d
    weights = batch * len
    """
    return weights.unsqueeze(1).bmm(x).squeeze(1)
def weighted_avg ( x , weights ) : return weights . unsqueeze ( 1 ) . bmm ( x ) . squeeze ( 1 )