self.samples.append(sample)
self.samples_uncontrolled = [s for s in self._samples_all if (not s.control) and (not s.observed)]
self.samples_observed = [s for s in self._samples_all if s.observed]
self.log_prob_observed = util.to_variable(sum([util.safe_torch_sum(s.log_prob) for s in self.samples_observed])).view(-1)
self.log_prob = util.to_variable(sum([util.safe_torch_sum(s.log_prob) for s in self._samples_all if s.control or s.observed])).view(-1)
self.length = len(self.samples)
After Change
self.variables_observed = [v for v in self.variables if v.observed]
self.variables_observable = [v for v in self.variables if v.observable]
self.log_prob = sum([torch.sum(v.log_prob) for v in self.variables if v.control or v.observed])
self.log_prob_observed = sum([torch.sum(v.log_prob) for v in self.variables_observed])
self.length = len(self.variables)
self.length_controlled = len(self.variables_controlled)