parameters: (context, builder, arrtype, arr, target_shape)
return_statement: return new_arrtype, new_arr
docstring: Broadcast the given array to the target_shape.
      Returns (array_type, array)
docstring_summary: Broadcast the given array to the target_shape.
      Returns (array_type, array)
docstring_tokens: Broadcast the given array to the target_shape . Returns ( array_type array )
function: def _broadcast_to_shape(context, builder, arrtype, arr, target_shape):
      """
      Broadcast the given array to the target_shape.
      Returns (array_type, array)
      """
      # Compute broadcasted shape and strides
      shapes = cgutils.unpack_tuple(builder, arr.shape)
      strides = cgutils.unpack_tuple(builder, arr.strides)
  
      shapes, strides = _bc_adjust_dimension(context, builder, shapes, strides,
                                             target_shape)
      shapes, strides = _bc_adjust_shape_strides(context, builder, shapes,
                                                 strides, target_shape)
      new_arrtype = arrtype.copy(ndim=len(target_shape), layout='A')
      # Create new view
      new_arr = make_array(new_arrtype)(context, builder)
      repl = dict(shape=cgutils.pack_array(builder, shapes),
                  strides=cgutils.pack_array(builder, strides))
      cgutils.copy_struct(new_arr, arr, repl)
      return new_arrtype, new_arr
function_tokens: def _broadcast_to_shape ( context , builder , arrtype , arr , target_shape ) : # Compute broadcasted shape and strides shapes = cgutils . unpack_tuple ( builder , arr . shape ) strides = cgutils . unpack_tuple ( builder , arr . strides ) shapes , strides = _bc_adjust_dimension ( context , builder , shapes , strides , target_shape ) shapes , strides = _bc_adjust_shape_strides ( context , builder , shapes , strides , target_shape ) new_arrtype = arrtype . copy ( ndim = len ( target_shape ) , layout = 'A' ) # Create new view new_arr = make_array ( new_arrtype ) ( context , builder ) repl = dict ( shape = cgutils . pack_array ( builder , shapes ) , strides = cgutils . pack_array ( builder , strides ) ) cgutils . copy_struct ( new_arr , arr , repl ) return new_arrtype , new_arr