From bfd8de5582891137a50f23e160c1e65eb7d4b931 Mon Sep 17 00:00:00 2001 From: Johannes Maier Date: Fri, 3 Mar 2023 16:24:18 +0100 Subject: [PATCH] Fix lens errors --- tensorflow-ops/src/TensorFlow/Gradient.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tensorflow-ops/src/TensorFlow/Gradient.hs b/tensorflow-ops/src/TensorFlow/Gradient.hs index 0e80737..be7493f 100644 --- a/tensorflow-ops/src/TensorFlow/Gradient.hs +++ b/tensorflow-ops/src/TensorFlow/Gradient.hs @@ -168,7 +168,7 @@ gradients y xs = build $ do (\f x -> fromMaybe (error $ "no NodeDef found for " ++ show x) (f x)) . flip Map.lookup let (gr, nodeMap) = createGraph yName nodeDefLookup - xnodes = mapMaybe (\x -> nodeMap ^. (at . outputNodeName . renderedOutput $ x)) xs + xnodes = mapMaybe (\x -> nodeMap ^. (at $ outputNodeName $ renderedOutput x)) xs -- make a set of the nodes reachable from the xnodes -- The xnodes are not part of this set (unless reachable from another xnode) reachableSet = computeReachableSet xnodes gr @@ -199,7 +199,8 @@ computeReachableSet vs g = IntSet.fromList $ concatMap (drop 1 . FGL.preorder) (FGL.dff vs g) outputIxAt :: OutputIx -> Lens' (IntMap.IntMap v) (Maybe v) -outputIxAt = intAt . unOutputIx +-- NOTE: point-free notation leads to unification problems here +outputIxAt x = intAt (unOutputIx x) -- | Incomplete gradients of a node's outputs. --