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

def _insert_axis_in_shape ( context , builder , orig_shape , ndim , axis ) : assert ( len ( orig_shape ) == ( ndim - 1 ) ) ll_shty = ir . ArrayType ( cgutils . intp_t , ndim ) shapes = cgutils . alloca_once ( builder , ll_shty ) one = cgutils . intp_t ( 1 ) for dim in range ( ( ndim - 1 ) ) : ll_dim = cgutils . intp_t ( dim ) after_axis = builder . icmp_signed ( '>=' , ll_dim , axis ) sh = orig_shape [ dim ] idx = builder . select ( after_axis , builder . add ( ll_dim , one ) , ll_dim ) builder . store ( sh , cgutils . gep_inbounds ( builder , shapes , 0 , idx ) ) builder . store ( one , cgutils . gep_inbounds ( builder , shapes , 0 , axis ) ) return cgutils . unpack_tuple ( builder , builder . load ( shapes ) )
compute shape with the new axis inserted e .