The ordinal 242 could not be located in the dynamic link library ***\torch.dll

It is simple. paths in PATH are not considered as the first option for finding libraries. see here for more details. https://docs.microsoft.com/zh-cn/windows/win32/dlls/dynamic-link-library-search-order
If you want to see which dll is loaded at runtime, you can refer to the output window of VS or using sth like Process Monitor.