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

Method resize

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

Resize array to given shape If refcheck is true and more that one reference exist to this array then resize will succeed only if it makes a reshape, i.e. original size doesn't change

Source from the content-addressed store, hash-verified

1050 /// If refcheck is true and more that one reference exist to this array
1051 /// then resize will succeed only if it makes a reshape, i.e. original size doesn't change
1052 void resize(ShapeContainer new_shape, bool refcheck = true) {
1053 detail::npy_api::PyArray_Dims d
1054 = {// Use reinterpret_cast for PyPy on Windows (remove if fixed, checked on 7.3.1)
1055 reinterpret_cast<Py_intptr_t *>(new_shape->data()),
1056 int(new_shape->size())};
1057 // try to resize, set ordering param to -1 cause it's not used anyway
1058 auto new_array = reinterpret_steal<object>(
1059 detail::npy_api::get().PyArray_Resize_(m_ptr, &d, int(refcheck), -1));
1060 if (!new_array) {
1061 throw error_already_set();
1062 }
1063 if (isinstance<array>(new_array)) {
1064 *this = std::move(new_array);
1065 }
1066 }
1067
1068 /// Optional `order` parameter omitted, to be added as needed.
1069 array reshape(ShapeContainer new_shape) {

Callers 3

dispatcherMethod · 0.45
broadcastFunction · 0.45
require_sizeFunction · 0.45

Calls 3

moveFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected