Commit 0bd90a78 authored by Sayantan Sarkar's avatar Sayantan Sarkar Committed by Scott Cyphers

Sarkars/move fn body to cpp (#3831)

* Initial commit

* Minor

* Intentional bug

* Revert "Intentional bug"

This reverts commit 11868b11ef83a92f094c7baed9c00a8b5ee2747d.
parent c8ac0130
......@@ -40,3 +40,29 @@ bool ngraph::pass::ImplicitBroadcastElimination::run_on_node(std::shared_ptr<ngr
}
return false;
}
NodeVector ngraph::pass::explicit_broadcast(std::shared_ptr<Node>& node)
{
NodeVector rc;
if (node->supports_auto_broadcast())
{
auto autob = node->get_autob();
if (autob.m_type == op::AutoBroadcastType::NONE)
{
rc = node->get_arguments();
}
else if (autob.m_type == op::AutoBroadcastType::NUMPY)
{
rc = op::numpy_style_broadcast(node->get_arguments());
}
else if (autob.m_type == op::AutoBroadcastType::PDPD)
{
rc = op::pdpd_style_broadcast(node->get_arguments(), autob.m_axis);
}
else
{
throw ngraph_error("Unsupported implicit broadcast type");
}
}
return rc;
}
......@@ -23,36 +23,13 @@ namespace ngraph
{
namespace pass
{
NodeVector explicit_broadcast(std::shared_ptr<Node>& node)
{
NodeVector rc;
if (node->supports_auto_broadcast())
{
auto autob = node->get_autob();
if (autob.m_type == op::AutoBroadcastType::NONE)
{
rc = node->get_arguments();
}
else if (autob.m_type == op::AutoBroadcastType::NUMPY)
{
rc = op::numpy_style_broadcast(node->get_arguments());
}
else if (autob.m_type == op::AutoBroadcastType::PDPD)
{
rc = op::pdpd_style_broadcast(node->get_arguments(), autob.m_axis);
}
else
{
throw ngraph_error("Unsupported implicit broadcast type");
}
}
return rc;
}
class ImplicitBroadcastElimination : public NodePass
{
public:
bool run_on_node(std::shared_ptr<ngraph::Node> node) override;
};
NodeVector explicit_broadcast(std::shared_ptr<Node>& node);
class ImplicitBroadcastElimination;
}
}
class ngraph::pass::ImplicitBroadcastElimination : public ngraph::pass::NodePass
{
public:
bool run_on_node(std::shared_ptr<ngraph::Node> node) override;
};
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