field += be.broadcast(self.int_params.loc, field)
self.ext_params = IsingLayer.IntrinsicParams(field)
def derivatives(self, vis, hid, weights, beta=None):
Compute the derivatives of the intrinsic layer parameters.
Args:
vis (tensor (num_samples, num_units)):
The values of the visible units.
hid list[tensor (num_samples, num_connected_units)]:
The rescaled values of the hidden units.
weights list[tensor, (num_units, num_connected_units)]:
The weights connecting the layers.
beta (tensor (num_samples, 1), optional):
Inverse temperatures.
Returns:
grad (namedtuple): param_name: tensor (contains gradient)
loc = -be.mean(vis, axis=0)
loc = self.get_penalty_grad(loc, "loc")return IsingLayer.IntrinsicParams(loc)
def rescale(self, observations):
Rescale is equivalent to the identity function for the Ising layer.