8000 Backpropagating through "stateful" operations. · Issue #16 · mstksg/backprop · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Backpropagating through "stateful" operations. #16
Open
@jh14778

Description

@jh14778

I am trying to use this library with a third party C library, but I need to carry some additional context to perform the computations.

My issue boils down to how do I integrate library calls like:

-- Haskell wrapper function signature 
zero :: (Int, Int) -> StateT IO Context Matrix
one :: (Int, Int) -> StateT IO Context Matrix
add :: Matrix -> Matrix -> StateT IO Context Matrix
matMul :: Matrix -> Matrix -> StateT IO Context Matrix

-- FFI signature 
zero :: Ptr Context -> CInt -> CInt -> IO (Ptr Matrix)
one :: Ptr Context -> CInt -> CInt -> IO (Ptr Matrix)
add :: Ptr Context -> Ptr Matrix -> Ptr Matrix -> IO (Ptr Matrix)
matmul :: Ptr Context -> Ptr Matrix -> Ptr Matrix -> IO (Ptr Matrix)

There are no standalone functions to zero, one, or add a Matrix without carrying the Context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0