Commit fc870c69 authored by Bartlomiej Kocot's avatar Bartlomiej Kocot
Browse files

Fixes

parent 3aa0214f
...@@ -94,14 +94,6 @@ using DeviceGroupedConvNDFwdInstance = ...@@ -94,14 +94,6 @@ using DeviceGroupedConvNDFwdInstance =
S<1, 32, 1, 8>, S<1, 32, 1, 8>,
8>; 8>;
void print_helper_msg()
{
std::cout << "arg1: verification (0=no, 1=yes)\n"
<< "arg2: initialization (0=no init, 1=integer value, 2=decimal value)\n"
<< "arg3: time kernel (0=no, 1=yes)\n"
<< ck::utils::conv::get_conv_param_parser_helper_msg() << std::endl;
}
template <ck::index_t NDimSpatial, template <ck::index_t NDimSpatial,
typename InDataType, typename InDataType,
typename WeiDataType, typename WeiDataType,
......
...@@ -8,4 +8,4 @@ using OutElementOp = ck::tensor_operation::element_wise::UnaryAbs; ...@@ -8,4 +8,4 @@ using OutElementOp = ck::tensor_operation::element_wise::UnaryAbs;
using DeviceGroupedConvNDFwdActivInstance = DeviceGroupedConvNDFwdInstance<OutElementOp>; using DeviceGroupedConvNDFwdActivInstance = DeviceGroupedConvNDFwdInstance<OutElementOp>;
#include "run_convnd_fwd_activ_example.inc" #include "run_convnd_fwd_activ_example.inc"
int main(int argc, char* argv[]) { return run_convnd_fwd_example(argc, argv) ? 0 : 1; } int main(int argc, char* argv[]) { return !run_convnd_fwd_example(argc, argv); }
...@@ -8,4 +8,4 @@ using OutElementOp = ck::tensor_operation::element_wise::ClippedRelu; ...@@ -8,4 +8,4 @@ using OutElementOp = ck::tensor_operation::element_wise::ClippedRelu;
using DeviceGroupedConvNDFwdActivInstance = DeviceGroupedConvNDFwdInstance<OutElementOp>; using DeviceGroupedConvNDFwdActivInstance = DeviceGroupedConvNDFwdInstance<OutElementOp>;
#include "run_convnd_fwd_activ_example.inc" #include "run_convnd_fwd_activ_example.inc"
int main(int argc, char* argv[]) { return run_convnd_fwd_example(argc, argv) ? 0 : 1; } int main(int argc, char* argv[]) { return !run_convnd_fwd_example(argc, argv); }
...@@ -8,4 +8,4 @@ using OutElementOp = ck::tensor_operation::element_wise::Elu; ...@@ -8,4 +8,4 @@ using OutElementOp = ck::tensor_operation::element_wise::Elu;
using DeviceGroupedConvNDFwdActivInstance = DeviceGroupedConvNDFwdInstance<OutElementOp>; using DeviceGroupedConvNDFwdActivInstance = DeviceGroupedConvNDFwdInstance<OutElementOp>;
#include "run_convnd_fwd_activ_example.inc" #include "run_convnd_fwd_activ_example.inc"
int main(int argc, char* argv[]) { return run_convnd_fwd_example(argc, argv) ? 0 : 1; } int main(int argc, char* argv[]) { return !run_convnd_fwd_example(argc, argv); }
...@@ -8,4 +8,4 @@ using OutElementOp = ck::tensor_operation::element_wise::LeakyRelu; ...@@ -8,4 +8,4 @@ using OutElementOp = ck::tensor_operation::element_wise::LeakyRelu;
using DeviceGroupedConvNDFwdActivInstance = DeviceGroupedConvNDFwdInstance<OutElementOp>; using DeviceGroupedConvNDFwdActivInstance = DeviceGroupedConvNDFwdInstance<OutElementOp>;
#include "run_convnd_fwd_activ_example.inc" #include "run_convnd_fwd_activ_example.inc"
int main(int argc, char* argv[]) { return run_convnd_fwd_example(argc, argv) ? 0 : 1; } int main(int argc, char* argv[]) { return !run_convnd_fwd_example(argc, argv); }
...@@ -8,4 +8,4 @@ using OutElementOp = ck::tensor_operation::element_wise::Power; ...@@ -8,4 +8,4 @@ using OutElementOp = ck::tensor_operation::element_wise::Power;
using DeviceGroupedConvNDFwdActivInstance = DeviceGroupedConvNDFwdInstance<OutElementOp>; using DeviceGroupedConvNDFwdActivInstance = DeviceGroupedConvNDFwdInstance<OutElementOp>;
#include "run_convnd_fwd_activ_example.inc" #include "run_convnd_fwd_activ_example.inc"
int main(int argc, char* argv[]) { return run_convnd_fwd_example(argc, argv) ? 0 : 1; } int main(int argc, char* argv[]) { return !run_convnd_fwd_example(argc, argv); }
...@@ -8,4 +8,4 @@ using OutElementOp = ck::tensor_operation::element_wise::Relu; ...@@ -8,4 +8,4 @@ using OutElementOp = ck::tensor_operation::element_wise::Relu;
using DeviceGroupedConvNDFwdActivInstance = DeviceGroupedConvNDFwdInstance<OutElementOp>; using DeviceGroupedConvNDFwdActivInstance = DeviceGroupedConvNDFwdInstance<OutElementOp>;
#include "run_convnd_fwd_activ_example.inc" #include "run_convnd_fwd_activ_example.inc"
int main(int argc, char* argv[]) { return run_convnd_fwd_example(argc, argv) ? 0 : 1; } int main(int argc, char* argv[]) { return !run_convnd_fwd_example(argc, argv); }
...@@ -8,4 +8,4 @@ using OutElementOp = ck::tensor_operation::element_wise::Sigmoid; ...@@ -8,4 +8,4 @@ using OutElementOp = ck::tensor_operation::element_wise::Sigmoid;
using DeviceGroupedConvNDFwdActivInstance = DeviceGroupedConvNDFwdInstance<OutElementOp>; using DeviceGroupedConvNDFwdActivInstance = DeviceGroupedConvNDFwdInstance<OutElementOp>;
#include "run_convnd_fwd_activ_example.inc" #include "run_convnd_fwd_activ_example.inc"
int main(int argc, char* argv[]) { return run_convnd_fwd_example(argc, argv) ? 0 : 1; } int main(int argc, char* argv[]) { return !run_convnd_fwd_example(argc, argv); }
...@@ -8,4 +8,4 @@ using OutElementOp = ck::tensor_operation::element_wise::SoftRelu; ...@@ -8,4 +8,4 @@ using OutElementOp = ck::tensor_operation::element_wise::SoftRelu;
using DeviceGroupedConvNDFwdActivInstance = DeviceGroupedConvNDFwdInstance<OutElementOp>; using DeviceGroupedConvNDFwdActivInstance = DeviceGroupedConvNDFwdInstance<OutElementOp>;
#include "run_convnd_fwd_activ_example.inc" #include "run_convnd_fwd_activ_example.inc"
int main(int argc, char* argv[]) { return run_convnd_fwd_example(argc, argv) ? 0 : 1; } int main(int argc, char* argv[]) { return !run_convnd_fwd_example(argc, argv); }
...@@ -8,4 +8,4 @@ using OutElementOp = ck::tensor_operation::element_wise::TanH; ...@@ -8,4 +8,4 @@ using OutElementOp = ck::tensor_operation::element_wise::TanH;
using DeviceGroupedConvNDFwdActivInstance = DeviceGroupedConvNDFwdInstance<OutElementOp>; using DeviceGroupedConvNDFwdActivInstance = DeviceGroupedConvNDFwdInstance<OutElementOp>;
#include "run_convnd_fwd_activ_example.inc" #include "run_convnd_fwd_activ_example.inc"
int main(int argc, char* argv[]) { return run_convnd_fwd_example(argc, argv) ? 0 : 1; } int main(int argc, char* argv[]) { return !run_convnd_fwd_example(argc, argv); }
...@@ -3,6 +3,14 @@ ...@@ -3,6 +3,14 @@
#pragma once #pragma once
void print_helper_msg()
{
std::cout << "arg1: verification (0=no, 1=yes)\n"
<< "arg2: initialization (0=no init, 1=integer value, 2=decimal value)\n"
<< "arg3: time kernel (0=no, 1=yes)\n"
<< ck::utils::conv::get_conv_param_parser_helper_msg() << std::endl;
}
bool run_convnd_fwd_example(int argc, char* argv[]) bool run_convnd_fwd_example(int argc, char* argv[])
{ {
print_helper_msg(); print_helper_msg();
...@@ -79,5 +87,5 @@ bool run_convnd_fwd_example(int argc, char* argv[]) ...@@ -79,5 +87,5 @@ bool run_convnd_fwd_example(int argc, char* argv[])
return run(); return run();
} }
return true; return false;
} }
...@@ -451,8 +451,8 @@ struct Sigmoid ...@@ -451,8 +451,8 @@ struct Sigmoid
is_same<T, ck::half_t>::value || is_same<T, int8_t>::value || is_same<T, ck::half_t>::value || is_same<T, int8_t>::value ||
is_same<T, int32_t>::value, is_same<T, int32_t>::value,
"Data type is not supported by this operation!"); "Data type is not supported by this operation!");
constexpr T one{1}; constexpr T one = type_convert<T>(1);
y = one / (ck::type_convert<T>(one) + ck::math::exp(-x)); y = one / (ck::type_convert<T>(one) + ck::math::exp(-x));
}; };
}; };
...@@ -489,7 +489,7 @@ struct Swish ...@@ -489,7 +489,7 @@ struct Swish
y = type_convert<Y>(x / (1.f + ck::math::exp(bx))); y = type_convert<Y>(x / (1.f + ck::math::exp(bx)));
}; };
float beta_ = 1.0f; const float beta_;
}; };
struct SoftRelu struct SoftRelu
...@@ -503,11 +503,11 @@ struct SoftRelu ...@@ -503,11 +503,11 @@ struct SoftRelu
is_same<T, half_t>::value || is_same<T, int32_t>::value || is_same<T, half_t>::value || is_same<T, int32_t>::value ||
is_same<T, int8_t>::value, is_same<T, int8_t>::value,
"Data type is not supported by this operation!"); "Data type is not supported by this operation!");
T casted_alpha = type_convert<T>(alpha_); T casted_alpha = type_convert<T>(alpha_);
constexpr T one{1}; constexpr T one = type_convert<T>(1);
y = ck::math::log(one + ck::math::exp(x * casted_alpha)) / casted_alpha; y = ck::math::log(one + ck::math::exp(x * casted_alpha)) / casted_alpha;
} }
float alpha_; const float alpha_;
}; };
struct Power struct Power
...@@ -528,9 +528,9 @@ struct Power ...@@ -528,9 +528,9 @@ struct Power
T shifted_scaled_x = casted_alpha + casted_beta * x; T shifted_scaled_x = casted_alpha + casted_beta * x;
y = ck::math::pow(shifted_scaled_x, casted_gamma); y = ck::math::pow(shifted_scaled_x, casted_gamma);
} }
float alpha_; const float alpha_;
float beta_; const float beta_;
float gamma_; const float gamma_;
}; };
struct ClippedRelu struct ClippedRelu
...@@ -548,8 +548,8 @@ struct ClippedRelu ...@@ -548,8 +548,8 @@ struct ClippedRelu
T casted_beta = type_convert<T>(beta_); T casted_beta = type_convert<T>(beta_);
y = ck::math::min(casted_beta, ck::math::max(casted_alpha, x)); y = ck::math::min(casted_beta, ck::math::max(casted_alpha, x));
} }
float alpha_; const float alpha_;
float beta_; const float beta_;
}; };
struct LeakyRelu struct LeakyRelu
...@@ -566,7 +566,7 @@ struct LeakyRelu ...@@ -566,7 +566,7 @@ struct LeakyRelu
T casted_alpha = type_convert<T>(alpha_); T casted_alpha = type_convert<T>(alpha_);
y = x >= 0 ? x : x * casted_alpha; y = x >= 0 ? x : x * casted_alpha;
} }
float alpha_; const float alpha_;
}; };
struct Elu struct Elu
...@@ -583,7 +583,7 @@ struct Elu ...@@ -583,7 +583,7 @@ struct Elu
T casted_alpha = type_convert<T>(alpha_); T casted_alpha = type_convert<T>(alpha_);
y = x > 0 ? x : casted_alpha * ck::math::expm1(x); y = x > 0 ? x : casted_alpha * ck::math::expm1(x);
} }
float alpha_; const float alpha_;
}; };
} // namespace element_wise } // namespace element_wise
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment