mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-29 23:06:41 +00:00
User/xianz/fixbuild (#4906)
* support Normalized_0_1 and Normalized_1_1 * add tests for Normalized_1_1 * fix build error * fix imagetests failure * support denterization and add more tests * fix build * remove added models * disable gpu tests for CPU pipeline * refactor based on comments and moved two added models * merge normalizer and Denomalizer into NominalRangeConverter * add comments * little change * fix build failure for amd64
This commit is contained in:
parent
1161c4d75f
commit
170fee0987
2 changed files with 8 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ namespace _winml {
|
|||
return val / scale - shift;
|
||||
}
|
||||
|
||||
#if defined(_M_AMD64) || defined(_M_IX86)
|
||||
__m128 NominalRangeConverter::Normalize(__m128 sse_data) const {
|
||||
__m128 sse_shift = _mm_set1_ps(shift);
|
||||
__m128 sse_scale = _mm_set1_ps(scale);
|
||||
|
|
@ -37,6 +38,7 @@ namespace _winml {
|
|||
auto sse_dived = _mm_div_ps(sse_data, sse_scale);
|
||||
return _mm_sub_ps(sse_dived, sse_shift);
|
||||
}
|
||||
#endif
|
||||
|
||||
// [0, 255] --> [0, 255]
|
||||
// ([0, 1] + 0 ) * 255 -> [0, 1]
|
||||
|
|
@ -49,6 +51,7 @@ namespace _winml {
|
|||
return scale * (val + shift);
|
||||
}
|
||||
|
||||
#if defined(_M_AMD64) || defined(_M_IX86)
|
||||
__m128 NominalRangeConverter::Denormalize(__m128 sse_data) const {
|
||||
__m128 sse_shift = _mm_set1_ps(shift);
|
||||
__m128 sse_scale = _mm_set1_ps(scale);
|
||||
|
|
@ -56,4 +59,5 @@ namespace _winml {
|
|||
auto sse_added = _mm_add_ps(sse_data, sse_shift);
|
||||
return _mm_mul_ps(sse_added, sse_scale);
|
||||
}
|
||||
#endif
|
||||
} // namespace _winml
|
||||
|
|
@ -16,13 +16,17 @@ class NominalRangeConverter {
|
|||
|
||||
DirectX::PackedVector::HALF Normalize(DirectX::PackedVector::HALF val) const;
|
||||
|
||||
#if defined(_M_AMD64) || defined(_M_IX86)
|
||||
__m128 Normalize(__m128 sse_data) const;
|
||||
#endif
|
||||
|
||||
float Denormalize(float val) const;
|
||||
|
||||
DirectX::PackedVector::HALF Denormalize(DirectX::PackedVector::HALF val) const;
|
||||
|
||||
#if defined(_M_AMD64) || defined(_M_IX86)
|
||||
__m128 Denormalize(__m128 sse_data) const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
float scale;
|
||||
|
|
|
|||
Loading…
Reference in a new issue