def unbox_array(self, boxed_array, elt_type, ndims, target = "array_value"):
    shape_ptr = self.fresh_var("npy_intp*", "shape_ptr", "PyArray_DIMS((PyArrayObject*)%s)" % boxed_array)
    strides_bytes = self.fresh_var("npy_intp*", "strides_bytes", 
                                   "PyArray_STRIDES( (PyArrayObject*) %s)" % boxed_array)

    #strides_elts = self.fresh_name("strides_elts")
    #self.append("npy_intp %s[%d];" % (strides_elts, ndims))
    bytes_per_elt = elt_type.dtype.itemsize 
    typename = self.array_struct_type(elt_type, ndims)
    result = self.fresh_var(typename, "unboxed_array")
    ptr = self.get_boxed_array_ptr(boxed_array, ptr_type(elt_type))
    self.setfield(result, 'data', ptr)
    for i in xrange(ndims):
      if config.debug:
        self.printf("converting strides %s[%d] = %%ld to %%ld" % (strides_bytes, i), 
                    "%s[%d]" % (strides_bytes, i), "%s[%d] / %d" % (strides_bytes, i, bytes_per_elt))   
      self.setidx("%s.strides" % result, i, "%s[%d] / %d" % (strides_bytes, i, bytes_per_elt))
      self.setidx("%s.shape" % result, i, "%s[%d]" % (shape_ptr, i))
    self.setfield(result, "offset", "0")
    self.setfield(result, "size", "PyArray_Size(%s)" % boxed_array)
    return result
dataset/ETHPy150Open iskandr/parakeet/parakeet/c_backend/pymodule_compiler.py/PyModuleCompiler.unbox_array/original