code: def logp_partial_gradient(self, variable, calculation_set=None):
          
          if (calculation_set is None) or (self in calculation_set):
  
              if not datatypes.is_continuous(variable):
                  return zeros(shape(variable.value))
  
              if variable is self:
                  try:
                      gradient_func = self._logp_partial_gradients['value']
  
                  except KeyError:
                      raise NotImplementedError(
                          repr(
                              self) +
                          " has no gradient function for 'value'")
  
                  gradient = np.reshape(
                      gradient_func.get(
                      ),
                      np.shape(
                          variable.value))
              else:
                  gradient = builtins.sum(
                      [self._pgradient(variable,
                                       parameter,
                                       value) for parameter,
                       value in six.iteritems(self.parents)])
  
              return gradient
          else:
              return 0
docs: Calculates the partial gradient of the posterior of self with respect to variable.
          Returns zero if self is not in calculation_set.