TorchSharp
TorchSharp copied to clipboard
Expose `data_ptr` as a public API
This would be useful for using Torchsharp.Tensor with other cuda libraries, like bitsandbytes.
Code could be
using System;
using System.Runtime.InteropServices;
namespace TorchSharp.BitsAndBytes;
public static class LibTorchNativeMethod
{
[DllImport("LibTorchSharp")]
public static extern IntPtr THSStorage_data_ptr(IntPtr tensor);
}
Usage https://github.com/LittleLittleCloud/TorchSharp.BitsAndBytes/blob/4167aff6ea4d9f177beb8d5a6a3e3e2c4afc06a9/TorchSharp.BitsAndBytes/BitsAndByteUtils.cs#L81