def h_to_v(h, W, v_bias): p_v = torch.sigmoid(F.linear(h,W.t(),v_bias)) v = torch.bernoulli(p_v) return p_v,v