@pytest.mark.level0
@pytest.mark.platform_x86_gpu_training
@pytest.mark.env_onecard
def test_ResizeNearestNeighborAlignCornerF():
    context.set_context(mode=context.PYNATIVE_MODE, device_target='GPU')
    input_tensor = Tensor(np.array([[[[1, 0], [0, 1]]]]).astype(np.float32))
    expect = np.array([[[[1, 1, 0, 0], [1, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]]]]).astype(np.float32)
    rnn = ResizeNearestNeighborAlignCornerF((4, 4))
    output = rnn(input_tensor)
    assert np.all((output.asnumpy() == expect))
    input_tensor = Tensor(np.array([[[[1, 0], [0, 1]]]]).astype(np.float16))
    expect = np.array([[[[1, 1, 0, 0], [1, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]]]]).astype(np.float16)
    rnn = ResizeNearestNeighborAlignCornerF((4, 4))
    output = rnn(input_tensor)
    assert np.all((output.asnumpy() == expect))
@pytest.mark.level0
@pytest.mark.platform_x86_gpu_training
@pytest.mark.env_onecard
def test_ResizeNearestNeighborAlignCornerF():
    context.set_context(mode=context.PYNATIVE_MODE, device_target='GPU')
    input_tensor = Tensor(np.array([[[[1, 0], [0, 1]]]]).astype(np.float32))
    expect = np.array([[[[1, 1, 0, 0], [1, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]]]]).astype(np.float32)
    rnn = ResizeNearestNeighborAlignCornerF((4, 4))
    output = rnn(input_tensor)
    assert np.all((output.asnumpy() == expect))
    input_tensor = Tensor(np.array([[[[1, 0], [0, 1]]]]).astype(np.float16))
    expect = np.array([[[[1, 1, 0, 0], [1, 1, 0, 0], [0, 0, 1, 1], [0, 0, 1, 1]]]]).astype(np.float16)
    rnn = ResizeNearestNeighborAlignCornerF((4, 4))
    output = rnn(input_tensor)
    assert np.all((output.asnumpy() == expect))