Skip to content

Commit

Permalink
#6534: Fix hardsigmoid for backward op
Browse files Browse the repository at this point in the history
  • Loading branch information
umadevimcw committed Mar 19, 2024
1 parent 61c9cb8 commit 568b4e3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tt_eager/tt_dnn/op_library/backward/backward_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,9 +835,10 @@ std::vector<Tensor> concat_bw(const Tensor& grad, const Tensor& input, const Ten
}



std::vector<Tensor> _hardsigmoid_bw(const Tensor& grad, const Tensor& input, const MemoryConfig& output_mem_config) {
std::vector<Tensor> grad_tensor;
Tensor grad_a = mul_unary(grad, 1.0/6);
Tensor grad_a = where(logical_or(lte_unary(input, -3, output_mem_config), gte_unary(input, 3, output_mem_config), std::nullopt, output_mem_config), zeros_like(input, output_mem_config), mul_unary(grad, 1.0/6), output_mem_config);
grad_tensor.emplace_back(grad_a);
return grad_tensor;
}
Expand Down

0 comments on commit 568b4e3

Please sign in to comment.