MCPcopy Create free account
hub / github.com/apple/coremltools / view

Method view

deps/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 15

quantizeFunction · 0.45
_kmeans_ppMethod · 0.45
fitMethod · 0.45
init_partitionsMethod · 0.45
packMethod · 0.45
diff_palettize_seqMethod · 0.45
diff_palettize_batchMethod · 0.45
palettize_batchMethod · 0.45
forwardMethod · 0.45
forward_2dMethod · 0.45
backward_2dMethod · 0.45
magnitude_ranked_maskFunction · 0.45

Calls 4

ptrMethod · 0.80
strClass · 0.70
getFunction · 0.50
releaseMethod · 0.45

Tested by 11

test_viewMethod · 0.36
forwardMethod · 0.36
forwardMethod · 0.36
forwardMethod · 0.36
forwardMethod · 0.36
forwardMethod · 0.36
test_array_attributesFunction · 0.36
TEST_SUBMODULEFunction · 0.36