1
0
Fork 0
mirror of https://github.com/tensorflow/haskell.git synced 2024-11-27 05:19:45 +01:00

Fixed. Could not deduce (TensorType a)

This commit is contained in:
Lupino 2017-04-03 11:43:47 +08:00
parent 665730d6bd
commit 5df9ac4086

View file

@ -262,7 +262,7 @@ instance TensorDataType S.Vector Bool where
where
fromBool x = if x then 1 else 0 :: Word8
instance {-# OVERLAPPABLE #-} (Storable a, TensorDataType S.Vector a)
instance {-# OVERLAPPABLE #-} (TensorType a, Storable a, TensorDataType S.Vector a)
=> TensorDataType V.Vector a where
decodeTensorData = (S.convert :: S.Vector a -> V.Vector a) . decodeTensorData
encodeTensorData x = encodeTensorData x . (S.convert :: V.Vector a -> S.Vector a)
@ -329,7 +329,7 @@ newtype Scalar a = Scalar {unScalar :: a}
deriving (Show, Eq, Ord, Num, Fractional, Floating, Real, RealFloat,
RealFrac, IsString)
instance TensorDataType V.Vector a => TensorDataType Scalar a where
instance (TensorType a, TensorDataType V.Vector a) => TensorDataType Scalar a where
decodeTensorData = Scalar . headFromSingleton . decodeTensorData
encodeTensorData x (Scalar y) = encodeTensorData x (V.fromList [y])