MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / CheckContiguousArray

Function CheckContiguousArray

rtpose_wrapper/python/caffe/_caffe.cpp:69–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69void CheckContiguousArray(PyArrayObject* arr, string name,
70 int channels, int height, int width) {
71 if (!(PyArray_FLAGS(arr) & NPY_ARRAY_C_CONTIGUOUS)) {
72 throw std::runtime_error(name + " must be C contiguous");
73 }
74 if (PyArray_NDIM(arr) != 4) {
75 throw std::runtime_error(name + " must be 4-d");
76 }
77 if (PyArray_TYPE(arr) != NPY_FLOAT32) {
78 throw std::runtime_error(name + " must be float32");
79 }
80 if (PyArray_DIMS(arr)[1] != channels) {
81 throw std::runtime_error(name + " has wrong number of channels");
82 }
83 if (PyArray_DIMS(arr)[2] != height) {
84 throw std::runtime_error(name + " has wrong height");
85 }
86 if (PyArray_DIMS(arr)[3] != width) {
87 throw std::runtime_error(name + " has wrong width");
88 }
89}
90
91// Net constructor
92shared_ptr<Net<Dtype> > Net_Init(string network_file, int phase,

Callers 1

Net_SetInputArraysFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected