Skip to content

Expose data_ptr as a public API #1454

Open
@LittleLittleCloud

Description

@LittleLittleCloud

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions