class_docstr: Likes :class:`WelfordCovariance` but generalized to the arrowhead structure.
class_docstr_tok: ["Likes",":","class",":","`","WelfordCovariance","`","but","generalized","to","the","arrowhead","structure","."]
code: def update(self, sample):
      self.n_samples += 1
      delta_pre = sample - self._mean
      self._mean = self._mean + delta_pre / self.n_samples
      delta_post = sample - self._mean
      if self.head_size > 0:
          self._m2_top = self._m2_top + torch.ger(
              delta_post[: self.head_size], delta_pre
          )
      else:
          self._m2_top = sample.new_empty(0, sample.size(0))
      self._m2_bottom_diag = (
          self._m2_bottom_diag
          + delta_post[self.head_size :] * delta_pre[self.head_size :]
      )
  
file_path: pyro/pyro/ops/welford.py
imports: import torch
label_desc: Use image node_id 3 for calling the WelfordArrowheadCovariance obj's underlying member method code with example usage: obj.update(sample) without return types