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:
Xiang Zhang 2020-08-25 15:08:55 -07:00 committed by GitHub
parent 1161c4d75f
commit 170fee0987
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -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

View file

@ -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;