mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-05-17 11:30:02 +00:00
add client example for elementwise_normalization (#501)
* add client example for elementwise_normalization
* clang format elementwise_layernorm2d.cpp
* changed some naming to make it more understandable
* changed naming of input into ab_input
* fixed bug for threadwise_x_store
* add elementwise operation to reference
[ROCm/composable_kernel commit: 7045632885]
This commit is contained in:
@@ -92,9 +92,10 @@ struct ReferenceLayernorm : public device::BaseOperator
|
||||
{
|
||||
for(int n = 0; n < N; ++n)
|
||||
{
|
||||
auto x_val = ck::type_convert<AccDataType>(arg.x_m_n_(m, n));
|
||||
auto y_val = (x_val - mean(m)) / sqrt(var(m) + arg.epsilon_);
|
||||
y_val = (y_val * arg.gamma_n_(n)) + arg.beta_n_(n);
|
||||
auto x_val = ck::type_convert<AccDataType>(arg.x_m_n_(m, n));
|
||||
auto y_val = (x_val - mean(m)) / sqrt(var(m) + arg.epsilon_);
|
||||
y_val = (y_val * arg.gamma_n_(n)) + arg.beta_n_(n);
|
||||
arg.acc_elementwise_op_(y_val, y_val);
|
||||
arg.y_m_n_(m, n) = ck::type_convert<YDataType>(y_val);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user