Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
b65e32e2
Commit
b65e32e2
authored
Jun 18, 2019
by
nishant.b.patel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add back the type_prop tests
parent
bd4f627b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
606 additions
and
0 deletions
+606
-0
type_prop.cpp
test/type_prop.cpp
+606
-0
No files found.
test/type_prop.cpp
View file @
b65e32e2
...
@@ -15263,3 +15263,609 @@ TEST(type_prop, group_conv_transpose_invalid_params)
...
@@ -15263,3 +15263,609 @@ TEST(type_prop, group_conv_transpose_invalid_params)
std
::
string
(
"Output padding should be of number of input data features size."
));
std
::
string
(
"Output padding should be of number of input data features size."
));
}
}
}
}
TEST
(
type_prop
,
quantized_conv_8_bit_output
)
{
auto
strides
=
Strides
{
1
,
1
};
auto
dilation
=
Strides
{
1
,
1
};
auto
padding_below
=
CoordinateDiff
{
1
,
1
};
auto
padding_above
=
CoordinateDiff
{
1
,
1
};
element
::
Type
f32
=
element
::
f32
;
element
::
Type
i8
=
element
::
i8
;
element
::
Type
u8
=
element
::
u8
;
element
::
Type
input_type
=
u8
;
element
::
Type
filter_type
=
i8
;
element
::
Type
output_type
=
i8
;
element
::
Type
scale_type
=
f32
;
element
::
Type
input_zero_point_type
=
u8
;
element
::
Type
filter_zero_point_type
=
i8
;
element
::
Type
output_zero_point_type
=
i8
;
Shape
output_shape
{
64
,
64
,
220
,
220
};
AxisSet
axes
{};
auto
input
=
make_shared
<
op
::
Parameter
>
(
input_type
,
Shape
{
64
,
3
,
224
,
224
});
auto
filter
=
make_shared
<
op
::
Parameter
>
(
filter_type
,
Shape
{
64
,
3
,
7
,
7
});
auto
scale
=
make_shared
<
op
::
Parameter
>
(
scale_type
,
Shape
{});
auto
i8_zero_point
=
make_shared
<
op
::
Parameter
>
(
element
::
i8
,
Shape
{});
auto
u8_zero_point
=
make_shared
<
op
::
Parameter
>
(
element
::
u8
,
Shape
{});
auto
quant_conv
=
make_shared
<
op
::
QuantizedConvolution
>
(
input
,
filter
,
strides
,
dilation
,
padding_below
,
padding_above
,
dilation
,
scale
,
u8_zero_point
,
scale
,
i8_zero_point
,
scale
,
i8_zero_point
,
output_type
,
axes
,
axes
,
axes
);
ASSERT_EQ
(
quant_conv
->
get_element_type
(),
output_type
);
ASSERT_EQ
(
quant_conv
->
get_shape
(),
output_shape
);
}
TEST
(
type_prop
,
quantized_conv_32_bit_output
)
{
auto
strides
=
Strides
{
1
,
1
};
auto
dilation
=
Strides
{
1
,
1
};
auto
padding_below
=
CoordinateDiff
{
1
,
1
};
auto
padding_above
=
CoordinateDiff
{
1
,
1
};
element
::
Type
f32
=
element
::
f32
;
element
::
Type
i8
=
element
::
i8
;
element
::
Type
u8
=
element
::
u8
;
element
::
Type
i32
=
element
::
i32
;
element
::
Type
input_type
=
u8
;
element
::
Type
filter_type
=
i8
;
element
::
Type
output_type
=
i32
;
element
::
Type
scale_type
=
f32
;
element
::
Type
input_zero_point_type
=
u8
;
element
::
Type
filter_zero_point_type
=
i8
;
element
::
Type
output_zero_point_type
=
i8
;
Shape
output_shape
{
64
,
64
,
220
,
220
};
AxisSet
axes
{};
auto
input
=
make_shared
<
op
::
Parameter
>
(
input_type
,
Shape
{
64
,
3
,
224
,
224
});
auto
filter
=
make_shared
<
op
::
Parameter
>
(
filter_type
,
Shape
{
64
,
3
,
7
,
7
});
auto
scale
=
make_shared
<
op
::
Parameter
>
(
scale_type
,
Shape
{});
auto
i8_zero_point
=
make_shared
<
op
::
Parameter
>
(
element
::
i8
,
Shape
{});
auto
u8_zero_point
=
make_shared
<
op
::
Parameter
>
(
element
::
u8
,
Shape
{});
auto
quant_conv
=
make_shared
<
op
::
QuantizedConvolution
>
(
input
,
filter
,
strides
,
dilation
,
padding_below
,
padding_above
,
dilation
,
scale
,
u8_zero_point
,
scale
,
i8_zero_point
,
scale
,
i8_zero_point
,
output_type
,
axes
,
axes
,
axes
);
ASSERT_EQ
(
quant_conv
->
get_element_type
(),
output_type
);
ASSERT_EQ
(
quant_conv
->
get_shape
(),
output_shape
);
}
TEST
(
type_prop
,
quantized_conv_non_quantized_input_fails
)
{
auto
strides
=
Strides
{
1
,
1
};
auto
dilation
=
Strides
{
1
,
1
};
auto
padding_below
=
CoordinateDiff
{
1
,
1
};
auto
padding_above
=
CoordinateDiff
{
1
,
1
};
element
::
Type
f32
=
element
::
f32
;
element
::
Type
i8
=
element
::
i8
;
element
::
Type
u8
=
element
::
u8
;
element
::
Type
input_type
=
f32
;
element
::
Type
filter_type
=
i8
;
element
::
Type
output_type
=
i8
;
element
::
Type
scale_type
=
f32
;
element
::
Type
input_zero_point_type
=
u8
;
element
::
Type
filter_zero_point_type
=
i8
;
element
::
Type
output_zero_point_type
=
i8
;
Shape
output_shape
{
64
,
64
,
220
,
220
};
AxisSet
axes
{};
auto
input
=
make_shared
<
op
::
Parameter
>
(
input_type
,
Shape
{
64
,
3
,
224
,
224
});
auto
filter
=
make_shared
<
op
::
Parameter
>
(
filter_type
,
Shape
{
64
,
3
,
7
,
7
});
auto
scale
=
make_shared
<
op
::
Parameter
>
(
scale_type
,
Shape
{});
auto
i8_zero_point
=
make_shared
<
op
::
Parameter
>
(
element
::
i8
,
Shape
{});
auto
u8_zero_point
=
make_shared
<
op
::
Parameter
>
(
element
::
u8
,
Shape
{});
try
{
auto
quant_conv
=
make_shared
<
op
::
QuantizedConvolution
>
(
input
,
filter
,
strides
,
dilation
,
padding_below
,
padding_above
,
dilation
,
scale
,
u8_zero_point
,
scale
,
i8_zero_point
,
scale
,
i8_zero_point
,
output_type
,
axes
,
axes
,
axes
);
FAIL
()
<<
"Attempt to use non-quantized input not detected"
;
}
catch
(
const
NodeValidationFailure
&
error
)
{
EXPECT_HAS_SUBSTRING
(
error
.
what
(),
"Input element type (element::Type{32, 1, 1, 0,
\"
float
\"
}) "
"must be a quantized type"
);
}
catch
(...)
{
FAIL
()
<<
"Deduced type check failed for unexpected reason"
;
}
}
TEST
(
type_prop
,
quantized_conv_non_quantized_filter_fails
)
{
auto
strides
=
Strides
{
1
,
1
};
auto
dilation
=
Strides
{
1
,
1
};
auto
padding_below
=
CoordinateDiff
{
1
,
1
};
auto
padding_above
=
CoordinateDiff
{
1
,
1
};
element
::
Type
f32
=
element
::
f32
;
element
::
Type
i8
=
element
::
i8
;
element
::
Type
u8
=
element
::
u8
;
element
::
Type
input_type
=
u8
;
element
::
Type
filter_type
=
f32
;
element
::
Type
output_type
=
i8
;
element
::
Type
scale_type
=
f32
;
element
::
Type
input_zero_point_type
=
u8
;
element
::
Type
filter_zero_point_type
=
i8
;
element
::
Type
output_zero_point_type
=
i8
;
Shape
output_shape
{
64
,
64
,
220
,
220
};
AxisSet
axes
{};
auto
input
=
make_shared
<
op
::
Parameter
>
(
input_type
,
Shape
{
64
,
3
,
224
,
224
});
auto
filter
=
make_shared
<
op
::
Parameter
>
(
filter_type
,
Shape
{
64
,
3
,
7
,
7
});
auto
scale
=
make_shared
<
op
::
Parameter
>
(
scale_type
,
Shape
{});
auto
i8_zero_point
=
make_shared
<
op
::
Parameter
>
(
element
::
i8
,
Shape
{});
auto
u8_zero_point
=
make_shared
<
op
::
Parameter
>
(
element
::
u8
,
Shape
{});
try
{
auto
quant_conv
=
make_shared
<
op
::
QuantizedConvolution
>
(
input
,
filter
,
strides
,
dilation
,
padding_below
,
padding_above
,
dilation
,
scale
,
u8_zero_point
,
scale
,
i8_zero_point
,
scale
,
i8_zero_point
,
output_type
,
axes
,
axes
,
axes
);
FAIL
()
<<
"Attempt to use non-quantized filter not detected"
;
}
catch
(
const
NodeValidationFailure
&
error
)
{
EXPECT_HAS_SUBSTRING
(
error
.
what
(),
"Filter element type (element::Type{32, 1, 1, 0,
\"
float
\"
}) "
"must be a quantized type"
);
}
catch
(...)
{
FAIL
()
<<
"Deduced type check failed for unexpected reason"
;
}
}
TEST
(
type_prop
,
quantized_conv_dyn_output_fails
)
{
auto
strides
=
Strides
{
1
,
1
};
auto
dilation
=
Strides
{
1
,
1
};
auto
padding_below
=
CoordinateDiff
{
1
,
1
};
auto
padding_above
=
CoordinateDiff
{
1
,
1
};
element
::
Type
f32
=
element
::
f32
;
element
::
Type
i8
=
element
::
i8
;
element
::
Type
u8
=
element
::
u8
;
element
::
Type
input_type
=
u8
;
element
::
Type
filter_type
=
f32
;
element
::
Type
output_type
=
element
::
dynamic
;
element
::
Type
scale_type
=
f32
;
element
::
Type
input_zero_point_type
=
u8
;
element
::
Type
filter_zero_point_type
=
i8
;
element
::
Type
output_zero_point_type
=
i8
;
Shape
output_shape
{
64
,
64
,
220
,
220
};
AxisSet
axes
{};
auto
input
=
make_shared
<
op
::
Parameter
>
(
input_type
,
Shape
{
64
,
3
,
224
,
224
});
auto
filter
=
make_shared
<
op
::
Parameter
>
(
filter_type
,
Shape
{
64
,
3
,
7
,
7
});
auto
scale
=
make_shared
<
op
::
Parameter
>
(
scale_type
,
Shape
{});
auto
i8_zero_point
=
make_shared
<
op
::
Parameter
>
(
element
::
i8
,
Shape
{});
auto
u8_zero_point
=
make_shared
<
op
::
Parameter
>
(
element
::
u8
,
Shape
{});
try
{
auto
quant_conv
=
make_shared
<
op
::
QuantizedConvolution
>
(
input
,
filter
,
strides
,
dilation
,
padding_below
,
padding_above
,
dilation
,
scale
,
u8_zero_point
,
scale
,
i8_zero_point
,
scale
,
i8_zero_point
,
output_type
,
axes
,
axes
,
axes
);
FAIL
()
<<
"Attempt to use dynamic output type not detected"
;
}
catch
(
const
NodeValidationFailure
&
error
)
{
EXPECT_HAS_SUBSTRING
(
error
.
what
(),
"Output element type must not be dynamic"
);
}
catch
(...)
{
FAIL
()
<<
"Deduced type check failed for unexpected reason"
;
}
}
TEST
(
type_prop
,
quantized_conv_non_floating_point_scale_fails
)
{
auto
strides
=
Strides
{
1
,
1
};
auto
dilation
=
Strides
{
1
,
1
};
auto
padding_below
=
CoordinateDiff
{
1
,
1
};
auto
padding_above
=
CoordinateDiff
{
1
,
1
};
element
::
Type
f32
=
element
::
f32
;
element
::
Type
i8
=
element
::
i8
;
element
::
Type
u8
=
element
::
u8
;
element
::
Type
input_type
=
u8
;
element
::
Type
filter_type
=
i8
;
element
::
Type
output_type
=
i8
;
element
::
Type
scale_type
=
i8
;
element
::
Type
input_zero_point_type
=
u8
;
element
::
Type
filter_zero_point_type
=
i8
;
element
::
Type
output_zero_point_type
=
i8
;
Shape
output_shape
{
64
,
64
,
220
,
220
};
AxisSet
axes
{};
auto
input
=
make_shared
<
op
::
Parameter
>
(
input_type
,
Shape
{
64
,
3
,
224
,
224
});
auto
filter
=
make_shared
<
op
::
Parameter
>
(
filter_type
,
Shape
{
64
,
3
,
7
,
7
});
auto
scale
=
make_shared
<
op
::
Parameter
>
(
scale_type
,
Shape
{});
auto
i8_zero_point
=
make_shared
<
op
::
Parameter
>
(
element
::
i8
,
Shape
{});
auto
u8_zero_point
=
make_shared
<
op
::
Parameter
>
(
element
::
u8
,
Shape
{});
try
{
auto
quant_conv
=
make_shared
<
op
::
QuantizedConvolution
>
(
input
,
filter
,
strides
,
dilation
,
padding_below
,
padding_above
,
dilation
,
scale
,
u8_zero_point
,
scale
,
i8_zero_point
,
scale
,
i8_zero_point
,
output_type
,
axes
,
axes
,
axes
);
FAIL
()
<<
"Attempt to use non floating point scale not detected"
;
}
catch
(
const
NodeValidationFailure
&
error
)
{
EXPECT_HAS_SUBSTRING
(
error
.
what
(),
"Scale must be a floating point number"
);
}
catch
(...)
{
FAIL
()
<<
"Deduced type check failed for unexpected reason"
;
}
}
TEST
(
type_prop
,
quantized_conv_input_zero_point_type_mismatch_fails
)
{
auto
strides
=
Strides
{
1
,
1
};
auto
dilation
=
Strides
{
1
,
1
};
auto
padding_below
=
CoordinateDiff
{
1
,
1
};
auto
padding_above
=
CoordinateDiff
{
1
,
1
};
element
::
Type
f32
=
element
::
f32
;
element
::
Type
i8
=
element
::
i8
;
element
::
Type
u8
=
element
::
u8
;
element
::
Type
input_type
=
u8
;
element
::
Type
filter_type
=
i8
;
element
::
Type
output_type
=
i8
;
element
::
Type
scale_type
=
f32
;
element
::
Type
input_zero_point_type
=
i8
;
element
::
Type
filter_zero_point_type
=
i8
;
element
::
Type
output_zero_point_type
=
i8
;
Shape
output_shape
{
64
,
64
,
220
,
220
};
AxisSet
axes
{};
auto
input
=
make_shared
<
op
::
Parameter
>
(
input_type
,
Shape
{
64
,
3
,
224
,
224
});
auto
filter
=
make_shared
<
op
::
Parameter
>
(
filter_type
,
Shape
{
64
,
3
,
7
,
7
});
auto
scale
=
make_shared
<
op
::
Parameter
>
(
scale_type
,
Shape
{});
auto
input_zero_point
=
make_shared
<
op
::
Parameter
>
(
input_zero_point_type
,
Shape
{});
auto
filter_zero_point
=
make_shared
<
op
::
Parameter
>
(
filter_zero_point_type
,
Shape
{});
auto
output_zero_point
=
make_shared
<
op
::
Parameter
>
(
output_zero_point_type
,
Shape
{});
try
{
auto
quant_conv
=
make_shared
<
op
::
QuantizedConvolution
>
(
input
,
filter
,
strides
,
dilation
,
padding_below
,
padding_above
,
dilation
,
scale
,
input_zero_point
,
scale
,
filter_zero_point
,
scale
,
output_zero_point
,
output_type
,
axes
,
axes
,
axes
);
FAIL
()
<<
"Attempt to use zero point type different from input type not detected"
;
}
catch
(
const
NodeValidationFailure
&
error
)
{
EXPECT_HAS_SUBSTRING
(
error
.
what
(),
"Input Zero point element type (element::Type{8, 0, 1, 1,
\"
int8_t
\"
}) must "
"match input element type (element::Type{8, 0, 0, 1,
\"
uint8_t
\"
})"
);
}
catch
(...)
{
FAIL
()
<<
"Deduced type check failed for unexpected reason"
;
}
}
TEST
(
type_prop
,
quantized_conv_filter_zero_point_type_mismatch_fails
)
{
auto
strides
=
Strides
{
1
,
1
};
auto
dilation
=
Strides
{
1
,
1
};
auto
padding_below
=
CoordinateDiff
{
1
,
1
};
auto
padding_above
=
CoordinateDiff
{
1
,
1
};
element
::
Type
f32
=
element
::
f32
;
element
::
Type
i8
=
element
::
i8
;
element
::
Type
u8
=
element
::
u8
;
element
::
Type
input_type
=
u8
;
element
::
Type
filter_type
=
i8
;
element
::
Type
output_type
=
i8
;
element
::
Type
scale_type
=
f32
;
element
::
Type
input_zero_point_type
=
u8
;
element
::
Type
filter_zero_point_type
=
u8
;
element
::
Type
output_zero_point_type
=
i8
;
Shape
output_shape
{
64
,
64
,
220
,
220
};
AxisSet
axes
{};
auto
input
=
make_shared
<
op
::
Parameter
>
(
input_type
,
Shape
{
64
,
3
,
224
,
224
});
auto
filter
=
make_shared
<
op
::
Parameter
>
(
filter_type
,
Shape
{
64
,
3
,
7
,
7
});
auto
scale
=
make_shared
<
op
::
Parameter
>
(
scale_type
,
Shape
{});
auto
input_zero_point
=
make_shared
<
op
::
Parameter
>
(
input_zero_point_type
,
Shape
{});
auto
filter_zero_point
=
make_shared
<
op
::
Parameter
>
(
filter_zero_point_type
,
Shape
{});
auto
output_zero_point
=
make_shared
<
op
::
Parameter
>
(
output_zero_point_type
,
Shape
{});
try
{
auto
quant_conv
=
make_shared
<
op
::
QuantizedConvolution
>
(
input
,
filter
,
strides
,
dilation
,
padding_below
,
padding_above
,
dilation
,
scale
,
input_zero_point
,
scale
,
filter_zero_point
,
scale
,
output_zero_point
,
output_type
,
axes
,
axes
,
axes
);
FAIL
()
<<
"Attempt to use zero point type different from filter type not detected"
;
}
catch
(
const
NodeValidationFailure
&
error
)
{
EXPECT_HAS_SUBSTRING
(
error
.
what
(),
"Filter Zero point element type (element::Type{8, 0, 0, 1,
\"
uint8_t
\"
}) must "
"match filter element type (element::Type{8, 0, 1, 1,
\"
int8_t
\"
})"
);
}
catch
(...)
{
FAIL
()
<<
"Deduced type check failed for unexpected reason"
;
}
}
TEST
(
type_prop
,
quantized_conv_non_scalar_input_zero_point_fails
)
{
auto
strides
=
Strides
{
1
,
1
};
auto
dilation
=
Strides
{
1
,
1
};
auto
padding_below
=
CoordinateDiff
{
1
,
1
};
auto
padding_above
=
CoordinateDiff
{
1
,
1
};
element
::
Type
f32
=
element
::
f32
;
element
::
Type
i8
=
element
::
i8
;
element
::
Type
u8
=
element
::
u8
;
element
::
Type
input_type
=
u8
;
element
::
Type
filter_type
=
i8
;
element
::
Type
output_type
=
i8
;
element
::
Type
scale_type
=
f32
;
element
::
Type
input_zero_point_type
=
u8
;
element
::
Type
filter_zero_point_type
=
i8
;
element
::
Type
output_zero_point_type
=
i8
;
Shape
output_shape
{
64
,
64
,
220
,
220
};
AxisSet
axes
{};
auto
input
=
make_shared
<
op
::
Parameter
>
(
input_type
,
Shape
{
64
,
3
,
224
,
224
});
auto
filter
=
make_shared
<
op
::
Parameter
>
(
filter_type
,
Shape
{
64
,
3
,
7
,
7
});
auto
scale
=
make_shared
<
op
::
Parameter
>
(
scale_type
,
Shape
{});
auto
input_zero_point
=
make_shared
<
op
::
Parameter
>
(
input_zero_point_type
,
Shape
{
1
,
2
});
auto
filter_zero_point
=
make_shared
<
op
::
Parameter
>
(
filter_zero_point_type
,
Shape
{});
auto
output_zero_point
=
make_shared
<
op
::
Parameter
>
(
output_zero_point_type
,
Shape
{});
try
{
auto
quant_conv
=
make_shared
<
op
::
QuantizedConvolution
>
(
input
,
filter
,
strides
,
dilation
,
padding_below
,
padding_above
,
dilation
,
scale
,
input_zero_point
,
scale
,
filter_zero_point
,
scale
,
output_zero_point
,
output_type
,
axes
,
axes
,
axes
);
FAIL
()
<<
"Attempt to use non scalar input zero point not detected"
;
}
catch
(
const
NodeValidationFailure
&
error
)
{
EXPECT_HAS_SUBSTRING
(
error
.
what
(),
"Input scale and input zero point shape must be same and 1"
);
}
catch
(...)
{
FAIL
()
<<
"Deduced type check failed for unexpected reason"
;
}
}
TEST
(
type_prop
,
quantized_conv_non_scalar_filter_zero_point_fails
)
{
auto
strides
=
Strides
{
1
,
1
};
auto
dilation
=
Strides
{
1
,
1
};
auto
padding_below
=
CoordinateDiff
{
1
,
1
};
auto
padding_above
=
CoordinateDiff
{
1
,
1
};
element
::
Type
f32
=
element
::
f32
;
element
::
Type
i8
=
element
::
i8
;
element
::
Type
u8
=
element
::
u8
;
element
::
Type
input_type
=
u8
;
element
::
Type
filter_type
=
i8
;
element
::
Type
output_type
=
i8
;
element
::
Type
scale_type
=
f32
;
element
::
Type
input_zero_point_type
=
u8
;
element
::
Type
filter_zero_point_type
=
i8
;
element
::
Type
output_zero_point_type
=
i8
;
Shape
output_shape
{
64
,
64
,
220
,
220
};
AxisSet
axes
{};
auto
input
=
make_shared
<
op
::
Parameter
>
(
input_type
,
Shape
{
64
,
3
,
224
,
224
});
auto
filter
=
make_shared
<
op
::
Parameter
>
(
filter_type
,
Shape
{
64
,
3
,
7
,
7
});
auto
scale
=
make_shared
<
op
::
Parameter
>
(
scale_type
,
Shape
{});
auto
input_zero_point
=
make_shared
<
op
::
Parameter
>
(
input_zero_point_type
,
Shape
{});
auto
filter_zero_point
=
make_shared
<
op
::
Parameter
>
(
filter_zero_point_type
,
Shape
{
1
,
2
});
auto
output_zero_point
=
make_shared
<
op
::
Parameter
>
(
output_zero_point_type
,
Shape
{});
try
{
auto
quant_conv
=
make_shared
<
op
::
QuantizedConvolution
>
(
input
,
filter
,
strides
,
dilation
,
padding_below
,
padding_above
,
dilation
,
scale
,
input_zero_point
,
scale
,
filter_zero_point
,
scale
,
output_zero_point
,
output_type
,
axes
,
axes
,
axes
);
FAIL
()
<<
"Attempt to use non scalar filter zero point not detected"
;
}
catch
(
const
NodeValidationFailure
&
error
)
{
EXPECT_HAS_SUBSTRING
(
error
.
what
(),
"Filter scale and filter zero point shape must be same and 1"
);
}
catch
(...)
{
FAIL
()
<<
"Deduced type check failed for unexpected reason"
;
}
}
TEST
(
type_prop
,
quantized_conv_non_scalar_output_zero_point_fails
)
{
auto
strides
=
Strides
{
1
,
1
};
auto
dilation
=
Strides
{
1
,
1
};
auto
padding_below
=
CoordinateDiff
{
1
,
1
};
auto
padding_above
=
CoordinateDiff
{
1
,
1
};
element
::
Type
f32
=
element
::
f32
;
element
::
Type
i8
=
element
::
i8
;
element
::
Type
u8
=
element
::
u8
;
element
::
Type
input_type
=
u8
;
element
::
Type
filter_type
=
i8
;
element
::
Type
output_type
=
i8
;
element
::
Type
scale_type
=
f32
;
element
::
Type
input_zero_point_type
=
u8
;
element
::
Type
filter_zero_point_type
=
i8
;
element
::
Type
output_zero_point_type
=
i8
;
Shape
output_shape
{
64
,
64
,
220
,
220
};
AxisSet
axes
{};
auto
input
=
make_shared
<
op
::
Parameter
>
(
input_type
,
Shape
{
64
,
3
,
224
,
224
});
auto
filter
=
make_shared
<
op
::
Parameter
>
(
filter_type
,
Shape
{
64
,
3
,
7
,
7
});
auto
scale
=
make_shared
<
op
::
Parameter
>
(
scale_type
,
Shape
{});
auto
input_zero_point
=
make_shared
<
op
::
Parameter
>
(
input_zero_point_type
,
Shape
{});
auto
filter_zero_point
=
make_shared
<
op
::
Parameter
>
(
filter_zero_point_type
,
Shape
{});
auto
output_zero_point
=
make_shared
<
op
::
Parameter
>
(
output_zero_point_type
,
Shape
{
1
,
2
});
try
{
auto
quant_conv
=
make_shared
<
op
::
QuantizedConvolution
>
(
input
,
filter
,
strides
,
dilation
,
padding_below
,
padding_above
,
dilation
,
scale
,
input_zero_point
,
scale
,
filter_zero_point
,
scale
,
output_zero_point
,
output_type
,
axes
,
axes
,
axes
);
FAIL
()
<<
"Attempt to use non scalar output zero point not detected"
;
}
catch
(
const
NodeValidationFailure
&
error
)
{
EXPECT_HAS_SUBSTRING
(
error
.
what
(),
"Output scale and output zero point shape must be same and 1"
);
}
catch
(...)
{
FAIL
()
<<
"Deduced type check failed for unexpected reason"
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment