Commit ce8c06c7 authored by Adam Procter's avatar Adam Procter

Ditch ptrdiff_t conversion operator

parent c146327a
...@@ -71,16 +71,6 @@ namespace ngraph ...@@ -71,16 +71,6 @@ namespace ngraph
} }
return m_dimension; return m_dimension;
} }
/// \brief Convert this dimension to `ptrdiff_t`. This dimension must be static.
/// \throws std::invalid_argument If this dimension is dynamic.
explicit operator ptrdiff_t() const
{
if (is_dynamic())
{
throw std::invalid_argument("Cannot convert dynamic dimension to ptrdiff_t");
}
return static_cast<ptrdiff_t>(m_dimension);
}
/// \brief Check whether this dimension represents the same scheme as the argument (both /// \brief Check whether this dimension represents the same scheme as the argument (both
/// dynamic, or equal). /// dynamic, or equal).
......
...@@ -84,7 +84,7 @@ void op::Pad::validate_and_infer_types() ...@@ -84,7 +84,7 @@ void op::Pad::validate_and_infer_types()
if (arg_shape[i].is_static()) if (arg_shape[i].is_static())
{ {
ptrdiff_t result_dim = ptrdiff_t result_dim =
m_padding_below[i] + static_cast<ptrdiff_t>(arg_shape[i]) + m_padding_above[i]; m_padding_below[i] + static_cast<int64_t>(arg_shape[i]) + m_padding_above[i];
NODE_VALIDATION_CHECK(this, NODE_VALIDATION_CHECK(this,
result_dim >= 0, result_dim >= 0,
"Inferred result dimension at axis ", "Inferred result dimension at axis ",
......
...@@ -142,8 +142,8 @@ PartialShape ngraph::infer_windowed_reduction_output_shape(const Node* node, ...@@ -142,8 +142,8 @@ PartialShape ngraph::infer_windowed_reduction_output_shape(const Node* node,
ptrdiff_t data_padded_dilated_dim = -1; ptrdiff_t data_padded_dilated_dim = -1;
if (data_dim_static) if (data_dim_static)
{ {
data_padded_dilated_dim = (static_cast<ptrdiff_t>(data_dilation[i]) * data_padded_dilated_dim = (static_cast<int64_t>(data_dilation[i]) *
(static_cast<ptrdiff_t>(data_shape[i]) - 1)) + (static_cast<int64_t>(data_shape[i]) - 1)) +
1 + data_padding_below[i] + data_padding_above[i]; 1 + data_padding_below[i] + data_padding_above[i];
NODE_VALIDATION_CHECK( NODE_VALIDATION_CHECK(
node, node,
...@@ -158,8 +158,8 @@ PartialShape ngraph::infer_windowed_reduction_output_shape(const Node* node, ...@@ -158,8 +158,8 @@ PartialShape ngraph::infer_windowed_reduction_output_shape(const Node* node,
ptrdiff_t window_dilated_dim = -1; ptrdiff_t window_dilated_dim = -1;
if (window_dim_static) if (window_dim_static)
{ {
window_dilated_dim = static_cast<ptrdiff_t>(window_dilation[i]) * window_dilated_dim = static_cast<int64_t>(window_dilation[i]) *
(static_cast<ptrdiff_t>(window_shape[i]) - 1) + (static_cast<int64_t>(window_shape[i]) - 1) +
1; 1;
NODE_VALIDATION_CHECK(node, NODE_VALIDATION_CHECK(node,
......
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