| 3707 | } |
| 3708 | |
| 3709 | void InterpolateInferMeta( |
| 3710 | const MetaTensor& x, |
| 3711 | const MetaTensor& out_size, |
| 3712 | const paddle::optional<std::vector<const MetaTensor*>>& size_tensor, |
| 3713 | const MetaTensor& scale_tensor, |
| 3714 | const std::string& data_layout_str, |
| 3715 | int out_d, |
| 3716 | int out_h, |
| 3717 | int out_w, |
| 3718 | const std::vector<double>& scale, |
| 3719 | const std::string& interp_method, |
| 3720 | bool align_corners, |
| 3721 | int align_mode, |
| 3722 | MetaTensor* output, |
| 3723 | MetaConfig config) { |
| 3724 | auto dim_x = x.dims(); // NCHW format |
| 3725 | PADDLE_ENFORCE_EQ( |
| 3726 | (dim_x.size() == 3 || dim_x.size() == 4 || dim_x.size() == 5), |
| 3727 | true, |
| 3728 | common::errors::Unimplemented( |
| 3729 | "Input(X) dimension must be 3, 4 or 5, but got dimension = %d .", |
| 3730 | dim_x.size())); |
| 3731 | if (dim_x.size() == 3) { |
| 3732 | // shape check for 1D interpolate for input tensor shape NCHW |
| 3733 | Interpolate1DInferShapeCheck(x, |
| 3734 | out_size, |
| 3735 | size_tensor, |
| 3736 | scale_tensor, |
| 3737 | data_layout_str, |
| 3738 | out_d, |
| 3739 | out_h, |
| 3740 | out_w, |
| 3741 | scale, |
| 3742 | interp_method, |
| 3743 | align_corners, |
| 3744 | align_mode, |
| 3745 | output, |
| 3746 | config); |
| 3747 | } else if (dim_x.size() == 4) { |
| 3748 | // shape check for 2D interpolate for input tensor shape NCHW |
| 3749 | Interpolate2DInferShapeCheck(x, |
| 3750 | out_size, |
| 3751 | size_tensor, |
| 3752 | scale_tensor, |
| 3753 | data_layout_str, |
| 3754 | out_d, |
| 3755 | out_h, |
| 3756 | out_w, |
| 3757 | scale, |
| 3758 | interp_method, |
| 3759 | align_corners, |
| 3760 | align_mode, |
| 3761 | output, |
| 3762 | config); |
| 3763 | } else { // dim_x.size() == 5 |
| 3764 | // shape check for 3D interpolate for input tensor shape NCDHW |
| 3765 | Interpolate3DInferShapeCheck(x, |
| 3766 | out_size, |
no test coverage detected