@@ -85,14 +85,14 @@ __device__ inline static Ty bicubicInterpFunc(Ty val[4][4], Tp xratio,
8585 return cubicInterpFunc (res, yratio, spline);
8686}
8787
88- template <typename Ty, typename Tp, int order>
88+ template <typename Ty, typename Tp, int xdim, int order>
8989struct Interp1 {};
9090
91- template <typename Ty, typename Tp>
92- struct Interp1 <Ty, Tp, 1 > {
91+ template <typename Ty, typename Tp, int xdim >
92+ struct Interp1 <Ty, Tp, xdim, 1 > {
9393 __device__ void operator ()(Param<Ty> out, int ooff, CParam<Ty> in, int ioff,
9494 Tp x, af::interpType method, int batch,
95- bool clamp, int xdim = 0 , int batch_dim = 1 ) {
95+ bool clamp, int batch_dim = 1 ) {
9696 Ty zero = scalar<Ty>(0 );
9797
9898 const int x_lim = in.dims [xdim];
@@ -113,11 +113,11 @@ struct Interp1<Ty, Tp, 1> {
113113 }
114114};
115115
116- template <typename Ty, typename Tp>
117- struct Interp1 <Ty, Tp, 2 > {
116+ template <typename Ty, typename Tp, int xdim >
117+ struct Interp1 <Ty, Tp, xdim, 2 > {
118118 __device__ void operator ()(Param<Ty> out, int ooff, CParam<Ty> in, int ioff,
119119 Tp x, af::interpType method, int batch,
120- bool clamp, int xdim = 0 , int batch_dim = 1 ) {
120+ bool clamp, int batch_dim = 1 ) {
121121 typedef typename itype_t <Tp>::wtype WT ;
122122 typedef typename itype_t <Ty>::vtype VT ;
123123
@@ -149,11 +149,11 @@ struct Interp1<Ty, Tp, 2> {
149149 }
150150};
151151
152- template <typename Ty, typename Tp>
153- struct Interp1 <Ty, Tp, 3 > {
152+ template <typename Ty, typename Tp, int xdim >
153+ struct Interp1 <Ty, Tp, xdim, 3 > {
154154 __device__ void operator ()(Param<Ty> out, int ooff, CParam<Ty> in, int ioff,
155155 Tp x, af::interpType method, int batch,
156- bool clamp, int xdim = 0 , int batch_dim = 1 ) {
156+ bool clamp, int batch_dim = 1 ) {
157157 typedef typename itype_t <Tp>::wtype WT ;
158158 typedef typename itype_t <Ty>::vtype VT ;
159159
@@ -184,15 +184,14 @@ struct Interp1<Ty, Tp, 3> {
184184 }
185185};
186186
187- template <typename Ty, typename Tp, int order>
187+ template <typename Ty, typename Tp, int xdim, int ydim, int order>
188188struct Interp2 {};
189189
190- template <typename Ty, typename Tp>
191- struct Interp2 <Ty, Tp, 1 > {
190+ template <typename Ty, typename Tp, int xdim, int ydim >
191+ struct Interp2 <Ty, Tp, xdim, ydim, 1 > {
192192 __device__ void operator ()(Param<Ty> out, int ooff, CParam<Ty> in, int ioff,
193193 Tp x, Tp y, af::interpType method, int batch,
194- bool clamp, int xdim = 0 , int ydim = 1 ,
195- int batch_dim = 2 ) {
194+ bool clamp, int batch_dim = 2 ) {
196195 int xid = (method == AF_INTERP_LOWER ? floor (x) : round (x));
197196 int yid = (method == AF_INTERP_LOWER ? floor (y) : round (y));
198197
@@ -222,12 +221,11 @@ struct Interp2<Ty, Tp, 1> {
222221 }
223222};
224223
225- template <typename Ty, typename Tp>
226- struct Interp2 <Ty, Tp, 2 > {
224+ template <typename Ty, typename Tp, int xdim, int ydim >
225+ struct Interp2 <Ty, Tp, xdim, ydim, 2 > {
227226 __device__ void operator ()(Param<Ty> out, int ooff, CParam<Ty> in, int ioff,
228227 Tp x, Tp y, af::interpType method, int batch,
229- bool clamp, int xdim = 0 , int ydim = 1 ,
230- int batch_dim = 2 ) {
228+ bool clamp, int batch_dim = 2 ) {
231229 typedef typename itype_t <Tp>::wtype WT ;
232230 typedef typename itype_t <Ty>::vtype VT ;
233231
@@ -275,12 +273,11 @@ struct Interp2<Ty, Tp, 2> {
275273 }
276274};
277275
278- template <typename Ty, typename Tp>
279- struct Interp2 <Ty, Tp, 3 > {
276+ template <typename Ty, typename Tp, int xdim, int ydim >
277+ struct Interp2 <Ty, Tp, xdim, ydim, 3 > {
280278 __device__ void operator ()(Param<Ty> out, int ooff, CParam<Ty> in, int ioff,
281279 Tp x, Tp y, af::interpType method, int batch,
282- bool clamp, int xdim = 0 , int ydim = 1 ,
283- int batch_dim = 2 ) {
280+ bool clamp, int batch_dim = 2 ) {
284281 typedef typename itype_t <Tp>::wtype WT ;
285282 typedef typename itype_t <Ty>::vtype VT ;
286283
0 commit comments