-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [GNA] Enable int8 weights for convolutions * [GNA] Implement convolution low precision tests for MTL Co-authored-by: Marcin Kacprzak <marcin.kacprzak@intel.com>
- Loading branch information
1 parent
0fa1573
commit 3ea77b9
Showing
39 changed files
with
2,501 additions
and
2,214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (C) 2022 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include <cstdlib> | ||
#include <algorithm> | ||
|
||
namespace ov { | ||
namespace intel_gna { | ||
namespace common { | ||
|
||
#define FLOAT_TO_INT8(a) static_cast<int8_t>(((a) < 0)?((a) - 0.5f):((a) + 0.5f)) | ||
#define FLOAT_TO_INT16(a) static_cast<int16_t>(((a) < 0)?((a) - 0.5f):((a) + 0.5f)) | ||
#define FLOAT_TO_INT32(a) static_cast<int32_t>(((a) < 0)?((a)-0.5f):((a)+0.5f)) | ||
#define FLOAT_TO_INT64(a) static_cast<int64_t>(((a) < 0)?((a)-0.5f):((a)+0.5f)) | ||
|
||
/** | ||
* @brief Compares two float values and returns if they are equal | ||
* @param p1 First float value | ||
* @param p2 Second float value | ||
* @return Returns true if two float values are equal | ||
*/ | ||
inline bool fp32eq(float p1, float p2, float accuracy = 0.00001f) { | ||
return (std::abs(p1 - p2) <= accuracy * std::min(std::abs(p1), std::abs(p2))); | ||
} | ||
|
||
} // namespace common | ||
} // namespace intel_gna | ||
} // namespace ov |
Oops, something went wrong.