Skip to content

Commit

Permalink
grab n outputs from the network
Browse files Browse the repository at this point in the history
  • Loading branch information
Gatlin C Johnson committed Oct 23, 2012
1 parent 41f37ca commit 0bbf991
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion AI/HNN/Recurrent/Network.hs
Expand Up @@ -34,7 +34,7 @@

module AI.HNN.Recurrent.Network (Network, createNetwork, computeStep,
sigmoid, computeStepM, weights,
state, size, nInputs) where
state, size, nInputs, output) where

import AI.HNN.Internal.Matrix
import System.Random.MWC
Expand Down Expand Up @@ -86,6 +86,11 @@ computeStepM :: (Variate a, U.Unbox a, Num a, Monad m) =>
computeStepM n a t i = return $ computeStep n a t i
{-# INLINE computeStepM #-}

-- | Grab *n* outputs from the net.
output :: (U.Unbox a) => Network a -> Int -> Vec a
output (Network{..}) n = U.unsafeSlice nInputs n state
{-# INLINE output #-}

-- | It's a simple, differentiable sigmoid function.
sigmoid :: Floating a => a -> a
sigmoid !x = 1 / (1 + exp (-x))
Expand Down

0 comments on commit 0bbf991

Please sign in to comment.