Example #1
0
  def testAvgPool3DValidPaddingWithStridesF16(self):
    with self.session() as sess:
      with ops.device("/device:IPU:0"):
        pa = array_ops.placeholder(np.float16, [1, 1, 10, 10, 10], name="a")
        output = nn.avg_pool3d(pa,
                               ksize=[1, 1, 5, 5, 5],
                               strides=[1, 1, 2, 2, 2],
                               data_format='NCDHW',
                               padding='VALID')

        fd = {pa: np.ones([1, 1, 10, 10, 10])}
        result = sess.run(output, fd)
        self.assertAllClose(result, np.ones([1, 1, 3, 3, 3]))
Example #2
0
  def testAvgPool3DSamePaddingWithStridesF32Dim123(self):
    with self.session() as sess:
      with ops.device("/device:IPU:0"):
        pa = array_ops.placeholder(np.float32, [1, 10, 10, 12, 1], name="a")
        output = nn.avg_pool3d(pa,
                               ksize=[1, 5, 5, 7, 1],
                               strides=[1, 2, 2, 2, 1],
                               data_format='NDHWC',
                               padding='SAME',
                               name="avg")

        fd = {pa: np.ones([1, 10, 10, 12, 1])}
        result = sess.run(output, fd)
        self.assertAllClose(result, np.ones([1, 5, 5, 6, 1]))