Questions tagged [diffsharp]

DiffSharp is a functional automatic differentiation (AD) library.

See also:

9 questions
4
votes
2 answers

C# DiffSharp v0.7.7 Looking for FSharp.Core v4.4.0.0

I've been trying to use the most recent version of DiffSharp (v0.7.7) with C#. I keep getting the following error: Error 3 Assembly 'DiffSharp, Version=0.7.7.0, Culture=neutral, PublicKeyToken=null' uses 'FSharp.Core, Version=4.4.0.0, …
phoenix
  • 41
  • 2
1
vote
1 answer

Functions unavailable in DiffSharp

I have successfully installed DiffSharp (along with TorchSharp, Libsharp etc.), using the following F# script: #r "nuget: DiffSharp.Core" #r "nuget: DiffSharp.Backends.Reference" #r "nuget: DiffSharp.Data" #r "nuget: DiffSharp.Backends.Torch" #r…
Loco Barocco
  • 121
  • 7
1
vote
0 answers

Upgrade current .NET SDK in Visual Studio 2022

I'm trying to add DiffSharp.Backends.Torch package to my MS Visual Studio 2022 project, but says I only have .NET5.0 installed, despite having installed .NET SDK 6.0 and 7.0, but these do not show up as available options when creating new projects,…
Loco Barocco
  • 121
  • 7
1
vote
1 answer

Converting System.Double[,] to DenseMatrix

The hessian function in Diffsharp returns something called System.Double[,]. Or if you hover on the variable it shows as a float[,]. This object seems a bit difficult to parse, I'm not sure why. This question is related but the answer doesn't seem…
1
vote
0 answers

How to multiply DM and DV of DiffSharp in C#?

I have the following code: using DiffSharp.Interop.Float64; public class Layer { public DM W { get; set; } public DV b { get; set; } public Func a { get; set; } public DV Compute(DV v) { …
ozgur
  • 2,549
  • 4
  • 25
  • 40
1
vote
2 answers

Understanding higher order automatic differentiation

Having recently just finished my own basic reverse mode AD for machine learning purposes, I find myself wanting to learn about the field, but I've hit a hardness wall with higher order methods. The basic reverse AD is beautifully simple and easy to…
Marko Grdinić
  • 3,798
  • 3
  • 18
  • 21
1
vote
2 answers

F# Generic Math: how to write function with op_GreaterThan

in F#, how does one write a generic-math step function? An (Oliver) Heaviside step function is function that returns zero if x is negative, otherwise it retuns one. Here is a summary of my attempts so far: // attempt 1: let inline stepFct1< ^T when…
Piga-fetta
  • 119
  • 1
  • 6
0
votes
1 answer

DiffSharp sliding window implementation example

According to this issue Check view operations correspond to torch #199 It seems like it is not hard to implement sliding window function with DiffSharp Tensor. However I cannot get a hint searching DiffSharp official website. In PyTorch, the unfold…
Anibal Yeh
  • 349
  • 1
  • 11
0
votes
2 answers

Linq Expression.Add error but (+) does work in F#

#r "nuget: DiffSharp.Core, 1.0.7-preview1873603133" #r "nuget: DiffSharp.Backends.Reference, 1.0.7-preview1873603133" #r "nuget: DiffSharp.Backends.Torch, 1.0.7-preview1873603133" open DiffSharp open DiffSharp.Util let t3 = dsharp.tensor [[1.1;…
Anibal Yeh
  • 349
  • 1
  • 11