static void initDataArray(af_array *arr, const T *ptr, af_source_t src, dim_type d0, dim_type d1=1, dim_type d2=1, dim_type d3=1) { af::dtype ty = (af::dtype)dtype_traits<T>::af_type; dim_type my_dims[] = {d0, d1, d2, d3}; switch (src) { case afHost: AF_THROW(af_create_array(arr, (const void * const)ptr, 4, my_dims, ty)); break; case afDevice: AF_THROW(af_device_array(arr, (const void * )ptr, 4, my_dims, ty)); break; default: AF_THROW(AF_ERR_INVALID_ARG); } }
static void initDataArray(af_array *arr, const T *ptr, af::source src, dim_t d0, dim_t d1=1, dim_t d2=1, dim_t d3=1) { af::dtype ty = (af::dtype)dtype_traits<T>::af_type; dim_t my_dims[] = {d0, d1, d2, d3}; switch (src) { case afHost: AF_THROW(af_create_array(arr, (const void * const)ptr, AF_MAX_DIMS, my_dims, ty)); break; case afDevice: AF_THROW(af_device_array(arr, (const void * )ptr, AF_MAX_DIMS, my_dims, ty)); break; default: AF_THROW_ERR("Can not create array from the requested source pointer", AF_ERR_ARG); } }