parameters: (shape)
return_statement: return offsets
docstring: Returns moving offset for each dimension given shape.
docstring_summary: Returns moving offset for each dimension given shape.
docstring_tokens: Returns moving offset for each dimension given shape .
function: def _shape_offsets(shape):
    """Returns moving offset for each dimension given shape."""
    offsets = []
    for dim in reversed(shape):
      if offsets:
        offsets.append(dim * offsets[-1])
      else:
        offsets.append(dim)
    offsets.reverse()
    return offsets
function_tokens: def _shape_offsets ( shape ) : offsets = [ ] for dim in reversed ( shape ) : if offsets : offsets . append ( dim * offsets [ - 1 ] ) else : offsets . append ( dim ) offsets . reverse ( ) return offsets