Skip to content

Instantly share code, notes, and snippets.

@hsed
Last active May 1, 2018 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hsed/92aba567134d45af27cc92e13b8f4eb3 to your computer and use it in GitHub Desktop.
Save hsed/92aba567134d45af27cc92e13b8f4eb3 to your computer and use it in GitHub Desktop.
let fwdProp (x: Vector<float>) (net : Network) : (NodesVectList * Network) =
let propNetwork (nvectLstAndLayers: NodesVectList * Network) (layer : Layer) : (NodesVectList * Network) =
let nvectLst, layerLst = nvectLstAndLayers
let newSVect = layer.wMatx.Transpose() * CreateVector.Dense((Array.concat [ [|1.0|] ; nvectLst.Head.xVect.ToArray() ]))
let newXVect = (newSVect.Map (Func<float, float> (getActFn layer.actFn)))
({xVect=newXVect ; sVect=newSVect} :: nvectLst , layer :: layerLst) //append to top
(List.fold propNetwork ([{xVect=x ; sVect=x}], []) net)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment