5

Here is my function signature

auto fun(py::array_t<double, py::array::c_style | py::array::forcecast> x)

The problem is that when passing array of np.float64, the array is not copied and can be modified in fun (which is not expected), when passing array of np.float32 or other dtype, it's copied.

My question is that is there a way to force copy of x even if its dtype is np.float64.

cncggvg
  • 657
  • 6
  • 12

0 Answers0