http://man7.org/linux/man-pages/man3/posix_memalign.3.html 28
It is likely occurring from a data transfer from the gpu to cpu where your data is of size m and your available memory size is of n where n < m => as the documentation states there are two types of errors
   EINVAL The alignment argument was not a power of two, or was not a
          multiple of sizeof(void *).

   ENOMEM There was insufficient memory to fulfill the allocation
          request.

Considering my error occurred near the end of my training and am working with large datasets then for me it was likely an ENOMEM error.