Change:
END_HANDLE_TH_ERRORS } <ins> #ifndef THC_GENERIC_FILE static PyObject * THPStorage_(fromBuffer)(PyObject *_unused, PyObject *args, PyObject *keywds) { HANDLE_TH_ERRORS PyObject *obj = NULL; const char* byte_order_str = NULL; Py_ssize_t count = -1, offset = 0; Py_buffer buffer; static char *kwlist[] = {"buffer", "byte_order", "count", "offset", NULL}; const char* argtypes; #if defined(TH_REAL_IS_BYTE) || defined(TH_REAL_IS_CHAR) argtypes = "O|snn"; #else argtypes = "Os|nn"; #endif if (!PyArg_ParseTupleAndKeywords(args, keywds, argtypes, kwlist, &obj, &byte_order_str, &count, &offset)) { return NULL; } #if !(defined(TH_REAL_IS_BYTE) || defined(TH_REAL_IS_CHAR)) THPByteOrder byte_order; if (strcmp(byte_order_str, "native") == 0) { byte_order = THP_nativeByteOrder(); } else if (strcmp(byte_order_str, "big") == 0) { byte_order = THP_BIG_ENDIAN; } else if (strcmp(byte_order_str, "little") == 0) { byte_order = THP_LITTLE_ENDIAN; } else { PyErr_Format(PyExc_ValueError, "invalid byte_order '%s' (expected 'big', 'little', or 'native')", byte_order_str); return NULL; } #endif if (PyObject_GetBuffer(obj, &buffer, PyBUF_SIMPLE) < 0) return NULL; if (offset < 0 || offset > buffer.len) { PyErr_Format(PyExc_ValueError, "offset must be non-negative and no greater than buffer length (%ld)", (long) buffer.len); return NULL; } if (count < 0) { if ((buffer.len - offset) % sizeof(real) != 0) { PyErr_Format(PyExc_ValueError, "buffer size must be a multiple of element size"); return NULL; } count = (buffer.len - offset) / sizeof(real); } if (offset + (count * (Py_ssize_t)sizeof(real)) > buffer.len) { PyErr_Format(PyExc_ValueError, "buffer is smaller than requested size"); return NULL; } uint8_t* src = (uint8_t*) buffer.buf; THStorage* storage = THStorage_(newWithSize)(count); #if defined(TH_REAL_IS_BYTE) || defined(TH_REAL_IS_CHAR) memcpy(storage->data, src + offset, count); #elif defined(TH_REAL_IS_SHORT) THP_decodeInt16Buffer(storage->data, src + offset, byte_order, count); #elif defined(TH_REAL_IS_INT) THP_decodeInt32Buffer(storage->data, src + offset, byte_order, count); #elif defined(TH_REAL_IS_LONG) THP_decodeInt64Buffer(storage->data, src + offset, byte_order, count); #elif defined(TH_REAL_IS_FLOAT) THP_decodeFloatBuffer(storage->data, src + offset, byte_order, count); #elif defined(TH_REAL_IS_DOUBLE) THP_decodeDoubleBuffer(storage->data, src + offset, byte_order, count); #else #error "Unknown type" #endif return (PyObject*)THPStorage_(newObject)(storage); END_HANDLE_TH_ERRORS } #endif </ins> PyObject * THPStorage_(writeFile)(THPStorage *self, PyObject *file) { HANDLE_TH_ERRORS

Discussion:
<!-- A clear and concise description of what the bug is. --The target name is used by a test executable in mkldnn. Steps to reproduce the behavior: BUILDTEST=1 build <!-- If you have a code sample, error messages, stack traces, please provide it here as well --<!-- A clear and concise description of what you expected to happen. --CMake configure passes. Please copy and paste the output from our (or fill out the checklist below manually). You can get the script and run it with: PyTorch Version (e.g., 1.0): v1.5.0-rc2 OS (e.g., Linux): Windows How you installed PyTorch (, , source): source Build command you used (if compiling from source): python build Python version: 3.x CUDA/cuDNN version: 9.2 / 10.1 / 10.2 / NA GPU models and configuration: Tesla M60 Any other relevant information: <!-- Add any other context about the problem here. --We should not build tests for mkldnn.
I have encountered the same error, how do I resolve it?
It is actually mkldnn that is out of sync. So running the following script should help.
Thanks a lot for this I posted this on the PyTorch Discussions but to no avail, and now I've finally understood the reason of this error. Thanks a lot. Surprisingly, for me the build works out if I build from the master repo, but changing to a different version always fails.