Remove Dimension::size_t and callers

(cherry-pick master commit 72fa20942a3f135ea2e324f47dd401506a913876)
This commit is contained in:
Alexey Suhov 2020-05-22 11:17:20 +03:00
parent b8611139ca
commit ca9a78874a
5 changed files with 12 additions and 32 deletions

View File

@ -34,30 +34,30 @@ void op::GatherTreeIE::validate_and_infer_types() {
NODE_VALIDATION_CHECK(this, NODE_VALIDATION_CHECK(this,
step_ids_rank.rank().is_dynamic() || step_ids_rank.rank().is_dynamic() ||
static_cast<size_t>(step_ids_rank.rank()) == 3, step_ids_rank.rank().get_length() == 3,
"step_ids input rank must equal to 3 (step_ids rank: ", "step_ids input rank must equal to 3 (step_ids rank: ",
static_cast<size_t>(step_ids_rank.rank()), step_ids_rank.rank().get_length(),
")"); ")");
NODE_VALIDATION_CHECK(this, NODE_VALIDATION_CHECK(this,
parent_idx_rank.rank().is_dynamic() || parent_idx_rank.rank().is_dynamic() ||
static_cast<size_t>(parent_idx_rank.rank()) == 3, parent_idx_rank.rank().get_length() == 3,
"parent_idx input rank must equal to 3 (parent_idx rank: ", "parent_idx input rank must equal to 3 (parent_idx rank: ",
static_cast<size_t>(parent_idx_rank.rank()), parent_idx_rank.rank().get_length(),
")"); ")");
NODE_VALIDATION_CHECK(this, NODE_VALIDATION_CHECK(this,
max_seq_len_rank.rank().is_dynamic() || max_seq_len_rank.rank().is_dynamic() ||
static_cast<size_t>(max_seq_len_rank.rank()) == 1, max_seq_len_rank.rank().get_length() == 1,
"max_seq_len input rank must equal to 1 (max_seq_len rank: ", "max_seq_len input rank must equal to 1 (max_seq_len rank: ",
static_cast<size_t>(max_seq_len_rank.rank()), max_seq_len_rank.rank().get_length(),
")"); ")");
NODE_VALIDATION_CHECK(this, NODE_VALIDATION_CHECK(this,
end_token_rank.rank().is_dynamic() || end_token_rank.rank().is_dynamic() ||
static_cast<size_t>(end_token_rank.rank()) == 1, end_token_rank.rank().get_length() == 1,
"end_token input rank must be scalar (end_token rank: ", "end_token input rank must be scalar (end_token rank: ",
static_cast<size_t>(end_token_rank.rank()), end_token_rank.rank().get_length(),
")"); ")");
const auto& step_ids_et = get_input_element_type(0); const auto& step_ids_et = get_input_element_type(0);

View File

@ -86,7 +86,7 @@ void dynamicToStaticShapeConcat(std::shared_ptr<ngraph::Node> target) {
"DynamicToStaticShape transformation for {} of type {} expects static " "DynamicToStaticShape transformation for {} of type {} expects static "
"shape on inputs without DSR", target->get_friendly_name(), "shape on inputs without DSR", target->get_friendly_name(),
target->get_type_info().name); target->get_type_info().name);
accumulatedStaticShapeValue[axis] += static_cast<size_t>(staticInputPartialShape[axis]); accumulatedStaticShapeValue[axis] += staticInputPartialShape[axis].get_length();
} }
return accumulatedStaticShapeValue; return accumulatedStaticShapeValue;
}; };

View File

@ -150,17 +150,3 @@ Dimension::value_type Dimension::get_min_length() const
{ {
return dimension_length(m_dimension.get_min_val()); return dimension_length(m_dimension.get_min_val());
} }
Dimension::operator size_t() const
{
if (is_dynamic())
{
throw std::invalid_argument("Cannot convert dynamic dimension to size_t");
}
auto result = m_dimension.get_min_val();
if (result > std::numeric_limits<size_t>::max())
{
throw std::invalid_argument("Dimension to large for size_t");
}
return result;
}

View File

@ -72,12 +72,6 @@ namespace ngraph
} }
return m_dimension.get_min_val(); return m_dimension.get_min_val();
} }
/// \brief Convert this dimension to `size_t`. This dimension must be static and
/// non-negative.
/// \throws std::invalid_argument If this dimension is dynamic or negative.
explicit operator size_t() const NGRAPH_DEPRECATED("use get_length() instead");
/// \brief Convert this dimension to `value_type`. This dimension must be static and /// \brief Convert this dimension to `value_type`. This dimension must be static and
/// non-negative. /// non-negative.
/// \throws std::invalid_argument If this dimension is dynamic or negative. /// \throws std::invalid_argument If this dimension is dynamic or negative.

View File

@ -339,9 +339,9 @@ void op::v1::GroupConvolutionBackpropData::pre_validate_and_infer_types()
if (filters_pshape[0].is_static() && filters_pshape[1].is_static() && if (filters_pshape[0].is_static() && filters_pshape[1].is_static() &&
data_pshape[1].is_static()) data_pshape[1].is_static())
{ {
size_t groups{filters_pshape[0]}; auto groups = filters_pshape[0].get_length();
size_t input_channels{filters_pshape[1]}; auto input_channels = filters_pshape[1].get_length();
size_t n_data_channels{data_pshape[1]}; auto n_data_channels = data_pshape[1].get_length();
NODE_VALIDATION_CHECK(this, NODE_VALIDATION_CHECK(this,
n_data_channels % groups == 0, n_data_channels % groups == 0,