code: def _ring_2d(m, n):
    
    if m == 1:
      return [(0, i) for i in range(n)]
    if n == 1:
      return [(i, 0) for i in range(m)]
    if m % 2 != 0:
      tf.logging.warning("Odd dimension")
      return [(i % m, i // m) for i in range(n * m)]
    ret = [(0, 0)]
    for i in range(m // 2):
      for j in range(1, n):
        ret.append((2 * i, j))
      for j in range(n-1, 0, -1):
        ret.append((2 * i + 1, j))
    for i in range(m-1, 0, -1):
      ret.append((i, 0))
    return ret
docs: Ring-order of a mxn mesh.
  
    Args:
      m: an integer
      n: an integer
    Returns:
      a list of mxn pairs