Skip to content

Commit 39f0a8e

Browse files
author
Bart Schuurmans
committed
Fix parsing of "name:123" strings
1 parent 12ac796 commit 39f0a8e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tensorflow/src/TensorFlow/Internal/FFI.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ run session graph inputNamesData outputNames targetNames = do
212212
parseName :: B.ByteString -> (B.ByteString, CInt)
213213
parseName name =
214214
case break (== ':') (C.unpack name) of
215-
(name, ':':idxStr) | [(idx, "" :: String)] <- read idxStr
216-
-> (C.pack name, fromInteger idx)
215+
(name, ':':idxStr) | idx <- read idxStr
216+
-> (C.pack name, idx)
217217
_ -> (name, 0)
218218

219219
nullTensor = Raw.Tensor nullPtr

tensorflow/src/TensorFlow/Output.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ opControlInputs = lens _opControlInputs (\o x -> o {_opControlInputs = x})
121121
-- code into a Build function
122122
instance IsString Output where
123123
fromString s = case break (==':') s of
124-
(n, ':':ixStr) | [(ix, "" :: String)] <- read ixStr
125-
-> Output (fromInteger ix) $ assigned n
124+
(n, ':':ixStr) | ix <- read ixStr
125+
-> Output (fromInteger ix) $ assigned n
126126
_ -> Output 0 $ assigned s
127127
where assigned = NodeName . Text.pack

0 commit comments

Comments
 (0)