Not sure if this is intended behavior. But if it is, it should be added to the documentation of device():
af::setBackend(AF_BACKEND_CPU);
float v[] = {1, 2, 3, 4, 5};
array v_array = array(5, v);
array a_cpu = constant(0, 5,5);
a_cpu += matmulNT(v_array, v_array);
a_cpu.eval(); //Without this eval the device pointer is NULL.
float *ptr = a_cpu.device<float>();
std::cout << "PTR: " << ptr << std::endl;
Not sure if this is intended behavior. But if it is, it should be added to the documentation of
device():