ConferenceCalls


#r "nuget: DiffSharp-lite, 1.0.0-preview-987646120"

open DiffSharp
open DiffSharp.Optim

let f (x: Tensor) = 

    let x, y = x.[0], x.[1]

    (3. * x ** (3.0)) + 2.0 * y ** 2.0

let lr, momentum, iters, threshold = 1e-3, 0.5, 1000, 1e-3

let guess = dsharp.tensor([1.; 0.01])

let fx, x = optim.sgd(f, guess, lr=dsharp.tensor(lr), momentum=dsharp.tensor(momentum), nesterov=true, iters=iters, threshold=threshold)


#r "nuget: Flips, 2.4.5"
open Flips
namespace DiffSharp
namespace DiffSharp.Optim
val f : x:Tensor -> Tensor
val x : Tensor
type Tensor = private | TensorC of primalRaw: RawTensor | TensorF of primal: Tensor * derivative: Tensor * nestingTag: uint32 | TensorR of primal: Tensor * derivative: Tensor ref * parentOp: TensorOp * fanout: uint32 ref * nestingTag: uint32 interface IConvertible interface IComparable override Equals : other:obj -> bool override GetHashCode : unit -> int member private GetSlice : bounds:int [,] -> Tensor override ToString : unit -> string member abs : unit -> Tensor member acos : unit -> Tensor member add : b:Tensor -> Tensor + 1 overload member addSlice : location:seq<int> * b:Tensor -> Tensor ...
<summary> Represents a multi-dimensional data type containing elements of a single data type. </summary>
<example> A tensor can be constructed from a list or sequence using <see cref="M:DiffSharp.dsharp.tensor(System.Object)" /><code> let t = dsharp.tensor([[1.; -1.]; [1.; -1.]]) </code></example>
val y : Tensor
val lr : float
val momentum : float
val iters : int
val threshold : float
val guess : Tensor
type dsharp = static member abs : input:Tensor -> Tensor static member acos : input:Tensor -> Tensor static member add : a:Tensor * b:Tensor -> Tensor static member arange : endVal:float * ?startVal:float * ?step:float * ?dtype:Dtype * ?device:Device * ?backend:Backend -> Tensor + 1 overload static member arangeLike : input:Tensor * endVal:float * ?startVal:float * ?step:float * ?dtype:Dtype * ?device:Device * ?backend:Backend -> Tensor + 1 overload static member argmax : input:Tensor -> int [] static member argmin : input:Tensor -> int [] static member asin : input:Tensor -> Tensor static member atan : input:Tensor -> Tensor static member bceLoss : input:Tensor * target:Tensor * ?weight:Tensor * ?reduction:string -> Tensor ...
<summary> Tensor operations </summary>
static member dsharp.tensor : value:obj * ?dtype:Dtype * ?device:Device * ?backend:Backend -> Tensor
val fx : Tensor
type optim = static member adam : f:(Tensor -> Tensor) * x0:Tensor * ?lr:Tensor * ?beta1:Tensor * ?beta2:Tensor * ?eps:Tensor * ?iters:int * ?threshold:double * ?print:bool * ?printEvery:int * ?printPrefix:string * ?printPostfix:string -> Tensor * Tensor + 1 overload static member private optimizeFun : update:(Tensor -> Tensor * Tensor) * x0:Tensor * ?iters:int * ?threshold:double * ?print:bool * ?printEvery:int * ?printPrefix:string * ?printPostfix:string -> Tensor * Tensor static member private optimizeModel : model:Model * optimizer:Optimizer * dataloader:DataLoader * loss:(Tensor -> Tensor -> Tensor) * ?iters:int * ?epochs:int * ?threshold:double * ?print:bool * ?printEvery:int * ?printPrefix:string * ?printPostfix:string -> unit static member sgd : f:(Tensor -> Tensor) * x0:Tensor * ?lr:Tensor * ?momentum:Tensor * ?nesterov:bool * ?iters:int * ?threshold:double * ?print:bool * ?printEvery:int * ?printPrefix:string * ?printPostfix:string -> Tensor * Tensor + 1 overload
<summary>TBD</summary>
static member optim.sgd : f:(Tensor -> Tensor) * x0:Tensor * ?lr:Tensor * ?momentum:Tensor * ?nesterov:bool * ?iters:int * ?threshold:double * ?print:bool * ?printEvery:int * ?printPrefix:string * ?printPostfix:string -> Tensor * Tensor
static member optim.sgd : model:Model.Model * dataloader:Data.DataLoader * loss:(Tensor -> Tensor -> Tensor) * ?lr:Tensor * ?momentum:Tensor * ?nesterov:bool * ?weightDecay:Tensor * ?reversible:bool * ?iters:int * ?epochs:int * ?threshold:double * ?print:bool * ?printEvery:int * ?printPrefix:string * ?printPostfix:string -> unit
namespace Flips