Commit 87c421a6 authored by baojun's avatar baojun Committed by Scott Cyphers

show more info in error (#3547)

parent 8ea10549
......@@ -99,14 +99,16 @@ size_t descriptor::Tensor::size() const
void descriptor::Tensor::set_tensor_layout(
const std::shared_ptr<layout::TensorLayout>& tensor_layout)
{
if (tensor_layout->get_shape() != get_shape())
{
throw ngraph_error("Setting tensor's layout to a layout with a different shape.");
}
if (tensor_layout->get_element_type() != get_element_type())
{
throw ngraph_error("Setting tensor's layout to a layout with a different element type.");
}
NGRAPH_CHECK(tensor_layout->get_shape() == get_shape(),
"Setting tensor's layout to a layout with a different shape : ",
get_shape(),
" -> ",
tensor_layout->get_shape());
NGRAPH_CHECK(tensor_layout->get_element_type() == get_element_type(),
"Setting tensor's layout to a layout with a different element type : ",
get_element_type(),
" -> ",
tensor_layout->get_element_type());
m_tensor_layout = tensor_layout;
}
......
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