* add m1 mac pipelines as a matrix parameter * Update mac.yml disable java_api because of macos arm64 - Java is not available on macOS arm64 runners * Update mac.yml added always condition for all tests * Update mac.yml * Update mac.yml * Update mac.yml * Update setup.py temp commit * Update tools/openvino_dev/setup.py * use matrix for var * add mxnet to extras only for x86_64 * skip failing tests * use xfail for Python tests; add missing filter for transformations tests * skip CPU func tests on x86_64 mac; skip some tests from CPU func tests on arm mac * Update mac.yml * skip tests on mac arm * skip tests on darwin; apply review * add more skips for python and c++ tests * skip tf tests * skip more tf tests; skip more Python UT stages * rm alwayses, rm triggers, add nightly trigger --------- Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
46 lines
1.9 KiB
Python
46 lines
1.9 KiB
Python
# Copyright (C) 2018-2023 Intel Corporation
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
import platform
|
|
|
|
import pytest
|
|
|
|
from pytorch_layer_test_class import PytorchLayerTest
|
|
|
|
|
|
class TestGridSampler(PytorchLayerTest):
|
|
def _prepare_input(self, h_in, w_in, h_out, w_out):
|
|
import numpy as np
|
|
return (np.random.randn(1, 3, h_in, w_in).astype(np.float32), np.random.randn(1, h_out, w_out, 2).astype(np.float32))
|
|
|
|
def create_model(self, mode, padding_mode, align_corners):
|
|
import torch
|
|
import torch.nn.functional as F
|
|
|
|
class aten_grid_sampler(torch.nn.Module):
|
|
def __init__(self, mode, padding_mode, align_corners):
|
|
super(aten_grid_sampler, self).__init__()
|
|
self.mode = mode
|
|
self.padding_mode = padding_mode
|
|
self.align_corners = align_corners
|
|
|
|
def forward(self, input, grid):
|
|
return F.grid_sample(input, grid, self.mode, self.padding_mode, self.align_corners)
|
|
|
|
ref_net = None
|
|
|
|
return aten_grid_sampler(mode, padding_mode, align_corners), ref_net, "aten::grid_sampler"
|
|
|
|
@pytest.mark.parametrize(["h_in", "w_in", "h_out", "w_out"], ([10, 10, 5, 5], [10, 15, 3, 5]))
|
|
@pytest.mark.parametrize("mode", ["bilinear", "nearest", "bicubic"])
|
|
@pytest.mark.parametrize("padding_mode", ["zeros", "border", "reflection"])
|
|
@pytest.mark.parametrize("align_corners", [True, False, None])
|
|
@pytest.mark.nightly
|
|
@pytest.mark.precommit
|
|
@pytest.mark.xfail(condition=platform.system() == 'Darwin' and platform.machine() == 'arm64',
|
|
reason='Ticket - 122715')
|
|
def test_grid_sampler(self, h_in, w_in, h_out, w_out, mode, padding_mode, align_corners, ie_device, precision, ir_version):
|
|
self._test(*self.create_model(mode, padding_mode, align_corners), ie_device, precision, ir_version, kwargs_to_prepare_input={
|
|
"h_in": h_in, "w_in": w_in, "h_out": h_out, "w_out": w_out
|
|
})
|