testGradientPruning :: Test
testGradientPruning = testCase "testGradientPruning" $ do
    let grads = do
            x <- TF.render $ TF.scalar (3 :: Float)
            b <- TF.render $ TF.scalar (4 :: Float)
            bx <- TF.render $ b `TF.mul` x
            let y = bx `TF.add` b
            TF.gradients y [x, bx]

    -- Assert that the gradients are right.
    [dx, dxb] <- TF.runSession $ grads >>= TF.run
    4 @=? TF.unScalar dx
    1 @=? TF.unScalar dxb

-- Test that identical "stateful" ops work with createGraph.
testGradientPruning :: Test
testGradientPruning = testCase "testGradientPruning" $ do
    let grads = do
            x <- TF.render $ TF.scalar (3 :: Float)
            b <- TF.render $ TF.scalar (4 :: Float)
            bx <- TF.render $ b `TF.mul` x
            let y = bx `TF.add` b
            TF.gradients y [x, bx]

    -- Assert that the gradients are right.
    [dx, dxb] <- TF.runSession $ grads >>= TF.run
    4 @=? TF.unScalar dx
    1 @=? TF.unScalar dxb

-- Test that identical "stateful" ops work with createGraph.
testGradientPruning = testCase "testGradientPruning" $ do
    let grads = do
            x <- TF.render $ TF.scalar (3 :: Float)
            b <- TF.render $ TF.scalar (4 :: Float)
            bx <- TF.render $ b `TF.mul` x
            let y = bx `TF.add` b
            TF.gradients y [x, bx]

    -- Assert that the gradients are right.
    [dx, dxb] <- TF.runSession $ grads >>= TF.run
    4 @=? TF.unScalar dx
    1 @=? TF.unScalar dxb

-- Test that identical "stateful" ops work with createGraph.