Commit 8ac7fecd authored by Adam Procter's avatar Adam Procter Committed by Scott Cyphers

Change GetOutputElement to use delayed validation (#1964)

* Change GetOutputElement to use delayed validation

* Cleanup
parent b56c44fe
...@@ -26,11 +26,15 @@ op::GetOutputElement::GetOutputElement(const shared_ptr<Node>& arg, size_t n) ...@@ -26,11 +26,15 @@ op::GetOutputElement::GetOutputElement(const shared_ptr<Node>& arg, size_t n)
, m_n{n} , m_n{n}
{ {
constructor_validate_and_infer_types(); constructor_validate_and_infer_types();
NODE_VALIDATION_ASSERT(this, m_n < arg->get_output_size()) }
<< "Output at index " << m_n << " requested, but argument has only "
<< arg->get_output_size() << " outputs."; void op::GetOutputElement::validate_and_infer_types()
{
NODE_VALIDATION_ASSERT(this, m_n < get_input_size())
<< "Output at index " << m_n << " requested, but node has only " << get_input_size()
<< " inputs.";
set_output_type(0, arg->get_output_element_type(n), arg->get_output_partial_shape(n)); set_output_type(0, get_input_element_type(m_n), get_input_partial_shape(m_n));
} }
shared_ptr<Node> op::GetOutputElement::copy_with_new_args(const NodeVector& new_args) const shared_ptr<Node> op::GetOutputElement::copy_with_new_args(const NodeVector& new_args) const
......
...@@ -36,6 +36,7 @@ namespace ngraph ...@@ -36,6 +36,7 @@ namespace ngraph
virtual std::shared_ptr<Node> virtual std::shared_ptr<Node>
copy_with_new_args(const NodeVector& new_args) const override; copy_with_new_args(const NodeVector& new_args) const override;
void validate_and_infer_types() override;
/// \return The index of the tuple element to get. /// \return The index of the tuple element to get.
size_t get_n() const { return m_n; } size_t get_n() const { return m_n; }
......
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