MCPcopy Create free account
hub / github.com/davisking/dlib / view

Method view

dlib/external/pybind11/include/pybind11/numpy.h:1085–1093  ·  view source on GitHub ↗

Create a view of an array in a different data type. This function may fundamentally reinterpret the data in the array. It is the responsibility of the caller to ensure that this is safe. Only supports the `dtype` argument, the `type` argument is omitted, to be added as needed.

Source from the content-addressed store, hash-verified

1083 /// Only supports the `dtype` argument, the `type` argument is omitted,
1084 /// to be added as needed.
1085 array view(const std::string &dtype) {
1086 auto &api = detail::npy_api::get();
1087 auto new_view = reinterpret_steal<array>(api.PyArray_View_(
1088 m_ptr, dtype::from_args(pybind11::str(dtype)).release().ptr(), nullptr));
1089 if (!new_view) {
1090 throw error_already_set();
1091 }
1092 return new_view;
1093 }
1094
1095 /// Ensure that the argument is a NumPy array
1096 /// In case of an error, nullptr is returned and the Python error is cleared.

Callers 1

memoryviewMethod · 0.45

Calls 2

strClass · 0.85
releaseMethod · 0.45

Tested by

no test coverage detected