mirror of
https://github.com/tensorflow/haskell.git
synced 2025-02-17 05:25:05 +01:00
Compile on platforms where int64_t == long long. (#6)
In particular, this helps fix the build on Mac OS X.
This commit is contained in:
parent
ea8b62e47b
commit
cdd4a0a747
1 changed files with 8 additions and 2 deletions
|
@ -63,8 +63,14 @@ instance Storable Tensor where
|
||||||
peek p = fmap Tensor (peek (castPtr p))
|
peek p = fmap Tensor (peek (castPtr p))
|
||||||
poke p (Tensor t) = poke (castPtr p) t
|
poke p (Tensor t) = poke (castPtr p) t
|
||||||
|
|
||||||
|
-- A synonym for the int64_t type, which is used in the TensorFlow API.
|
||||||
|
-- On some platforms it's `long`; on others (e.g., Mac OS X) it's `long long`;
|
||||||
|
-- and as far as Haskell is concerned, those are distinct types (`CLong` vs
|
||||||
|
-- `CLLong`).
|
||||||
|
type CInt64 = {#type int64_t #}
|
||||||
|
|
||||||
newTensor :: DataType
|
newTensor :: DataType
|
||||||
-> Ptr CLong -- dimensions array
|
-> Ptr CInt64 -- dimensions array
|
||||||
-> CInt -- num dimensions
|
-> CInt -- num dimensions
|
||||||
-> Ptr () -- data
|
-> Ptr () -- data
|
||||||
-> CULong -- data len
|
-> CULong -- data len
|
||||||
|
@ -82,7 +88,7 @@ tensorType t = toEnum . fromIntegral <$> {# call TF_TensorType as ^ #} t
|
||||||
numDims :: Tensor -> IO CInt
|
numDims :: Tensor -> IO CInt
|
||||||
numDims = {# call TF_NumDims as ^ #}
|
numDims = {# call TF_NumDims as ^ #}
|
||||||
|
|
||||||
dim :: Tensor -> CInt -> IO CLong
|
dim :: Tensor -> CInt -> IO CInt64
|
||||||
dim = {# call TF_Dim as ^ #}
|
dim = {# call TF_Dim as ^ #}
|
||||||
|
|
||||||
tensorByteSize :: Tensor -> IO CULong
|
tensorByteSize :: Tensor -> IO CULong
|
||||||
|
|
Loading…
Add table
Reference in a new issue