MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / initDataArray

Function initDataArray

src/api/cpp/array.cpp:120–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120af_array initDataArray(const void *ptr, int ty, af::source src, dim_t d0,
121 dim_t d1 = 1, dim_t d2 = 1, dim_t d3 = 1) {
122 dim_t my_dims[] = {d0, d1, d2, d3};
123 af_array arr;
124 switch (src) {
125 case afHost:
126 AF_THROW(af_create_array(&arr, ptr, AF_MAX_DIMS, my_dims,
127 static_cast<af_dtype>(ty)));
128 break;
129 case afDevice:
130 AF_THROW(af_device_array(&arr, const_cast<void *>(ptr), AF_MAX_DIMS,
131 my_dims, static_cast<af_dtype>(ty)));
132 break;
133 default:
134 AF_THROW_ERR(
135 "Can not create array from the requested source pointer",
136 AF_ERR_ARG);
137 }
138 return arr;
139}
140} // namespace
141
142namespace af {

Callers

nothing calls this directly

Calls 2

af_create_arrayFunction · 0.50
af_device_arrayFunction · 0.50

Tested by

no test coverage detected