Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
DEMO
Loading...
Searching...
No Matches
numpy_bridge.hpp File Reference

DLPack / NumPy interop for SignetStack Signet Forge tensor bridge. More...

#include "signet/ai/tensor_bridge.hpp"
#include "signet/error.hpp"
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <string>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  signet::forge::DLDataType
 DLPack data type descriptor. More...
 
struct  signet::forge::DLDevice
 DLPack device descriptor (type + ordinal). More...
 
struct  signet::forge::DLTensor
 DLPack tensor descriptor (non-owning). More...
 
struct  signet::forge::DLManagedTensor
 DLPack managed tensor – the exchange object for from_dlpack(). More...
 
struct  signet::forge::detail::DLPackViewCtx
 Context stored in DLManagedTensor.manager_ctx for non-owning exports. More...
 
struct  signet::forge::detail::DLPackOwnedCtx
 Context stored in DLManagedTensor.manager_ctx for owning exports. More...
 
class  signet::forge::NumpyBridge
 Exports and imports Signet tensors via DLPack, enabling zero-copy interoperability with PyTorch, NumPy, JAX, and other DLPack-aware frameworks. More...
 
struct  signet::forge::BufferInfo
 Simple C-contiguous buffer descriptor for Python interop. More...
 

Namespaces

namespace  signet
 
namespace  signet::forge
 
namespace  signet::forge::detail
 Internal implementation details for dictionary encoding.
 

Enumerations

DLPack type definitions (matching dlpack.h v0.8)

Self-contained DLPack struct definitions for zero-dependency interop.

enum class  signet::forge::DLDeviceType : int32_t {
  signet::forge::kDLCPU = 1 , signet::forge::kDLCUDA = 2 , signet::forge::kDLCUDAHost = 3 , signet::forge::kDLROCM = 10 ,
  signet::forge::kDLMetal = 8 , signet::forge::kDLVulkan = 7
}
 DLPack device type, matching DLDeviceType from dlpack.h. More...
 
enum class  signet::forge::DLDataTypeCode : uint8_t { signet::forge::kDLInt = 0 , signet::forge::kDLUInt = 1 , signet::forge::kDLFloat = 2 , signet::forge::kDLBfloat = 4 }
 DLPack data type code, matching DLDataTypeCode from dlpack.h. More...
 

Functions

void signet::forge::detail::dlpack_view_deleter (DLManagedTensor *self)
 Deleter for a DLManagedTensor created from a TensorView (non-owning).
 
void signet::forge::detail::dlpack_owned_deleter (DLManagedTensor *self)
 Deleter for a DLManagedTensor created from an OwnedTensor (owning).
 
const char * signet::forge::detail::tensor_dtype_to_pybuf_format (TensorDataType dtype)
 Map TensorDataType to a Python struct format character (PEP 3118).
 
expected< BufferInfosignet::forge::to_buffer_info (const TensorView &tensor)
 Create a BufferInfo from a TensorView for Python buffer protocol export.
 
Type conversion: TensorDataType <-> DLDataType
DLDataType signet::forge::to_dlpack_dtype (TensorDataType dtype)
 Convert a Signet TensorDataType to a DLPack DLDataType.
 
expected< TensorDataTypesignet::forge::from_dlpack_dtype (DLDataType dl_dtype)
 Convert a DLPack DLDataType back to a Signet TensorDataType.
 

Detailed Description

DLPack / NumPy interop for SignetStack Signet Forge tensor bridge.

Exports Signet tensors as DLManagedTensor (DLPack v0.8 compatible) for zero-copy consumption by PyTorch, NumPy, JAX, TensorFlow, and any other framework that supports from_dlpack().

Also provides BufferInfo for Python buffer protocol (PEP 3118) and pybind11's py::buffer_info integration.

Zero dependency: does NOT link to DLPack, NumPy, or PyTorch. Header-only. Part of the signet::forge interop module (Phase 6).

See also
NumpyBridge, BufferInfo, to_buffer_info

Definition in file numpy_bridge.hpp.