dataframe-hasktorch 0.4.0.1 → 0.4.0.2
raw patch · 2 files changed
+5/−17 lines, 2 filesdep ~dataframe-coredep ~dataframe-operations
Dependency ranges changed: dataframe-core, dataframe-operations
Files
- dataframe-hasktorch.cabal +3/−3
- src/DataFrame/Hasktorch.hs +2/−14
dataframe-hasktorch.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: dataframe-hasktorch-version: 0.4.0.1+version: 0.4.0.2 synopsis: Converts between dataframes and hasktorch tensors description: @@ -37,8 +37,8 @@ build-depends: base >= 4.11 && < 5, vector >= 0.13 && < 0.15,- dataframe-core ^>= 2.2,- dataframe-operations ^>= 2.2,+ dataframe-core ^>= 2.6,+ dataframe-operations ^>= 2.6, hasktorch >= 0.2.1.6 && < 0.3 hs-source-dirs: src
src/DataFrame/Hasktorch.hs view
@@ -14,13 +14,7 @@ import DataFrame.Core (DataFrame) import Torch -{- | Convert a dataframe to a floating-point tensor of shape @[rows, columns]@-(or @[rows]@ when single-column). Throws 'DataFrameException' if a column-cannot be converted to float.-->>> toTensor df -- where df has shape (100, 5)-Tensor with shape [100, 5]--}+-- | Convert a dataframe to a floating-point tensor of shape [rows, columns]. toTensor :: DataFrame -> Tensor toTensor df = case D.toFloatMatrix df of Left e -> throw e@@ -31,13 +25,7 @@ in reshape dims' (asTensor (flattenFeatures m)) -{- | Convert a dataframe to an integer tensor of shape @[rows, columns]@ (or-@[rows]@ when single-column). Floating-point values are rounded. Throws-'DataFrameException' if a column cannot be converted to int.-->>> toIntTensor featuresDf -- where featuresDf has shape (100, 3)-Tensor with shape [100, 3]--}+-- | Convert a dataframe to an integer tensor of shape [rows, columns]. toIntTensor :: DataFrame -> Tensor toIntTensor df = case D.toIntMatrix df of Left e -> throw e