Skip to content

Commit ee69aa3

Browse files
author
Bart Schuurmans
committed
Fix parsing of "name:123" strings
1 parent 9b1a7d7 commit ee69aa3

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
@@ -187,8 +187,8 @@ run session graph inputNamesData outputNames targetNames = do
187187
parseName :: B.ByteString -> (B.ByteString, CInt)
188188
parseName name =
189189
case break (== ':') (C.unpack name) of
190-
(name, ':':idxStr) | [(idx, "" :: String)] <- read idxStr
191-
-> (C.pack name, fromInteger idx)
190+
(name, ':':idxStr) | idx <- read idxStr
191+
-> (C.pack name, idx)
192192
_ -> (name, 0)
193193

194194
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)