mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-19 19:00:47 +00:00
Change bind2nd to bind (#747)
`std::bind2nd` is deprecated in C++11 and removed in C++17 (see [MSDN documentation](https://docs.microsoft.com/en-us/cpp/standard-library/functional-functions?view=vs-2017#bind2nd)). Change to `std::bind` with placeholder instead.
This commit is contained in:
parent
b1115f49cd
commit
7d47cd39b6
1 changed files with 3 additions and 3 deletions
|
|
@ -361,7 +361,7 @@ std::pair<float, float> MeanStdev(std::vector<float>& v) {
|
|||
|
||||
std::vector<float> diff(v.size());
|
||||
std::transform(v.begin(), v.end(), diff.begin(),
|
||||
std::bind2nd(std::minus<float>(), mean));
|
||||
std::bind(std::minus<float>(), std::placeholders::_1, mean));
|
||||
float sq_sum = std::inner_product(diff.begin(), diff.end(), diff.begin(), 0.0f);
|
||||
float stdev = std::sqrt(sq_sum / v.size());
|
||||
|
||||
|
|
@ -374,11 +374,11 @@ void Normalize(std::vector<float>& v,
|
|||
float stdev = mean_stdev.second;
|
||||
|
||||
std::transform(v.begin(), v.end(), v.begin(),
|
||||
std::bind2nd(std::minus<float>(), mean));
|
||||
std::bind(std::minus<float>(), std::placeholders::_1, mean));
|
||||
|
||||
if (normalize_variance) {
|
||||
std::transform(v.begin(), v.end(), v.begin(),
|
||||
std::bind2nd(std::divides<float>(), stdev));
|
||||
std::bind(std::divides<float>(), std::placeholders::_1, stdev));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue