def _get_predictive_change_features(self, lr, m, v):
    batch_gradients = []
    for (i, (name, param)) in enumerate(self.model.named_parameters()):
        grad_batch = param.grad_batch.reshape(self.current_batch_size, self.layer_sizes[i])
        batch_gradients.append(grad_batch)
    batch_gradients = torch.cat(batch_gradients, dim=1)
    update_value = self._get_adam_feature(lr, m, v)
    predictive_change = torch.log(torch.var(((- 1) * torch.matmul(batch_gradients, update_value))))
    self.predictiveChangeVarDiscountedAverage = ((self.discount_factor * self.predictiveChangeVarDiscountedAverage) + ((1 - self.discount_factor) * predictive_change))
    self.predictiveChangeVarUncertainty = ((self.discount_factor * self.predictiveChangeVarUncertainty) + ((1 - self.discount_factor) * ((predictive_change - self.predictiveChangeVarDiscountedAverage) ** 2)))
    return (self.predictiveChangeVarDiscountedAverage, self.predictiveChangeVarUncertainty)
def _get_predictive_change_features(self, lr, m, v):
    batch_gradients = []
    for (i, (name, param)) in enumerate(self.model.named_parameters()):
        grad_batch = param.grad_batch.reshape(self.current_batch_size, self.layer_sizes[i])
        batch_gradients.append(grad_batch)
    batch_gradients = torch.cat(batch_gradients, dim=1)
    update_value = self._get_adam_feature(lr, m, v)
    predictive_change = torch.log(torch.var(((- 1) * torch.matmul(batch_gradients, update_value))))
    self.predictiveChangeVarDiscountedAverage = ((self.discount_factor * self.predictiveChangeVarDiscountedAverage) + ((1 - self.discount_factor) * predictive_change))
    self.predictiveChangeVarUncertainty = ((self.discount_factor * self.predictiveChangeVarUncertainty) + ((1 - self.discount_factor) * ((predictive_change - self.predictiveChangeVarDiscountedAverage) ** 2)))
    return (self.predictiveChangeVarDiscountedAverage, self.predictiveChangeVarUncertainty)