Blog posts

2023

Native CUDA array to TorchLib Tensor

less than 1 minute read

Published:

A small problem I encountered was how to convert a native CUDA array to a TorchLib Tensor in C++. Some posts such as this give a very good example of doing so, but the “tricky part” of the image step is not clearly stated. According to the OpenCV doc, step means “a distance between successive rows in bytes; includes the gap if any”, so it should be the length of one row in bytes. So in the orginal github issue, long long step = image.step / sizeof(float); basically means the actual length of the row.

TorchLib + CMake + Windows = 0xc0000135

less than 1 minute read

Published:

Passed compiling. Unable to run with exit code 0xc0000135. Turns out that the cmake configuration is slightly different on windows.