bfloat16 tensor cannot be printed
var a = torch.randn(3, 3).to(torch.bfloat16); a.print();
Cannot be printed because is not implemented in torchsharp the Half (float16) and BFloat16 and the print is not implemented with these dtype so i make them support on my branch autocast i showed the result in the last comment of this in this PR
FAQ:
Why i don't see that PR with committ Support bfloat16?
Because i have some problem that i worked on my branch autocast and the PR is based on my main branch not autocast branch
How i can do this my self?
- Try git clone my forked repo torchsharp and switch to my branch autocast (warning: I didn't run Unit Test so be carefully)
- Download from official pytorch web the Libtorch and unzip
- run
dotnet build /p:SkipNative=true - cd on
src\Nativeand runbuild.cmd Release x64 --libtorchpath "*FULLPATH OF LIBTORCH\libtorch-win-shared-with-deps-2.8.0+cu128\libtorch\share\cmake\Torch"if you want Debug change the Release to Debug At the end you have all binaries that you needTorchSharp.dllandLibtorchsharp.dlldon't forget to copy all .dll of libtorch from lib folder to where your program is located including your TorchSharp.dll and Libtorchsharp.dll. The .dll of libtorch is located in subfolder of lib for examplelibtorch-win-shared-with-deps-debug-2.8.0+cu128\libtorch\lib
i was try to make work the dotnet build /p:CustomLibTorchPath="Full path of libtorch" for some reason this not compile the libtorch i need research that, i make them worked but now no. I don't know why.
EDIT: I figure out how run CustomLibTorchFullPath. U can do this
dotnet build /p:CustomLibTorchFullPath="*FullPath where you downloaded the libtorch*\libtorch-win-shared-with-deps-debug-2.8.0+cu128\libtorch\share\cmake\Torch" and the other steps is not neccesary