Skip to content

Commit

Permalink
Enable whole Tensor comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
t-jankowski committed Apr 4, 2024
1 parent e26b96b commit 7bac227
Showing 1 changed file with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,28 @@ struct DeformablePSROIPoolingParams {
inputType(iType),
roisType(iType),
outType(iType),
roisData(CreateTensor(iType, roisValues)),
testcaseName(test_name) {
outputDim = (channel_in / (group_size * group_size)) -
(static_cast<size_t>(channel_in / (group_size * group_size)) % 2);
inputShape = Shape{batch_in, channel_in, height_in, width_in};

roisShape = Shape{rois_dim, 5};
roisData = CreateTensor(roisShape, iType, roisValues);

std::vector<IT> inputValues(shape_size(inputShape.get_shape()));
std::vector<IT> inputValues(shape_size(inputShape));
if (is_input_generation_iota)
std::iota(inputValues.begin(), inputValues.end(), inputValue);
else
std::fill(inputValues.begin(), inputValues.end(), inputValue);
inputData = CreateTensor(iType, inputValues);
inputData = CreateTensor(inputShape, iType, inputValues);

const auto output_shape = Shape{rois_dim, outputDim, group_size, group_size};
if (oValues.size() > 1) {
refData = CreateTensor(iType, oValues);
refData = CreateTensor(output_shape, iType, oValues);
} else {
Shape output_shape{rois_dim, outputDim, group_size, group_size};
std::vector<IT> expected_output_values(shape_size(output_shape));
std::fill(expected_output_values.begin(), expected_output_values.end(), oValues[0]);
refData = CreateTensor(iType, expected_output_values);
refData = CreateTensor(output_shape, iType, expected_output_values);
}
}

Expand Down Expand Up @@ -100,31 +101,32 @@ struct DeformablePSROIPoolingParams {
roisType(iType),
offsetsType(iType),
outType(iType),
roisData(CreateTensor(iType, roisValues)),
testcaseName(test_name) {
outputDim = (channel_in / (group_size * group_size)) - ((channel_in / (group_size * group_size)) % 2);
inputShape = Shape{batch_in, channel_in, height_in, width_in};
roisShape = Shape{rois_dim, 5};
offsetsShape = Shape{rois_dim, 2, group_size, group_size};

std::vector<IT> inputValues(shape_size(inputShape.get_shape()));
roisShape = Shape{rois_dim, 5};
roisData = CreateTensor(roisShape, iType, roisValues);

std::vector<IT> inputValues(shape_size(inputShape));
if (is_input_generation_iota)
std::iota(inputValues.begin(), inputValues.end(), inputValue);
else
std::fill(inputValues.begin(), inputValues.end(), inputValue);
inputData = CreateTensor(iType, inputValues);
inputData = CreateTensor(inputShape, iType, inputValues);

std::vector<IT> offsetsValues(shape_size(offsetsShape.get_shape()));
std::vector<IT> offsetsValues(shape_size(offsetsShape));
std::fill(offsetsValues.begin(), offsetsValues.end(), offsetValue);
offsetsData = CreateTensor(iType, offsetsValues);
offsetsData = CreateTensor(offsetsShape, iType, offsetsValues);

const auto output_shape = Shape{rois_dim, outputDim, group_size, group_size};
if (oValues.size() > 1) {
refData = CreateTensor(iType, oValues);
refData = CreateTensor(output_shape, iType, oValues);
} else {
Shape output_shape{rois_dim, outputDim, group_size, group_size};
std::vector<IT> expected_output_values(shape_size(output_shape));
std::fill(expected_output_values.begin(), expected_output_values.end(), oValues[0]);
refData = CreateTensor(iType, expected_output_values);
refData = CreateTensor(output_shape, iType, expected_output_values);
}
}

Expand All @@ -137,9 +139,9 @@ struct DeformablePSROIPoolingParams {
int64_t partSize;

std::string mode;
ov::PartialShape inputShape;
ov::PartialShape roisShape;
ov::PartialShape offsetsShape;
ov::Shape inputShape;
ov::Shape roisShape;
ov::Shape offsetsShape;
ov::element::Type inputType;
ov::element::Type roisType;
ov::element::Type offsetsType;
Expand All @@ -155,8 +157,7 @@ class ReferenceDeformablePSROIPoolingLayerTest : public testing::TestWithParam<D
public CommonReferenceTest {
public:
void SetUp() override {
legacy_compare = true;
auto params = GetParam();
const auto& params = GetParam();
function = CreateFunction(params);
if (params.offsetsShape.size() != 0)
inputData = {params.inputData, params.roisData, params.offsetsData};
Expand All @@ -165,7 +166,7 @@ class ReferenceDeformablePSROIPoolingLayerTest : public testing::TestWithParam<D
refOutData = {params.refData};
}
static std::string getTestCaseName(const testing::TestParamInfo<DeformablePSROIPoolingParams>& obj) {
auto param = obj.param;
const auto& param = obj.param;
std::ostringstream result;
result << "inputShape=" << param.inputShape << "_";
result << "roiShape=" << param.roisShape << "_";
Expand Down

0 comments on commit 7bac227

Please sign in to comment.