@@ -32,7 +32,7 @@ import Control.Monad(forM_, replicateM, zipWithM)
32
32
import Control.Monad.IO.Class (liftIO )
33
33
34
34
import qualified TensorFlow.Core as TF
35
- import qualified TensorFlow.GenOps.Core as TF (conv2DBackpropInput' , max , maximum , tile , pad , batchToSpaceND , spaceToBatchND , squeeze )
35
+ import qualified TensorFlow.GenOps.Core as TF (conv2DBackpropInput' , max , maximum , tile , pad , batchToSpaceND , spaceToBatchND , squeeze , sqrt )
36
36
import qualified TensorFlow.Gradient as TF
37
37
import qualified TensorFlow.Ops as TF hiding (zeroInitializedVariable )
38
38
import qualified TensorFlow.Output as TF
@@ -324,6 +324,14 @@ testPad =
324
324
V. fromList [1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ] @=? dx
325
325
V. fromList [2 , 2 , 3 ] @=? s
326
326
327
+ testSqrt :: Test
328
+ testSqrt = testCase " testSqrt" $ do
329
+ [dx] <- TF. runSession $ do
330
+ x <- TF. render $ TF. vector [0.0625 :: Float ]
331
+ let y = TF. sqrt x
332
+ TF. gradients y [x] >>= TF. run
333
+ V. fromList [2 ] @=? dx
334
+
327
335
testBatchToSpaceND :: Test
328
336
testBatchToSpaceND =
329
337
testCase " testBatchToSpaceND" $ do
@@ -517,6 +525,7 @@ main = defaultMain
517
525
, testExpandDims
518
526
, testReshape
519
527
, testPad
528
+ , testSqrt
520
529
, testBatchToSpaceND
521
530
, testSpaceToBatchND
522
531
, testSqueeze
@@ -530,4 +539,4 @@ main = defaultMain
530
539
, matMulTransposeGradient (True , False )
531
540
, matMulTransposeGradient (True , True )
532
541
, testConv2DBackpropInputGrad
533
- ]
542
+ ]
0 commit comments