def _insert_axis_in_strides(context, builder, orig_strides, ndim, axis):
 assert (len(orig_strides) == (ndim - 1))
 ll_shty = ir.ArrayType(cgutils.intp_t, ndim)
 strides = cgutils.alloca_once(builder, ll_shty)
 one = cgutils.intp_t(1)
 zero = cgutils.intp_t(0)
 for dim in range((ndim - 1)):
  ll_dim = cgutils.intp_t(dim)
  after_axis = builder.icmp_signed('>=', ll_dim, axis)
  idx = builder.select(after_axis, builder.add(ll_dim, one), ll_dim)
  builder.store(orig_strides[dim], cgutils.gep_inbounds(builder, strides, 0, idx))
 builder.store(zero, cgutils.gep_inbounds(builder, strides, 0, axis))
 return cgutils.unpack_tuple(builder, builder.load(strides))

def _insert_axis_in_strides ( context , builder , orig_strides , ndim , axis ) : assert ( len ( orig_strides ) == ( ndim - 1 ) ) ll_shty = ir . ArrayType ( cgutils . intp_t , ndim ) strides = cgutils . alloca_once ( builder , ll_shty ) one = cgutils . intp_t ( 1 ) zero = cgutils . intp_t ( 0 ) for dim in range ( ( ndim - 1 ) ) : ll_dim = cgutils . intp_t ( dim ) after_axis = builder . icmp_signed ( '>=' , ll_dim , axis ) idx = builder . select ( after_axis , builder . add ( ll_dim , one ) , ll_dim ) builder . store ( orig_strides [ dim ] , cgutils . gep_inbounds ( builder , strides , 0 , idx ) ) builder . store ( zero , cgutils . gep_inbounds ( builder , strides , 0 , axis ) ) return cgutils . unpack_tuple ( builder , builder . load ( strides ) )
same as _insert_axis_in_shape() .