@@ -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 , sqrt , slice , shape )
35
+ import qualified TensorFlow.GenOps.Core as TF (conv2DBackpropInput' , max , maximum , resizeBilinear , tile , pad , batchToSpaceND , spaceToBatchND , squeeze , sqrt , slice , shape )
36
36
import qualified TensorFlow.Gradient as TF
37
37
import qualified TensorFlow.Ops as TF hiding (zeroInitializedVariable , shape )
38
38
import qualified TensorFlow.Output as TF
@@ -429,6 +429,19 @@ testTile2DGrad = testCase "testTileGrad2D" $ do
429
429
shapeX @=? (shapeDX :: V. Vector Int32 )
430
430
V. fromList [6 , 6 , 6 , 6 , 6 , 6 :: Float ] @=? (dx :: V. Vector Float )
431
431
432
+ testResizeBilinearGrad :: Test
433
+ testResizeBilinearGrad = testCase " testResizeBilinearGrad" $ do
434
+ (dx, shapeDX, shapeX) <- TF. runSession $ do
435
+ let shape = TF. vector [1 , 3 , 2 , 1 :: Int32 ]
436
+ x <- TF. render $ TF. fill shape (TF. scalar (1 :: Float ))
437
+ let outSize = TF. vector [6 , 4 :: Int32 ]
438
+ let y = TF. resizeBilinear x outSize
439
+
440
+ [dx] <- TF. gradients y [x]
441
+ TF. run (dx, TF. shape dx, TF. shape x)
442
+ shapeX @=? (shapeDX :: V. Vector Int32 )
443
+ V. fromList [1 , 1 , 1 , 1 , 1 , 1 :: Float ] @=? (dx :: V. Vector Float )
444
+
432
445
matMulGradient :: Test
433
446
matMulGradient = testCase " matMulGradients" $ do
434
447
@@ -553,6 +566,7 @@ main = defaultMain
553
566
, testFillGrad
554
567
, testTileGrad
555
568
, testTile2DGrad
569
+ , testResizeBilinearGrad
556
570
, matMulGradient
557
571
, matMulGradGrad
558
572
, matMulTransposeGradient (False , False )
0 commit comments