MCPcopy Create free account
hub / github.com/pybind/pybind11 / reshape

Method reshape

include/pybind11/numpy.h:1291–1300  ·  view source on GitHub ↗

Optional `order` parameter omitted, to be added as needed.

Source from the content-addressed store, hash-verified

1289
1290 /// Optional `order` parameter omitted, to be added as needed.
1291 array reshape(ShapeContainer new_shape) {
1292 detail::npy_api::PyArray_Dims d
1293 = {reinterpret_cast<Py_intptr_t *>(new_shape->data()), int(new_shape->size())};
1294 auto new_array
1295 = reinterpret_steal<array>(detail::npy_api::get().PyArray_Newshape_(m_ptr, &d, 0));
1296 if (!new_array) {
1297 throw error_already_set();
1298 }
1299 return new_array;
1300 }
1301
1302 /// Create a view of an array in a different data type.
1303 /// This function may fundamentally reinterpret the data in the array.

Callers 8

test_mutator_descriptorsFunction · 0.80
test_both_ref_mutatorsFunction · 0.80
check_stridesFunction · 0.80
test_array_constructorsFunction · 0.80
TEST_SUBMODULEFunction · 0.80

Calls 3

getFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by 8

test_mutator_descriptorsFunction · 0.64
test_both_ref_mutatorsFunction · 0.64
check_stridesFunction · 0.64
test_array_constructorsFunction · 0.64
TEST_SUBMODULEFunction · 0.64