Unverified Commit b7a87656 authored by Scott Cyphers's avatar Scott Cyphers Committed by GitHub

Use static casts for ops since type is known. (#3746)

parent 34f04d37
...@@ -2368,7 +2368,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2368,7 +2368,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Add: case OP_TYPEID::Add:
{ {
auto tmp = dynamic_cast<const op::Add*>(&n); auto tmp = static_cast<const op::Add*>(&n);
if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE) if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE)
{ {
node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob()); node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob());
...@@ -2377,21 +2377,21 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2377,21 +2377,21 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::ArgMin: case OP_TYPEID::ArgMin:
{ {
auto tmp = dynamic_cast<const op::ArgMin*>(&n); auto tmp = static_cast<const op::ArgMin*>(&n);
node["axis"] = tmp->get_reduction_axis(); node["axis"] = tmp->get_reduction_axis();
node["index_element_type"] = write_element_type(tmp->get_element_type()); node["index_element_type"] = write_element_type(tmp->get_element_type());
break; break;
} }
case OP_TYPEID::ArgMax: case OP_TYPEID::ArgMax:
{ {
auto tmp = dynamic_cast<const op::ArgMax*>(&n); auto tmp = static_cast<const op::ArgMax*>(&n);
node["axis"] = tmp->get_reduction_axis(); node["axis"] = tmp->get_reduction_axis();
node["index_element_type"] = write_element_type(tmp->get_element_type()); node["index_element_type"] = write_element_type(tmp->get_element_type());
break; break;
} }
case OP_TYPEID::All: case OP_TYPEID::All:
{ {
auto tmp = dynamic_cast<const op::All*>(&n); auto tmp = static_cast<const op::All*>(&n);
node["reduction_axes"] = serialize_axis_set(tmp->get_reduction_axes()); node["reduction_axes"] = serialize_axis_set(tmp->get_reduction_axes());
break; break;
} }
...@@ -2399,7 +2399,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2399,7 +2399,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::And: case OP_TYPEID::And:
{ {
auto tmp = dynamic_cast<const op::And*>(&n); auto tmp = static_cast<const op::And*>(&n);
if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE) if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE)
{ {
node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob()); node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob());
...@@ -2408,7 +2408,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2408,7 +2408,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Any: case OP_TYPEID::Any:
{ {
auto tmp = dynamic_cast<const op::Any*>(&n); auto tmp = static_cast<const op::Any*>(&n);
node["reduction_axes"] = serialize_axis_set(tmp->get_reduction_axes()); node["reduction_axes"] = serialize_axis_set(tmp->get_reduction_axes());
break; break;
} }
...@@ -2420,7 +2420,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2420,7 +2420,7 @@ json JSONSerializer::serialize_node(const Node& n)
{ {
if (op_version == 0) if (op_version == 0)
{ {
auto tmp = dynamic_cast<const op::v0::AvgPool*>(&n); auto tmp = static_cast<const op::v0::AvgPool*>(&n);
node["window_shape"] = tmp->get_window_shape(); node["window_shape"] = tmp->get_window_shape();
node["window_movement_strides"] = tmp->get_window_movement_strides(); node["window_movement_strides"] = tmp->get_window_movement_strides();
node["padding_below"] = tmp->get_padding_below(); node["padding_below"] = tmp->get_padding_below();
...@@ -2435,7 +2435,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2435,7 +2435,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
if (op_version == 1) if (op_version == 1)
{ {
auto tmp = dynamic_cast<const op::v1::AvgPool*>(&n); auto tmp = static_cast<const op::v1::AvgPool*>(&n);
node["kernel"] = tmp->get_kernel(); node["kernel"] = tmp->get_kernel();
node["strides"] = tmp->get_strides(); node["strides"] = tmp->get_strides();
node["pads_begin"] = tmp->get_pads_begin(); node["pads_begin"] = tmp->get_pads_begin();
...@@ -2450,7 +2450,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2450,7 +2450,7 @@ json JSONSerializer::serialize_node(const Node& n)
{ {
if (op_version == 0) if (op_version == 0)
{ {
auto tmp = dynamic_cast<const op::v0::AvgPoolBackprop*>(&n); auto tmp = static_cast<const op::v0::AvgPoolBackprop*>(&n);
node["forward_arg_shape"] = tmp->get_forward_arg_shape(); node["forward_arg_shape"] = tmp->get_forward_arg_shape();
node["window_shape"] = tmp->get_window_shape(); node["window_shape"] = tmp->get_window_shape();
node["window_movement_strides"] = tmp->get_window_movement_strides(); node["window_movement_strides"] = tmp->get_window_movement_strides();
...@@ -2461,7 +2461,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2461,7 +2461,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
if (op_version == 1) if (op_version == 1)
{ {
auto tmp = dynamic_cast<const op::v1::AvgPoolBackprop*>(&n); auto tmp = static_cast<const op::v1::AvgPoolBackprop*>(&n);
node["forward_arg_shape"] = tmp->get_forward_arg_shape(); node["forward_arg_shape"] = tmp->get_forward_arg_shape();
node["kernel"] = tmp->get_kernel(); node["kernel"] = tmp->get_kernel();
node["strides"] = tmp->get_strides(); node["strides"] = tmp->get_strides();
...@@ -2475,25 +2475,25 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2475,25 +2475,25 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::BatchNormTraining: case OP_TYPEID::BatchNormTraining:
{ {
auto tmp = dynamic_cast<const op::BatchNormTraining*>(&n); auto tmp = static_cast<const op::BatchNormTraining*>(&n);
node["eps"] = tmp->get_eps_value(); node["eps"] = tmp->get_eps_value();
break; break;
} }
case OP_TYPEID::BatchNormInference: case OP_TYPEID::BatchNormInference:
{ {
auto tmp = dynamic_cast<const op::BatchNormInference*>(&n); auto tmp = static_cast<const op::BatchNormInference*>(&n);
node["eps"] = tmp->get_eps_value(); node["eps"] = tmp->get_eps_value();
break; break;
} }
case OP_TYPEID::BatchNormTrainingBackprop: case OP_TYPEID::BatchNormTrainingBackprop:
{ {
auto tmp = dynamic_cast<const op::BatchNormTrainingBackprop*>(&n); auto tmp = static_cast<const op::BatchNormTrainingBackprop*>(&n);
node["eps"] = tmp->get_eps_value(); node["eps"] = tmp->get_eps_value();
break; break;
} }
case OP_TYPEID::Broadcast: case OP_TYPEID::Broadcast:
{ {
auto tmp = dynamic_cast<const op::Broadcast*>(&n); auto tmp = static_cast<const op::Broadcast*>(&n);
node["axes"] = serialize_axis_set(tmp->get_broadcast_axes()); node["axes"] = serialize_axis_set(tmp->get_broadcast_axes());
node["shape"] = tmp->get_broadcast_shape(); node["shape"] = tmp->get_broadcast_shape();
break; break;
...@@ -2502,7 +2502,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2502,7 +2502,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::BroadcastLike: case OP_TYPEID::BroadcastLike:
{ {
auto tmp = dynamic_cast<const op::BroadcastLike*>(&n); auto tmp = static_cast<const op::BroadcastLike*>(&n);
node["initial_axes"] = serialize_axis_set(tmp->get_initial_broadcast_axes()); node["initial_axes"] = serialize_axis_set(tmp->get_initial_broadcast_axes());
break; break;
} }
...@@ -2510,20 +2510,20 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2510,20 +2510,20 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Clamp: case OP_TYPEID::Clamp:
{ {
auto tmp = dynamic_cast<const op::Clamp*>(&n); auto tmp = static_cast<const op::Clamp*>(&n);
node["min"] = tmp->get_min(); node["min"] = tmp->get_min();
node["max"] = tmp->get_max(); node["max"] = tmp->get_max();
break; break;
} }
case OP_TYPEID::Concat: case OP_TYPEID::Concat:
{ {
auto tmp = dynamic_cast<const op::Concat*>(&n); auto tmp = static_cast<const op::Concat*>(&n);
node["axis"] = tmp->get_concatenation_axis(); node["axis"] = tmp->get_concatenation_axis();
break; break;
} }
case OP_TYPEID::Constant: case OP_TYPEID::Constant:
{ {
auto tmp = dynamic_cast<const op::Constant*>(&n); auto tmp = static_cast<const op::Constant*>(&n);
if (tmp->are_all_data_elements_bitwise_identical() && shape_size(tmp->get_shape()) > 0) if (tmp->are_all_data_elements_bitwise_identical() && shape_size(tmp->get_shape()) > 0)
{ {
vector<string> vs; vector<string> vs;
...@@ -2540,7 +2540,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2540,7 +2540,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Convert: case OP_TYPEID::Convert:
{ {
auto tmp = dynamic_cast<const op::Convert*>(&n); auto tmp = static_cast<const op::Convert*>(&n);
node["target_type"] = write_element_type(tmp->get_convert_element_type()); node["target_type"] = write_element_type(tmp->get_convert_element_type());
break; break;
} }
...@@ -2548,7 +2548,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2548,7 +2548,7 @@ json JSONSerializer::serialize_node(const Node& n)
{ {
if (op_version == 0) if (op_version == 0)
{ {
auto tmp = dynamic_cast<const op::v0::Convolution*>(&n); auto tmp = static_cast<const op::v0::Convolution*>(&n);
node["window_movement_strides"] = tmp->get_window_movement_strides(); node["window_movement_strides"] = tmp->get_window_movement_strides();
node["window_dilation_strides"] = tmp->get_window_dilation_strides(); node["window_dilation_strides"] = tmp->get_window_dilation_strides();
node["padding_below"] = tmp->get_padding_below(); node["padding_below"] = tmp->get_padding_below();
...@@ -2558,7 +2558,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2558,7 +2558,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
if (op_version == 1) if (op_version == 1)
{ {
auto tmp = dynamic_cast<const op::v1::Convolution*>(&n); auto tmp = static_cast<const op::v1::Convolution*>(&n);
node["strides"] = tmp->get_strides(); node["strides"] = tmp->get_strides();
node["dilations"] = tmp->get_dilations(); node["dilations"] = tmp->get_dilations();
node["pads_begin"] = tmp->get_pads_begin(); node["pads_begin"] = tmp->get_pads_begin();
...@@ -2571,7 +2571,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2571,7 +2571,7 @@ json JSONSerializer::serialize_node(const Node& n)
{ {
if (op_version == 0) if (op_version == 0)
{ {
auto tmp = dynamic_cast<const op::v0::ConvolutionBackpropData*>(&n); auto tmp = static_cast<const op::v0::ConvolutionBackpropData*>(&n);
node["data_batch_shape"] = tmp->get_data_batch_shape(); node["data_batch_shape"] = tmp->get_data_batch_shape();
node["window_movement_strides_forward"] = tmp->get_window_movement_strides_forward(); node["window_movement_strides_forward"] = tmp->get_window_movement_strides_forward();
node["window_dilation_strides_forward"] = tmp->get_window_dilation_strides_forward(); node["window_dilation_strides_forward"] = tmp->get_window_dilation_strides_forward();
...@@ -2581,7 +2581,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2581,7 +2581,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
if (op_version == 1) if (op_version == 1)
{ {
auto tmp = dynamic_cast<const op::v1::ConvolutionBackpropData*>(&n); auto tmp = static_cast<const op::v1::ConvolutionBackpropData*>(&n);
node["data_batch_shape"] = tmp->get_data_batch_shape(); node["data_batch_shape"] = tmp->get_data_batch_shape();
node["strides"] = tmp->get_strides(); node["strides"] = tmp->get_strides();
node["dilations"] = tmp->get_dilations(); node["dilations"] = tmp->get_dilations();
...@@ -2594,7 +2594,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2594,7 +2594,7 @@ json JSONSerializer::serialize_node(const Node& n)
{ {
if (op_version == 0) if (op_version == 0)
{ {
auto tmp = dynamic_cast<const op::v0::ConvolutionBackpropFilters*>(&n); auto tmp = static_cast<const op::v0::ConvolutionBackpropFilters*>(&n);
node["filters_shape"] = tmp->get_filters_shape(); node["filters_shape"] = tmp->get_filters_shape();
node["window_movement_strides_forward"] = tmp->get_window_movement_strides_forward(); node["window_movement_strides_forward"] = tmp->get_window_movement_strides_forward();
node["window_dilation_strides_forward"] = tmp->get_window_dilation_strides_forward(); node["window_dilation_strides_forward"] = tmp->get_window_dilation_strides_forward();
...@@ -2604,7 +2604,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2604,7 +2604,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
if (op_version == 1) if (op_version == 1)
{ {
auto tmp = dynamic_cast<const op::v1::ConvolutionBackpropFilters*>(&n); auto tmp = static_cast<const op::v1::ConvolutionBackpropFilters*>(&n);
node["filters_shape"] = tmp->get_filters_shape(); node["filters_shape"] = tmp->get_filters_shape();
node["strides"] = tmp->get_strides(); node["strides"] = tmp->get_strides();
node["dilations"] = tmp->get_dilations(); node["dilations"] = tmp->get_dilations();
...@@ -2615,7 +2615,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2615,7 +2615,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::ConvolutionBias: case OP_TYPEID::ConvolutionBias:
{ {
auto tmp = dynamic_cast<const op::ConvolutionBias*>(&n); auto tmp = static_cast<const op::ConvolutionBias*>(&n);
node["window_movement_strides"] = tmp->get_window_movement_strides(); node["window_movement_strides"] = tmp->get_window_movement_strides();
node["window_dilation_strides"] = tmp->get_window_dilation_strides(); node["window_dilation_strides"] = tmp->get_window_dilation_strides();
node["padding_below"] = tmp->get_padding_below(); node["padding_below"] = tmp->get_padding_below();
...@@ -2625,7 +2625,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2625,7 +2625,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::ConvolutionBiasAdd: case OP_TYPEID::ConvolutionBiasAdd:
{ {
auto tmp = dynamic_cast<const op::ConvolutionBiasAdd*>(&n); auto tmp = static_cast<const op::ConvolutionBiasAdd*>(&n);
node["window_movement_strides"] = tmp->get_window_movement_strides(); node["window_movement_strides"] = tmp->get_window_movement_strides();
node["window_dilation_strides"] = tmp->get_window_dilation_strides(); node["window_dilation_strides"] = tmp->get_window_dilation_strides();
node["padding_below"] = tmp->get_padding_below(); node["padding_below"] = tmp->get_padding_below();
...@@ -2635,7 +2635,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2635,7 +2635,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::ConvolutionBiasBackpropFiltersBias: case OP_TYPEID::ConvolutionBiasBackpropFiltersBias:
{ {
auto tmp = dynamic_cast<const op::ConvolutionBiasBackpropFiltersBias*>(&n); auto tmp = static_cast<const op::ConvolutionBiasBackpropFiltersBias*>(&n);
node["filters_shape"] = tmp->get_filters_shape(); node["filters_shape"] = tmp->get_filters_shape();
node["bias_shape"] = tmp->get_bias_shape(); node["bias_shape"] = tmp->get_bias_shape();
node["window_movement_strides_forward"] = tmp->get_window_movement_strides_forward(); node["window_movement_strides_forward"] = tmp->get_window_movement_strides_forward();
...@@ -2651,21 +2651,21 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2651,21 +2651,21 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Dequantize: case OP_TYPEID::Dequantize:
{ {
auto tmp = dynamic_cast<const op::Dequantize*>(&n); auto tmp = static_cast<const op::Dequantize*>(&n);
node["type"] = write_element_type(tmp->get_element_type()); node["type"] = write_element_type(tmp->get_element_type());
node["axes"] = serialize_axis_set(tmp->get_axes()); node["axes"] = serialize_axis_set(tmp->get_axes());
break; break;
} }
case OP_TYPEID::DepthToSpace: case OP_TYPEID::DepthToSpace:
{ {
auto tmp = dynamic_cast<const op::DepthToSpace*>(&n); auto tmp = static_cast<const op::DepthToSpace*>(&n);
node["type"] = write_element_type(tmp->get_element_type()); node["type"] = write_element_type(tmp->get_element_type());
node["block_size"] = tmp->get_block_size(); node["block_size"] = tmp->get_block_size();
break; break;
} }
case OP_TYPEID::Divide: case OP_TYPEID::Divide:
{ {
auto tmp = dynamic_cast<const op::Divide*>(&n); auto tmp = static_cast<const op::Divide*>(&n);
node["pythondiv"] = tmp->is_pythondiv(); node["pythondiv"] = tmp->is_pythondiv();
if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE) if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE)
{ {
...@@ -2675,7 +2675,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2675,7 +2675,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Dot: case OP_TYPEID::Dot:
{ {
auto tmp = dynamic_cast<const op::Dot*>(&n); auto tmp = static_cast<const op::Dot*>(&n);
node["reduction_axes_count"] = tmp->get_reduction_axes_count(); node["reduction_axes_count"] = tmp->get_reduction_axes_count();
break; break;
} }
...@@ -2685,7 +2685,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2685,7 +2685,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::DynReplaceSlice: case OP_TYPEID::DynReplaceSlice:
{ {
auto tmp = dynamic_cast<const op::DynReplaceSlice*>(&n); auto tmp = static_cast<const op::DynReplaceSlice*>(&n);
node["lower_bounds_mask"] = tmp->get_lower_bounds_mask(); node["lower_bounds_mask"] = tmp->get_lower_bounds_mask();
node["upper_bounds_mask"] = tmp->get_upper_bounds_mask(); node["upper_bounds_mask"] = tmp->get_upper_bounds_mask();
node["new_axis"] = tmp->get_new_axis(); node["new_axis"] = tmp->get_new_axis();
...@@ -2697,19 +2697,19 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2697,19 +2697,19 @@ json JSONSerializer::serialize_node(const Node& n)
{ {
if (op_version == 0) if (op_version == 0)
{ {
auto tmp = dynamic_cast<const op::v0::DynReshape*>(&n); auto tmp = static_cast<const op::v0::DynReshape*>(&n);
node["zero_flag"] = tmp->get_zero_flag(); node["zero_flag"] = tmp->get_zero_flag();
} }
if (op_version == 1) if (op_version == 1)
{ {
auto tmp = dynamic_cast<const op::v1::Reshape*>(&n); auto tmp = static_cast<const op::v1::Reshape*>(&n);
node["zero_flag"] = tmp->get_zero_flag(); node["zero_flag"] = tmp->get_zero_flag();
} }
break; break;
} }
case OP_TYPEID::DynSlice: case OP_TYPEID::DynSlice:
{ {
auto tmp = dynamic_cast<const op::DynSlice*>(&n); auto tmp = static_cast<const op::DynSlice*>(&n);
node["lower_bounds_mask"] = tmp->get_lower_bounds_mask(); node["lower_bounds_mask"] = tmp->get_lower_bounds_mask();
node["upper_bounds_mask"] = tmp->get_upper_bounds_mask(); node["upper_bounds_mask"] = tmp->get_upper_bounds_mask();
node["new_axis"] = tmp->get_new_axis(); node["new_axis"] = tmp->get_new_axis();
...@@ -2719,7 +2719,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2719,7 +2719,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Elu: case OP_TYPEID::Elu:
{ {
auto tmp = dynamic_cast<const op::Elu*>(&n); auto tmp = static_cast<const op::Elu*>(&n);
node["alpha"] = tmp->get_alpha(); node["alpha"] = tmp->get_alpha();
break; break;
} }
...@@ -2727,7 +2727,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2727,7 +2727,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Equal: case OP_TYPEID::Equal:
{ {
auto tmp = dynamic_cast<const op::Equal*>(&n); auto tmp = static_cast<const op::Equal*>(&n);
if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE) if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE)
{ {
node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob()); node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob());
...@@ -2740,7 +2740,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2740,7 +2740,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::FakeQuantize: case OP_TYPEID::FakeQuantize:
{ {
auto tmp = dynamic_cast<const op::FakeQuantize*>(&n); auto tmp = static_cast<const op::FakeQuantize*>(&n);
node["levels"] = tmp->get_levels(); node["levels"] = tmp->get_levels();
break; break;
} }
...@@ -2750,7 +2750,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2750,7 +2750,7 @@ json JSONSerializer::serialize_node(const Node& n)
{ {
if (op_version == 0) if (op_version == 0)
{ {
auto tmp = dynamic_cast<const op::v0::Gather*>(&n); auto tmp = static_cast<const op::v0::Gather*>(&n);
node["axis"] = tmp->get_axis(); node["axis"] = tmp->get_axis();
} }
break; break;
...@@ -2759,7 +2759,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2759,7 +2759,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::GetOutputElement: case OP_TYPEID::GetOutputElement:
{ {
auto tmp = dynamic_cast<const op::GetOutputElement*>(&n); auto tmp = static_cast<const op::GetOutputElement*>(&n);
node["n"] = tmp->get_n(); node["n"] = tmp->get_n();
break; break;
} }
...@@ -2769,7 +2769,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2769,7 +2769,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Gemm: case OP_TYPEID::Gemm:
{ {
auto tmp = dynamic_cast<const op::Gemm*>(&n); auto tmp = static_cast<const op::Gemm*>(&n);
node["alpha"] = tmp->get_alpha(); node["alpha"] = tmp->get_alpha();
node["beta"] = tmp->get_beta(); node["beta"] = tmp->get_beta();
node["transA"] = tmp->get_transA(); node["transA"] = tmp->get_transA();
...@@ -2778,7 +2778,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2778,7 +2778,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::GenerateMask: case OP_TYPEID::GenerateMask:
{ {
auto tmp = dynamic_cast<const op::GenerateMask*>(&n); auto tmp = static_cast<const op::GenerateMask*>(&n);
node["output_shape"] = tmp->get_mask_shape(); node["output_shape"] = tmp->get_mask_shape();
node["type"] = write_element_type(tmp->get_element_type()); node["type"] = write_element_type(tmp->get_element_type());
node["use_seed"] = tmp->get_use_seed(); node["use_seed"] = tmp->get_use_seed();
...@@ -2788,7 +2788,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2788,7 +2788,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Greater: case OP_TYPEID::Greater:
{ {
auto tmp = dynamic_cast<const op::Greater*>(&n); auto tmp = static_cast<const op::Greater*>(&n);
if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE) if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE)
{ {
node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob()); node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob());
...@@ -2797,7 +2797,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2797,7 +2797,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::GreaterEq: case OP_TYPEID::GreaterEq:
{ {
auto tmp = dynamic_cast<const op::GreaterEq*>(&n); auto tmp = static_cast<const op::GreaterEq*>(&n);
if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE) if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE)
{ {
node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob()); node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob());
...@@ -2806,13 +2806,13 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2806,13 +2806,13 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::GRN: case OP_TYPEID::GRN:
{ {
auto tmp = dynamic_cast<const op::GRN*>(&n); auto tmp = static_cast<const op::GRN*>(&n);
node["bias"] = tmp->get_bias(); node["bias"] = tmp->get_bias();
break; break;
} }
case OP_TYPEID::GRUCell: case OP_TYPEID::GRUCell:
{ {
auto tmp = dynamic_cast<const op::GRUCell*>(&n); auto tmp = static_cast<const op::GRUCell*>(&n);
node["hidden_size"] = tmp->get_hidden_size(); node["hidden_size"] = tmp->get_hidden_size();
node["clip"] = tmp->get_clip(); node["clip"] = tmp->get_clip();
node["activations"] = tmp->get_activations(); node["activations"] = tmp->get_activations();
...@@ -2823,7 +2823,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2823,7 +2823,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::GroupConvolution: case OP_TYPEID::GroupConvolution:
{ {
auto tmp = dynamic_cast<const op::GroupConvolution*>(&n); auto tmp = static_cast<const op::GroupConvolution*>(&n);
node["window_movement_strides"] = tmp->get_window_movement_strides(); node["window_movement_strides"] = tmp->get_window_movement_strides();
node["window_dilation_strides"] = tmp->get_window_dilation_strides(); node["window_dilation_strides"] = tmp->get_window_dilation_strides();
node["padding_below"] = tmp->get_padding_below(); node["padding_below"] = tmp->get_padding_below();
...@@ -2835,7 +2835,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2835,7 +2835,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::GroupConvolutionTranspose: case OP_TYPEID::GroupConvolutionTranspose:
{ {
auto tmp = dynamic_cast<const op::GroupConvolutionTranspose*>(&n); auto tmp = static_cast<const op::GroupConvolutionTranspose*>(&n);
node["strides"] = tmp->get_strides(); node["strides"] = tmp->get_strides();
node["dilations"] = tmp->get_dilations(); node["dilations"] = tmp->get_dilations();
node["padding_begin"] = tmp->get_padding_begin(); node["padding_begin"] = tmp->get_padding_begin();
...@@ -2848,14 +2848,14 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2848,14 +2848,14 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::HardSigmoid: case OP_TYPEID::HardSigmoid:
{ {
auto tmp = dynamic_cast<const op::HardSigmoid*>(&n); auto tmp = static_cast<const op::HardSigmoid*>(&n);
node["alpha"] = tmp->get_alpha(); node["alpha"] = tmp->get_alpha();
node["beta"] = tmp->get_beta(); node["beta"] = tmp->get_beta();
break; break;
} }
case OP_TYPEID::LayerNorm: case OP_TYPEID::LayerNorm:
{ {
auto tmp = dynamic_cast<const op::LayerNorm*>(&n); auto tmp = static_cast<const op::LayerNorm*>(&n);
node["keep_stats"] = tmp->get_keep_stats(); node["keep_stats"] = tmp->get_keep_stats();
node["use_affine"] = tmp->get_use_affine(); node["use_affine"] = tmp->get_use_affine();
node["epsilon"] = tmp->get_epsilon(); node["epsilon"] = tmp->get_epsilon();
...@@ -2864,7 +2864,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2864,7 +2864,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::LayerNormBackprop: case OP_TYPEID::LayerNormBackprop:
{ {
auto tmp = dynamic_cast<const op::LayerNormBackprop*>(&n); auto tmp = static_cast<const op::LayerNormBackprop*>(&n);
node["use_stats"] = tmp->get_use_stats(); node["use_stats"] = tmp->get_use_stats();
node["use_affine"] = tmp->get_use_affine(); node["use_affine"] = tmp->get_use_affine();
node["epsilon"] = tmp->get_epsilon(); node["epsilon"] = tmp->get_epsilon();
...@@ -2873,7 +2873,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2873,7 +2873,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Less: case OP_TYPEID::Less:
{ {
auto tmp = dynamic_cast<const op::Less*>(&n); auto tmp = static_cast<const op::Less*>(&n);
if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE) if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE)
{ {
node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob()); node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob());
...@@ -2882,7 +2882,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2882,7 +2882,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::LessEq: case OP_TYPEID::LessEq:
{ {
auto tmp = dynamic_cast<const op::LessEq*>(&n); auto tmp = static_cast<const op::LessEq*>(&n);
if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE) if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE)
{ {
node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob()); node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob());
...@@ -2893,7 +2893,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2893,7 +2893,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::LRN: case OP_TYPEID::LRN:
{ {
auto tmp = dynamic_cast<const op::LRN*>(&n); auto tmp = static_cast<const op::LRN*>(&n);
node["alpha"] = tmp->get_alpha(); node["alpha"] = tmp->get_alpha();
node["beta"] = tmp->get_beta(); node["beta"] = tmp->get_beta();
node["bias"] = tmp->get_bias(); node["bias"] = tmp->get_bias();
...@@ -2902,7 +2902,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2902,7 +2902,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::LSTMCell: case OP_TYPEID::LSTMCell:
{ {
auto tmp = dynamic_cast<const op::LSTMCell*>(&n); auto tmp = static_cast<const op::LSTMCell*>(&n);
node["hidden_size"] = tmp->get_hidden_size(); node["hidden_size"] = tmp->get_hidden_size();
node["clip"] = tmp->get_clip(); node["clip"] = tmp->get_clip();
node["activations"] = tmp->get_activations(); node["activations"] = tmp->get_activations();
...@@ -2913,14 +2913,14 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2913,14 +2913,14 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::MatMul: case OP_TYPEID::MatMul:
{ {
auto tmp = dynamic_cast<const op::MatMul*>(&n); auto tmp = static_cast<const op::MatMul*>(&n);
node["transpose_a"] = tmp->get_transpose_a(); node["transpose_a"] = tmp->get_transpose_a();
node["transpose_b"] = tmp->get_transpose_b(); node["transpose_b"] = tmp->get_transpose_b();
break; break;
} }
case OP_TYPEID::Max: case OP_TYPEID::Max:
{ {
auto tmp = dynamic_cast<const op::Max*>(&n); auto tmp = static_cast<const op::Max*>(&n);
node["reduction_axes"] = serialize_axis_set(tmp->get_reduction_axes()); node["reduction_axes"] = serialize_axis_set(tmp->get_reduction_axes());
break; break;
} }
...@@ -2928,7 +2928,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2928,7 +2928,7 @@ json JSONSerializer::serialize_node(const Node& n)
{ {
if (op_version == 0) if (op_version == 0)
{ {
auto tmp = dynamic_cast<const op::v0::MaxPool*>(&n); auto tmp = static_cast<const op::v0::MaxPool*>(&n);
node["window_shape"] = tmp->get_window_shape(); node["window_shape"] = tmp->get_window_shape();
node["window_movement_strides"] = tmp->get_window_movement_strides(); node["window_movement_strides"] = tmp->get_window_movement_strides();
node["padding_below"] = tmp->get_padding_below(); node["padding_below"] = tmp->get_padding_below();
...@@ -2937,7 +2937,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2937,7 +2937,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
if (op_version == 1) if (op_version == 1)
{ {
auto tmp = dynamic_cast<const op::v1::MaxPool*>(&n); auto tmp = static_cast<const op::v1::MaxPool*>(&n);
node["kernel"] = tmp->get_kernel(); node["kernel"] = tmp->get_kernel();
node["strides"] = tmp->get_strides(); node["strides"] = tmp->get_strides();
node["pads_begin"] = tmp->get_pads_begin(); node["pads_begin"] = tmp->get_pads_begin();
...@@ -2951,7 +2951,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2951,7 +2951,7 @@ json JSONSerializer::serialize_node(const Node& n)
{ {
if (op_version == 0) if (op_version == 0)
{ {
auto tmp = dynamic_cast<const op::v0::MaxPoolBackprop*>(&n); auto tmp = static_cast<const op::v0::MaxPoolBackprop*>(&n);
node["window_shape"] = tmp->get_window_shape(); node["window_shape"] = tmp->get_window_shape();
node["window_movement_strides"] = tmp->get_window_movement_strides(); node["window_movement_strides"] = tmp->get_window_movement_strides();
node["padding_below"] = tmp->get_padding_below(); node["padding_below"] = tmp->get_padding_below();
...@@ -2959,7 +2959,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2959,7 +2959,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
if (op_version == 1) if (op_version == 1)
{ {
auto tmp = dynamic_cast<const op::v1::MaxPoolBackprop*>(&n); auto tmp = static_cast<const op::v1::MaxPoolBackprop*>(&n);
node["kernel"] = tmp->get_kernel(); node["kernel"] = tmp->get_kernel();
node["strides"] = tmp->get_strides(); node["strides"] = tmp->get_strides();
node["pads_begin"] = tmp->get_pads_begin(); node["pads_begin"] = tmp->get_pads_begin();
...@@ -2969,7 +2969,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2969,7 +2969,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Maximum: case OP_TYPEID::Maximum:
{ {
auto tmp = dynamic_cast<const op::Maximum*>(&n); auto tmp = static_cast<const op::Maximum*>(&n);
if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE) if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE)
{ {
node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob()); node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob());
...@@ -2978,13 +2978,13 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2978,13 +2978,13 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Min: case OP_TYPEID::Min:
{ {
auto tmp = dynamic_cast<const op::Min*>(&n); auto tmp = static_cast<const op::Min*>(&n);
node["reduction_axes"] = serialize_axis_set(tmp->get_reduction_axes()); node["reduction_axes"] = serialize_axis_set(tmp->get_reduction_axes());
break; break;
} }
case OP_TYPEID::Minimum: case OP_TYPEID::Minimum:
{ {
auto tmp = dynamic_cast<const op::Minimum*>(&n); auto tmp = static_cast<const op::Minimum*>(&n);
if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE) if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE)
{ {
node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob()); node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob());
...@@ -2993,7 +2993,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -2993,7 +2993,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Multiply: case OP_TYPEID::Multiply:
{ {
auto tmp = dynamic_cast<const op::Multiply*>(&n); auto tmp = static_cast<const op::Multiply*>(&n);
if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE) if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE)
{ {
node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob()); node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob());
...@@ -3002,7 +3002,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3002,7 +3002,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::MVN: case OP_TYPEID::MVN:
{ {
auto tmp = dynamic_cast<const op::MVN*>(&n); auto tmp = static_cast<const op::MVN*>(&n);
node["reduction_axes"] = serialize_axis_set(tmp->get_reduction_axes()); node["reduction_axes"] = serialize_axis_set(tmp->get_reduction_axes());
node["normalize_variance"] = tmp->get_normalize_variance(); node["normalize_variance"] = tmp->get_normalize_variance();
node["eps"] = tmp->get_eps(); node["eps"] = tmp->get_eps();
...@@ -3012,14 +3012,14 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3012,14 +3012,14 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::NormalizeL2: case OP_TYPEID::NormalizeL2:
{ {
auto tmp = dynamic_cast<const op::NormalizeL2*>(&n); auto tmp = static_cast<const op::NormalizeL2*>(&n);
node["eps"] = tmp->get_eps(); node["eps"] = tmp->get_eps();
node["eps_mode"] = tmp->get_eps_mode(); node["eps_mode"] = tmp->get_eps_mode();
break; break;
} }
case OP_TYPEID::NotEqual: case OP_TYPEID::NotEqual:
{ {
auto tmp = dynamic_cast<const op::NotEqual*>(&n); auto tmp = static_cast<const op::NotEqual*>(&n);
if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE) if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE)
{ {
node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob()); node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob());
...@@ -3030,14 +3030,14 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3030,14 +3030,14 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::OneHot: case OP_TYPEID::OneHot:
{ {
auto tmp = dynamic_cast<const op::OneHot*>(&n); auto tmp = static_cast<const op::OneHot*>(&n);
node["shape"] = write_partial_shape(tmp->get_output_partial_shape(0)); node["shape"] = write_partial_shape(tmp->get_output_partial_shape(0));
node["one_hot_axis"] = tmp->get_one_hot_axis(); node["one_hot_axis"] = tmp->get_one_hot_axis();
break; break;
} }
case OP_TYPEID::Or: case OP_TYPEID::Or:
{ {
auto tmp = dynamic_cast<const op::Or*>(&n); auto tmp = static_cast<const op::Or*>(&n);
if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE) if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE)
{ {
node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob()); node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob());
...@@ -3048,21 +3048,21 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3048,21 +3048,21 @@ json JSONSerializer::serialize_node(const Node& n)
{ {
if (op_version == 0) if (op_version == 0)
{ {
auto tmp = dynamic_cast<const op::v0::Pad*>(&n); auto tmp = static_cast<const op::v0::Pad*>(&n);
node["padding_below"] = tmp->get_padding_below(); node["padding_below"] = tmp->get_padding_below();
node["padding_above"] = tmp->get_padding_above(); node["padding_above"] = tmp->get_padding_above();
node["pad_mode"] = tmp->get_pad_mode(); node["pad_mode"] = tmp->get_pad_mode();
} }
if (op_version == 1) if (op_version == 1)
{ {
auto tmp = dynamic_cast<const op::v1::Pad*>(&n); auto tmp = static_cast<const op::v1::Pad*>(&n);
node["pad_mode"] = tmp->get_pad_mode(); node["pad_mode"] = tmp->get_pad_mode();
} }
break; break;
} }
case OP_TYPEID::Parameter: case OP_TYPEID::Parameter:
{ {
auto tmp = dynamic_cast<const op::Parameter*>(&n); auto tmp = static_cast<const op::Parameter*>(&n);
node["shape"] = write_partial_shape(tmp->get_output_partial_shape(0)); node["shape"] = write_partial_shape(tmp->get_output_partial_shape(0));
node["cacheable"] = tmp->get_cacheable(); node["cacheable"] = tmp->get_cacheable();
node["element_type"] = write_element_type(tmp->get_element_type()); node["element_type"] = write_element_type(tmp->get_element_type());
...@@ -3070,7 +3070,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3070,7 +3070,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Passthrough: case OP_TYPEID::Passthrough:
{ {
auto tmp = dynamic_cast<const op::Passthrough*>(&n); auto tmp = static_cast<const op::Passthrough*>(&n);
node["logical_type"] = tmp->logical_type(); node["logical_type"] = tmp->logical_type();
node["language"] = tmp->language(); node["language"] = tmp->language();
node["function"] = tmp->function(); node["function"] = tmp->function();
...@@ -3095,14 +3095,14 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3095,14 +3095,14 @@ json JSONSerializer::serialize_node(const Node& n)
} }
if (op_version == 1) if (op_version == 1)
{ {
auto tmp = dynamic_cast<const op::v1::ReduceProd*>(&n); auto tmp = static_cast<const op::v1::ReduceProd*>(&n);
node["keep_dims"] = tmp->get_keep_dims(); node["keep_dims"] = tmp->get_keep_dims();
} }
break; break;
} }
case OP_TYPEID::Power: case OP_TYPEID::Power:
{ {
auto tmp = dynamic_cast<const op::Power*>(&n); auto tmp = static_cast<const op::Power*>(&n);
if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE) if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE)
{ {
node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob()); node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob());
...@@ -3111,7 +3111,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3111,7 +3111,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Quantize: case OP_TYPEID::Quantize:
{ {
auto tmp = dynamic_cast<const op::Quantize*>(&n); auto tmp = static_cast<const op::Quantize*>(&n);
node["type"] = write_element_type(tmp->get_element_type()); node["type"] = write_element_type(tmp->get_element_type());
node["axes"] = serialize_axis_set(tmp->get_axes()); node["axes"] = serialize_axis_set(tmp->get_axes());
node["round_mode"] = tmp->get_round_mode(); node["round_mode"] = tmp->get_round_mode();
...@@ -3127,7 +3127,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3127,7 +3127,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::QuantizedConvolution: case OP_TYPEID::QuantizedConvolution:
{ {
auto tmp = dynamic_cast<const op::QuantizedConvolution*>(&n); auto tmp = static_cast<const op::QuantizedConvolution*>(&n);
node["window_movement_strides"] = tmp->get_window_movement_strides(); node["window_movement_strides"] = tmp->get_window_movement_strides();
node["window_dilation_strides"] = tmp->get_window_dilation_strides(); node["window_dilation_strides"] = tmp->get_window_dilation_strides();
node["padding_below"] = tmp->get_padding_below(); node["padding_below"] = tmp->get_padding_below();
...@@ -3143,7 +3143,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3143,7 +3143,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::QuantizedDot: case OP_TYPEID::QuantizedDot:
{ {
auto tmp = dynamic_cast<const op::QuantizedDot*>(&n); auto tmp = static_cast<const op::QuantizedDot*>(&n);
node["reduction_axes_count"] = tmp->get_reduction_axes_count(); node["reduction_axes_count"] = tmp->get_reduction_axes_count();
node["output_type"] = write_element_type(tmp->get_element_type()); node["output_type"] = write_element_type(tmp->get_element_type());
node["input0_axes"] = tmp->get_input0_axes(); node["input0_axes"] = tmp->get_input0_axes();
...@@ -3153,13 +3153,13 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3153,13 +3153,13 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Recv: case OP_TYPEID::Recv:
{ {
auto tmp = dynamic_cast<const op::Recv*>(&n); auto tmp = static_cast<const op::Recv*>(&n);
node["source_id"] = tmp->get_src_id(); node["source_id"] = tmp->get_src_id();
break; break;
} }
case OP_TYPEID::RandomUniform: case OP_TYPEID::RandomUniform:
{ {
auto tmp = dynamic_cast<const op::RandomUniform*>(&n); auto tmp = static_cast<const op::RandomUniform*>(&n);
node["fixed_seed"] = tmp->get_fixed_seed(); node["fixed_seed"] = tmp->get_fixed_seed();
break; break;
} }
...@@ -3171,7 +3171,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3171,7 +3171,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::ReplaceSlice: case OP_TYPEID::ReplaceSlice:
{ {
auto tmp = dynamic_cast<const op::ReplaceSlice*>(&n); auto tmp = static_cast<const op::ReplaceSlice*>(&n);
node["lower_bounds"] = tmp->get_lower_bounds(); node["lower_bounds"] = tmp->get_lower_bounds();
node["upper_bounds"] = tmp->get_upper_bounds(); node["upper_bounds"] = tmp->get_upper_bounds();
node["strides"] = tmp->get_strides(); node["strides"] = tmp->get_strides();
...@@ -3179,14 +3179,14 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3179,14 +3179,14 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Reshape: case OP_TYPEID::Reshape:
{ {
auto tmp = dynamic_cast<const op::Reshape*>(&n); auto tmp = static_cast<const op::Reshape*>(&n);
node["input_order"] = tmp->get_input_order(); node["input_order"] = tmp->get_input_order();
node["output_shape"] = tmp->get_output_shape(); node["output_shape"] = tmp->get_output_shape();
break; break;
} }
case OP_TYPEID::Result: case OP_TYPEID::Result:
{ {
auto tmp = dynamic_cast<const op::Result*>(&n); auto tmp = static_cast<const op::Result*>(&n);
node["needs_default_layout"] = tmp->needs_default_layout(); node["needs_default_layout"] = tmp->needs_default_layout();
break; break;
} }
...@@ -3194,13 +3194,13 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3194,13 +3194,13 @@ json JSONSerializer::serialize_node(const Node& n)
{ {
if (op_version == 0) if (op_version == 0)
{ {
const auto tmp = dynamic_cast<const op::Reverse*>(&n); const auto tmp = static_cast<const op::Reverse*>(&n);
node["reversed_axes"] = serialize_axis_set(tmp->get_reversed_axes()); node["reversed_axes"] = serialize_axis_set(tmp->get_reversed_axes());
break; break;
} }
else if (op_version == 1) else if (op_version == 1)
{ {
const auto tmp = dynamic_cast<const op::v1::Reverse*>(&n); const auto tmp = static_cast<const op::v1::Reverse*>(&n);
node["mode"] = tmp->get_mode(); node["mode"] = tmp->get_mode();
break; break;
} }
...@@ -3208,14 +3208,14 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3208,14 +3208,14 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::ReverseSequence: case OP_TYPEID::ReverseSequence:
{ {
auto tmp = dynamic_cast<const op::ReverseSequence*>(&n); auto tmp = static_cast<const op::ReverseSequence*>(&n);
node["batch_axis"] = tmp->get_batch_axis(); node["batch_axis"] = tmp->get_batch_axis();
node["sequence_axis"] = tmp->get_sequence_axis(); node["sequence_axis"] = tmp->get_sequence_axis();
break; break;
} }
case OP_TYPEID::RNNCell: case OP_TYPEID::RNNCell:
{ {
auto tmp = dynamic_cast<const op::RNNCell*>(&n); auto tmp = static_cast<const op::RNNCell*>(&n);
node["hidden_size"] = tmp->get_hidden_size(); node["hidden_size"] = tmp->get_hidden_size();
node["clip"] = tmp->get_clip(); node["clip"] = tmp->get_clip();
node["activations"] = tmp->get_activations(); node["activations"] = tmp->get_activations();
...@@ -3225,7 +3225,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3225,7 +3225,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::ScalarConstantLike: case OP_TYPEID::ScalarConstantLike:
{ {
auto tmp = dynamic_cast<const op::ScalarConstantLikeBase*>(&n); auto tmp = static_cast<const op::ScalarConstantLikeBase*>(&n);
auto constant = tmp->as_constant(); auto constant = tmp->as_constant();
node["value"] = constant->get_value_strings()[0]; node["value"] = constant->get_value_strings()[0];
node["element_type"] = write_element_type(constant->get_element_type()); node["element_type"] = write_element_type(constant->get_element_type());
...@@ -3241,7 +3241,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3241,7 +3241,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Send: case OP_TYPEID::Send:
{ {
auto tmp = dynamic_cast<const op::Send*>(&n); auto tmp = static_cast<const op::Send*>(&n);
node["dest_id"] = tmp->get_dest_id(); node["dest_id"] = tmp->get_dest_id();
break; break;
} }
...@@ -3249,7 +3249,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3249,7 +3249,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::ShuffleChannels: case OP_TYPEID::ShuffleChannels:
{ {
const auto tmp = dynamic_cast<const op::ShuffleChannels*>(&n); const auto tmp = static_cast<const op::ShuffleChannels*>(&n);
node["axis"] = tmp->get_axis(); node["axis"] = tmp->get_axis();
node["groups"] = tmp->get_groups(); node["groups"] = tmp->get_groups();
break; break;
...@@ -3266,7 +3266,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3266,7 +3266,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Slice: case OP_TYPEID::Slice:
{ {
auto tmp = dynamic_cast<const op::Slice*>(&n); auto tmp = static_cast<const op::Slice*>(&n);
node["lower_bounds"] = tmp->get_lower_bounds(); node["lower_bounds"] = tmp->get_lower_bounds();
node["upper_bounds"] = tmp->get_upper_bounds(); node["upper_bounds"] = tmp->get_upper_bounds();
node["strides"] = tmp->get_strides(); node["strides"] = tmp->get_strides();
...@@ -3274,14 +3274,14 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3274,14 +3274,14 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::SpaceToDepth: case OP_TYPEID::SpaceToDepth:
{ {
auto tmp = dynamic_cast<const op::SpaceToDepth*>(&n); auto tmp = static_cast<const op::SpaceToDepth*>(&n);
node["type"] = write_element_type(tmp->get_element_type()); node["type"] = write_element_type(tmp->get_element_type());
node["block_size"] = tmp->get_block_size(); node["block_size"] = tmp->get_block_size();
break; break;
} }
case OP_TYPEID::Split: case OP_TYPEID::Split:
{ {
auto tmp = dynamic_cast<const op::Split*>(&n); auto tmp = static_cast<const op::Split*>(&n);
node["axis"] = tmp->get_axis(); node["axis"] = tmp->get_axis();
node["splits"] = tmp->get_splits(); node["splits"] = tmp->get_splits();
break; break;
...@@ -3296,7 +3296,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3296,7 +3296,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Subtract: case OP_TYPEID::Subtract:
{ {
auto tmp = dynamic_cast<const op::Subtract*>(&n); auto tmp = static_cast<const op::Subtract*>(&n);
if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE) if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE)
{ {
node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob()); node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob());
...@@ -3311,7 +3311,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3311,7 +3311,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
if (op_version == 1) if (op_version == 1)
{ {
auto tmp = dynamic_cast<const op::v1::ReduceSum*>(&n); auto tmp = static_cast<const op::v1::ReduceSum*>(&n);
node["keep_dims"] = tmp->get_keep_dims(); node["keep_dims"] = tmp->get_keep_dims();
} }
break; break;
...@@ -3320,12 +3320,12 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3320,12 +3320,12 @@ json JSONSerializer::serialize_node(const Node& n)
{ {
if (op_version == 0) if (op_version == 0)
{ {
auto tmp = dynamic_cast<const op::v0::Softmax*>(&n); auto tmp = static_cast<const op::v0::Softmax*>(&n);
node["softmax_axes"] = serialize_axis_set(tmp->get_axes()); node["softmax_axes"] = serialize_axis_set(tmp->get_axes());
} }
if (op_version == 1) if (op_version == 1)
{ {
auto tmp = dynamic_cast<const op::v1::Softmax*>(&n); auto tmp = static_cast<const op::v1::Softmax*>(&n);
node["softmax_axis"] = tmp->get_axis(); node["softmax_axis"] = tmp->get_axis();
} }
break; break;
...@@ -3340,7 +3340,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3340,7 +3340,7 @@ json JSONSerializer::serialize_node(const Node& n)
{ {
if (op_version == 0) if (op_version == 0)
{ {
const auto tmp = dynamic_cast<const op::TopK*>(&n); const auto tmp = static_cast<const op::TopK*>(&n);
node["top_k_axis"] = tmp->get_top_k_axis(); node["top_k_axis"] = tmp->get_top_k_axis();
node["index_element_type"] = write_element_type(tmp->get_index_element_type()); node["index_element_type"] = write_element_type(tmp->get_index_element_type());
node["k"] = tmp->get_k(); node["k"] = tmp->get_k();
...@@ -3348,7 +3348,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3348,7 +3348,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
else if (op_version == 1) else if (op_version == 1)
{ {
const auto tmp = dynamic_cast<const op::v1::TopK*>(&n); const auto tmp = static_cast<const op::v1::TopK*>(&n);
node["axis"] = tmp->get_axis(); node["axis"] = tmp->get_axis();
node["mode"] = tmp->get_mode(); node["mode"] = tmp->get_mode();
node["sort_type"] = tmp->get_sort_type(); node["sort_type"] = tmp->get_sort_type();
...@@ -3363,7 +3363,7 @@ json JSONSerializer::serialize_node(const Node& n) ...@@ -3363,7 +3363,7 @@ json JSONSerializer::serialize_node(const Node& n)
} }
case OP_TYPEID::Xor: case OP_TYPEID::Xor:
{ {
auto tmp = dynamic_cast<const op::Xor*>(&n); auto tmp = static_cast<const op::Xor*>(&n);
if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE) if (tmp->get_autob().m_type != op::AutoBroadcastType::NONE)
{ {
node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob()); node["auto_broadcast"] = write_auto_broadcast(tmp->get_autob());
......
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