@@ -113,27 +113,31 @@ void grid_sample_2d_bilinear_kernel_impl_nchw(
113113 if (padding_mode == GridSamplerPadding::Zeros) {
114114 // For zeros padding, only sample if within bounds
115115 if (within_bounds_2d (iy_nw, ix_nw, inp_H, inp_W)) {
116- out_val += static_cast <ACC >(in_data
117- [in_channel_offset + iy_nw * in.strides ()[2 ] +
118- ix_nw * in.strides ()[3 ]]) *
116+ out_val += static_cast <ACC >(
117+ in_data
118+ [in_channel_offset + iy_nw * in.strides ()[2 ] +
119+ ix_nw * in.strides ()[3 ]]) *
119120 nw_weight;
120121 }
121122 if (within_bounds_2d (iy_ne, ix_ne, inp_H, inp_W)) {
122- out_val += static_cast <ACC >(in_data
123- [in_channel_offset + iy_ne * in.strides ()[2 ] +
124- ix_ne * in.strides ()[3 ]]) *
123+ out_val += static_cast <ACC >(
124+ in_data
125+ [in_channel_offset + iy_ne * in.strides ()[2 ] +
126+ ix_ne * in.strides ()[3 ]]) *
125127 ne_weight;
126128 }
127129 if (within_bounds_2d (iy_sw, ix_sw, inp_H, inp_W)) {
128- out_val += static_cast <ACC >(in_data
129- [in_channel_offset + iy_sw * in.strides ()[2 ] +
130- ix_sw * in.strides ()[3 ]]) *
130+ out_val += static_cast <ACC >(
131+ in_data
132+ [in_channel_offset + iy_sw * in.strides ()[2 ] +
133+ ix_sw * in.strides ()[3 ]]) *
131134 sw_weight;
132135 }
133136 if (within_bounds_2d (iy_se, ix_se, inp_H, inp_W)) {
134- out_val += static_cast <ACC >(in_data
135- [in_channel_offset + iy_se * in.strides ()[2 ] +
136- ix_se * in.strides ()[3 ]]) *
137+ out_val += static_cast <ACC >(
138+ in_data
139+ [in_channel_offset + iy_se * in.strides ()[2 ] +
140+ ix_se * in.strides ()[3 ]]) *
137141 se_weight;
138142 }
139143 } else {
@@ -148,19 +152,24 @@ void grid_sample_2d_bilinear_kernel_impl_nchw(
148152 const int64_t iy_sw_safe = clip_coordinates (iy_sw, inp_H);
149153 const int64_t ix_se_safe = clip_coordinates (ix_se, inp_W);
150154 const int64_t iy_se_safe = clip_coordinates (iy_se, inp_H);
151- out_val = static_cast <ACC >(in_data
152- [in_channel_offset + iy_nw_safe * in.strides ()[2 ] +
153- ix_nw_safe * in.strides ()[3 ]]) *
155+ out_val =
156+ static_cast <ACC >(
157+ in_data
158+ [in_channel_offset + iy_nw_safe * in.strides ()[2 ] +
159+ ix_nw_safe * in.strides ()[3 ]]) *
154160 nw_weight +
155- static_cast <ACC >(in_data
161+ static_cast <ACC >(
162+ in_data
156163 [in_channel_offset + iy_ne_safe * in.strides ()[2 ] +
157164 ix_ne_safe * in.strides ()[3 ]]) *
158165 ne_weight +
159- static_cast <ACC >(in_data
166+ static_cast <ACC >(
167+ in_data
160168 [in_channel_offset + iy_sw_safe * in.strides ()[2 ] +
161169 ix_sw_safe * in.strides ()[3 ]]) *
162170 sw_weight +
163- static_cast <ACC >(in_data
171+ static_cast <ACC >(
172+ in_data
164173 [in_channel_offset + iy_se_safe * in.strides ()[2 ] +
165174 ix_se_safe * in.strides ()[3 ]]) *
166175 se_weight;
0 commit comments