Aleator.Torch 0.3.0-preview.1

This is a prerelease version of Aleator.Torch.
dotnet add package Aleator.Torch --version 0.3.0-preview.1
                    
NuGet\Install-Package Aleator.Torch -Version 0.3.0-preview.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Aleator.Torch" Version="0.3.0-preview.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aleator.Torch" Version="0.3.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="Aleator.Torch" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Aleator.Torch --version 0.3.0-preview.1
                    
#r "nuget: Aleator.Torch, 0.3.0-preview.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Aleator.Torch@0.3.0-preview.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Aleator.Torch&version=0.3.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Aleator.Torch&version=0.3.0-preview.1&prerelease
                    
Install as a Cake Tool

Aleator.Torch

Optional TorchSharp bridge for Aleator, the .NET 10 / C# port of the Figaro probabilistic programming library.

  • TorchDifferentiableTarget(dimension, tensorProgram) wraps any TorchSharp tensor program as an IDifferentiableTarget, so Aleator's gradient engines (HMC / NUTS / ADVI / SVGD from Aleator.AutoDiff) consume libtorch log-densities — including neural-network likelihoods and VAE-style amortised encoders.
  • TorchProbe.Describe() — native-backend smoke check.
using Aleator.AutoDiff;
using Aleator.Torch;
using Aleator.Util;
using static TorchSharp.torch;

var target = new TorchDifferentiableTarget(3, theta => -0.5 * (theta * theta).sum());
var nuts = new NoUTurnSampler(target, random: new DefaultRandomSource(42));

Each bridge call owns and disposes the input tensor and all callback temporaries. Tensors captured by the callback (for example model parameters or fixed data) remain caller-owned. Gradient evaluation uses input-only autograd.grad, so it does not accumulate .grad on captured trainable tensors.

Carries the heavy TorchSharp + libtorch-cpu native dependency (hundreds of MB) — reference it only when you need the bridge. Excluded from NativeAOT publishes by design.

Docs and examples (torch-bridge, amortised-vi): github.com/deecalov/Aleator.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.0-preview.1 67 9/6/2026