MCPcopy Create free account
hub / github.com/BVLC/caffe / CheckContiguousArray

Function CheckContiguousArray

python/caffe/_caffe.cpp:86–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86void CheckContiguousArray(PyArrayObject* arr, string name,
87 int channels, int height, int width) {
88 if (!(PyArray_FLAGS(arr) & NPY_ARRAY_C_CONTIGUOUS)) {
89 throw std::runtime_error(name + " must be C contiguous");
90 }
91 if (PyArray_NDIM(arr) != 4) {
92 throw std::runtime_error(name + " must be 4-d");
93 }
94 if (PyArray_TYPE(arr) != NPY_FLOAT32) {
95 throw std::runtime_error(name + " must be float32");
96 }
97 if (PyArray_DIMS(arr)[1] != channels) {
98 throw std::runtime_error(name + " has wrong number of channels");
99 }
100 if (PyArray_DIMS(arr)[2] != height) {
101 throw std::runtime_error(name + " has wrong height");
102 }
103 if (PyArray_DIMS(arr)[3] != width) {
104 throw std::runtime_error(name + " has wrong width");
105 }
106}
107
108// Net constructor
109shared_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