Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fq ref fix #24

Merged
merged 1 commit into from
Nov 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const std::vector<ReshapeTransformationParam> params = {
{
ngraph::Shape{ 1, 3, 32 },
{ 1, 3, 4, 8 },
{ 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
{ 256ul, ngraph::Shape{ 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
},
// 4D -> 3D
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,27 @@ namespace {

const std::vector<LayerTestsDefinitions::UnsqueezeTransformationParam> params = {
{
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 256ul, ngraph::Shape { 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 0.0, 3.0 },
{ 3, 3, 5}
},
{
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 256ul, ngraph::Shape { 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 0.0, 1.0 },
{ 3, 3, 3 }
},
{
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 256ul, ngraph::Shape { 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 3.0 },
{ 3, 4, 5, 6 }
},
{
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 256ul, ngraph::Shape { 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 0.0, 3.0 },
{ 1, 32, 2}
},
{
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 256ul, ngraph::Shape { 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 0.0, 1.0 },
{ 46, 128, 2 }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@ namespace ngraph
{
broadcast_offsets[i] = memory_offsets[i];
}
else
{
broadcast_offsets[i] = std::accumulate(broadcast_offsets.begin() + i,
broadcast_offsets.end(),
0,
std::plus<size_t>());
}
}
if (!std::all_of(broadcast_shape.begin(),
broadcast_shape.end(),
Expand All @@ -58,6 +51,17 @@ namespace ngraph
{
broadcast_offsets[broadcast_offsets.size() - 1] = 1;
}
if (broadcast_shape.back() == 1)
{
for (int i = broadcast_shape.size() - 1; i >= 0; --i)
{
if (broadcast_shape[i] != 1)
{
broadcast_offsets[i] = memory_offsets[i] - 1;
break;
}
}
}
return broadcast_offsets;
}

Expand Down Expand Up @@ -115,6 +119,18 @@ namespace ngraph
Shape in_high_shape(_in_high_shape);
Shape out_low_shape(_out_low_shape);
Shape out_high_shape(_out_high_shape);

if (in_low_shape.size() > arg_shape.size() ||
in_high_shape.size() > arg_shape.size() ||
out_low_shape.size() > arg_shape.size() ||
out_high_shape.size() > arg_shape.size())
{
throw std::runtime_error(
std::string("Tensors with inout\\output ranges should have rank less or "
"equal to data tensor rank equal to ") +
std::to_string(arg_shape.size()));
}

std::vector<size_t> arg_memory_offsets(arg_shape.size(), 0);
for (int i = arg_shape.size() - 2; i >= 0; i--)
{
Expand Down Expand Up @@ -184,9 +200,10 @@ namespace ngraph
else
{
size_t index_offset = calc_full_broadcast_offset(current_dim, offsets);

NGRAPH_CHECK(idx >= index_offset && index_offset < shape_size(offsets),
"Incorrect index offset value!");
if (index_offset != 0)
{
NGRAPH_CHECK(idx >= index_offset, "Incorrect index offset value!");
}
val = data[idx - index_offset];
}
return val;
Expand Down
2 changes: 0 additions & 2 deletions ngraph/test/runtime/interpreter/unit_test.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ onnx_model_lstm_bdir_short_input_seq_peepholes
lstm_cell_bias_peepholes
lstm_cell_bias_peepholes_clip_input_forget

# Refs mismatch
quant_dequant_pattern_axis

# Check 'n_data_channels % groups == 0' failed
dyn_group_convolution_backprop_data
Expand Down