예제 #1
0
  def test3DNumpy(self):
    x = np.ones([3, 7, 6, 6, 5], dtype=np.float32)
    ksize = 2
    strides = 2

    y1 = nn_ops.max_pool_v2(x, ksize, strides, "SAME")
    y2 = nn_ops.max_pool3d(x, ksize, strides, "SAME")

    self.assertAllEqual(self.evaluate(y1), self.evaluate(y2))
예제 #2
0
  def test3DTensor(self):
    x = array_ops.ones([3, 7, 6, 6, 5])
    ksize = 2
    strides = 2

    y1 = nn_ops.max_pool_v2(x, ksize, strides, "SAME")
    y2 = nn_ops.max_pool3d(x, ksize, strides, "SAME")

    self.assertAllEqual(self.evaluate(y1), self.evaluate(y2))
예제 #3
0
  def test3DNumpy(self):
    x = np.ones([3, 7, 6, 6, 5], dtype=np.float32)
    ksize = 2
    strides = 2

    y1 = nn_ops.max_pool_v2(x, ksize, strides, "SAME")
    y2 = nn_ops.max_pool3d(x, ksize, strides, "SAME")

    self.assertAllEqual(self.evaluate(y1), self.evaluate(y2))
예제 #4
0
  def test3DTensor(self):
    x = array_ops.ones([3, 7, 6, 6, 5])
    ksize = 2
    strides = 2

    y1 = nn_ops.max_pool_v2(x, ksize, strides, "SAME")
    y2 = nn_ops.max_pool3d(x, ksize, strides, "SAME")

    self.assertAllEqual(self.evaluate(y1), self.evaluate(y2))
예제 #5
0
def _max_pool_3d(_input,
                 kd=2,
                 kh=2,
                 kw=2,
                 sd=2,
                 sh=2,
                 sw=2,
                 name="max_pool_3d",
                 padding='SAME'):
    return nn_ops.max_pool3d(_input,
                             ksize=[1, kd, kh, kw, 1],
                             strides=[1, sd, sh, sw, 1],
                             padding=padding,
                             name=name)
예제 #6
0
    def testMaxPool3DEmptyTensorOutputShape(self):
        """Verifies the output shape of the max pooling function when tensor is empty.

    Args: none
    """
        input_sizes = [0, 112, 112, 112, 64]

        input_data = 1.
        input_tensor = constant_op.constant(input_data,
                                            shape=input_sizes,
                                            name="input")
        max_pool_3d = nn_ops.max_pool3d(input_tensor,
                                        ksize=[2, 2, 2],
                                        strides=[2, 2, 2],
                                        padding="VALID",
                                        data_format="NDHWC",
                                        name="max_pool_3d")
        values = self.evaluate(max_pool_3d)
        self.assertEqual(values.shape, (0, 56, 56, 56, 64))