-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add interface files from the remainder of the camlgrad project
- Loading branch information
1 parent
dfa1328
commit 474bd78
Showing
6 changed files
with
56 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(* Loss Interface *) | ||
|
||
(* Imports *) | ||
open Tensor | ||
|
||
(* Loss Functions *) | ||
val mean_squared_error : tensor -> tensor -> tensor | ||
val binary_cross_entropy : tensor -> tensor -> tensor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
(* Mlp Interface *) | ||
|
||
(* Imports *) | ||
open Tensor | ||
|
||
(* Type Definitions *) | ||
type dimensions = int * int | ||
type mlp_layer = { | ||
weights : tensor; | ||
bias : tensor; | ||
activation: tensor -> tensor | ||
} | ||
type mlp = mlp_layer array | ||
|
||
(* Creating *) | ||
val get_mlp : ((tensor -> tensor) * dimensions) array -> mlp | ||
val get_mlp_layer : ?activation:(tensor -> tensor) -> dimensions -> mlp_layer | ||
|
||
(* Forward Pass *) | ||
val mlp_forward : mlp -> tensor -> (tensor * tensor array) | ||
val mlp_layer_forward : mlp_layer -> tensor -> tensor | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
(* Optimizer interface *) | ||
|
||
(* Imports *) | ||
open Mlp | ||
open Tensor | ||
|
||
(* Optimizer Backward Functions *) | ||
val apply_update : mlp_layer -> float -> unit | ||
val update : mlp -> float -> unit | ||
val gradient_descent : mlp -> tensor -> float -> unit | ||
|
||
(* Optimizer Zero Grad Functions *) | ||
val zero_grad_mlp_layer : mlp_layer -> unit | ||
val zero_grad_mlp : mlp -> unit | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,2 @@ | ||
open Tensor | ||
|
||
exception InvalidArgumentException of string | ||
|
||
type mlp_layer = { | ||
weights : tensor; | ||
bias : tensor; | ||
activation: tensor -> tensor | ||
} | ||
|
||
type mlp = mlp_layer array |