def array_view(self, data, shape, strides, offset, nelts):
    """Helper function used by multiple array-related transformations"""

    data = self.assign_name(self.transform_expr(data), "data_ptr")
    data_t = data.type
    assert isinstance(data_t, PtrT), \
        "Data field of array must be a pointer, got %s" % data_t

    shape = self.assign_name(self.transform_expr(shape), "shape")
    shape_t = shape.type
    assert isinstance(shape_t, TupleT), \
        "Shape of array must be a tuple, got: %s" % shape_t

    strides = self.assign_name(self.transform_expr(strides), "strides")
    strides_t = strides.type
    assert isinstance(strides_t, TupleT), \
        "Strides of array must be a tuple, got: %s" % strides_t

    rank = len(shape_t.elt_types)
    strides_rank = len(strides_t.elt_types)
    assert rank == strides_rank, \
        "Shape and strides must be of same length, but got %d and %d" % \
        (rank, strides_rank)
    array_t = make_array_type(data_t.elt_type, rank)
    return Struct([data, shape, strides, offset, nelts], type = array_t)
dataset/ETHPy150Open iskandr/parakeet/parakeet/transforms/lower_structs.py/LowerStructs.array_view/original