Commit f0e84612 authored by Ted Themistokleous's avatar Ted Themistokleous
Browse files

remove skip_broadcast, and add tolerance to add_0

parent ed55d323
......@@ -855,14 +855,14 @@ struct find_unit_ops
{
auto matcher() const
{
auto mul_1 = match::name("mul")(match::either_arg(0, 1)(
match::skip_broadcasts_converts(match::has_value(1.0f)), match::any().bind("x")));
auto div_1 = match::name("div")(match::args(
match::any().bind("x"), match::skip_broadcasts_converts(match::has_value(1.0f))));
auto add_0 = match::name("add")(match::either_arg(0, 1)(
match::skip_broadcasts_converts(match::has_value(0.0f)), match::any().bind("x")));
auto sub_0 = match::name("sub")(match::args(
match::any().bind("x"), match::skip_broadcasts_converts(match::has_value(0.0f))));
auto mul_1 = match::name("mul")(
match::either_arg(0, 1)(match::has_value(1.0f), match::any().bind("x")));
auto div_1 =
match::name("div")(match::args(match::any().bind("x"), match::has_value(1.0f)));
auto add_0 = match::name("add")(
match::either_arg(0, 1)(match::has_value(0.0f, 1e-12), match::any().bind("x")));
auto sub_0 =
match::name("sub")(match::args(match::any().bind("x"), match::has_value(0.0f)));
return match::any_of(mul_1, div_1, add_0, sub_0);
}
......@@ -879,12 +879,12 @@ struct find_neg_unit_ops
{
auto matcher() const
{
auto mul_neg_1 = match::name("mul")(match::either_arg(0, 1)(
match::skip_broadcasts_converts(match::has_value(-1.0f)), match::any().bind("x")));
auto div_neg_1 = match::name("div")(match::args(
match::any().bind("x"), match::skip_broadcasts_converts(match::has_value(-1.0f))));
auto sub_0 = match::name("sub")(match::args(
match::skip_broadcasts_converts(match::has_value(0.0f)), match::any().bind("x")));
auto mul_neg_1 = match::name("mul")(
match::either_arg(0, 1)(match::has_value(-1.0f), match::any().bind("x")));
auto div_neg_1 =
match::name("div")(match::args(match::any().bind("x"), match::has_value(-1.0f)));
auto sub_0 =
match::name("sub")(match::args(match::has_value(0.0f), match::any().bind("x")));
return match::any_of(mul_neg_1, div_neg_1, sub_0);
}
......
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