code: def mean(l, ignore_nan=False, empty=0):
      """
      nanmean compatible with generators.
      """
      l = iter(l)
      if ignore_nan:
          l = ifilterfalse(isnan, l)
      try:
          n = 1
          acc = next(l)
      except StopIteration:
          if empty == "raise":
              raise ValueError("Empty mean")
          return empty
      for n, v in enumerate(l, 2):
          acc += v
      if n == 1:
          return acc
      return acc / n
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import torch
  import torch.nn.functional
  from torch import nn
  from torch.autograd import Variable
label_desc: Use image node_id 13 for calling a global function with example usage: mean(l, ignore_nan, empty) and returns: unknown, acc, empty