|
7 | 7 | int BilinearSamplerBHWD_updateOutput(THFloatTensor *inputImages, THFloatTensor *grids, THFloatTensor *output) |
8 | 8 | { |
9 | 9 |
|
10 | | - int batchsize = inputImages->size[0]; |
11 | | - int inputImages_height = inputImages->size[1]; |
12 | | - int inputImages_width = inputImages->size[2]; |
13 | | - int output_height = output->size[1]; |
14 | | - int output_width = output->size[2]; |
15 | | - int inputImages_channels = inputImages->size[3]; |
| 10 | + int batchsize = THFloatTensor_size(inputImages, 0); |
| 11 | + int inputImages_height = THFloatTensor_size(inputImages, 1); |
| 12 | + int inputImages_width = THFloatTensor_size(inputImages, 2); |
| 13 | + int output_height = THFloatTensor_size(output, 1); |
| 14 | + int output_width = THFloatTensor_size(output, 2); |
| 15 | + int inputImages_channels = THFloatTensor_size(inputImages, 3); |
16 | 16 |
|
17 | | - int output_strideBatch = output->stride[0]; |
18 | | - int output_strideHeight = output->stride[1]; |
19 | | - int output_strideWidth = output->stride[2]; |
| 17 | + int output_strideBatch = THFloatTensor_stride(output, 0); |
| 18 | + int output_strideHeight = THFloatTensor_stride(output, 1); |
| 19 | + int output_strideWidth = THFloatTensor_stride(output, 2); |
20 | 20 |
|
21 | | - int inputImages_strideBatch = inputImages->stride[0]; |
22 | | - int inputImages_strideHeight = inputImages->stride[1]; |
23 | | - int inputImages_strideWidth = inputImages->stride[2]; |
| 21 | + int inputImages_strideBatch = THFloatTensor_stride(inputImages, 0); |
| 22 | + int inputImages_strideHeight = THFloatTensor_stride(inputImages, 1); |
| 23 | + int inputImages_strideWidth = THFloatTensor_stride(inputImages, 2); |
24 | 24 |
|
25 | | - int grids_strideBatch = grids->stride[0]; |
26 | | - int grids_strideHeight = grids->stride[1]; |
27 | | - int grids_strideWidth = grids->stride[2]; |
| 25 | + int grids_strideBatch = THFloatTensor_stride(grids, 0); |
| 26 | + int grids_strideHeight = THFloatTensor_stride(grids, 1); |
| 27 | + int grids_strideWidth = THFloatTensor_stride(grids, 2); |
28 | 28 |
|
29 | 29 |
|
30 | 30 | real *inputImages_data, *output_data, *grids_data; |
@@ -107,32 +107,32 @@ int BilinearSamplerBHWD_updateGradInput(THFloatTensor *inputImages, THFloatTenso |
107 | 107 | { |
108 | 108 | bool onlyGrid=false; |
109 | 109 |
|
110 | | - int batchsize = inputImages->size[0]; |
111 | | - int inputImages_height = inputImages->size[1]; |
112 | | - int inputImages_width = inputImages->size[2]; |
113 | | - int gradOutput_height = gradOutput->size[1]; |
114 | | - int gradOutput_width = gradOutput->size[2]; |
115 | | - int inputImages_channels = inputImages->size[3]; |
| 110 | + int batchsize = THFloatTensor_size(inputImages, 0); |
| 111 | + int inputImages_height = THFloatTensor_size(inputImages, 1); |
| 112 | + int inputImages_width = THFloatTensor_size(inputImages, 2); |
| 113 | + int gradOutput_height = THFloatTensor_size(gradOutput, 1); |
| 114 | + int gradOutput_width = THFloatTensor_size(gradOutput, 2); |
| 115 | + int inputImages_channels = THFloatTensor_size(inputImages, 3); |
116 | 116 |
|
117 | | - int gradOutput_strideBatch = gradOutput->stride[0]; |
118 | | - int gradOutput_strideHeight = gradOutput->stride[1]; |
119 | | - int gradOutput_strideWidth = gradOutput->stride[2]; |
| 117 | + int inputImages_strideBatch = THFloatTensor_stride(inputImages, 0); |
| 118 | + int inputImages_strideHeight = THFloatTensor_stride(inputImages, 1); |
| 119 | + int inputImages_strideWidth = THFloatTensor_stride(inputImages, 2); |
120 | 120 |
|
121 | | - int inputImages_strideBatch = inputImages->stride[0]; |
122 | | - int inputImages_strideHeight = inputImages->stride[1]; |
123 | | - int inputImages_strideWidth = inputImages->stride[2]; |
| 121 | + int gradOutput_strideBatch = THFloatTensor_stride(gradOutput, 0); |
| 122 | + int gradOutput_strideHeight = THFloatTensor_stride(gradOutput, 1); |
| 123 | + int gradOutput_strideWidth = THFloatTensor_stride(gradOutput, 2); |
124 | 124 |
|
125 | | - int gradInputImages_strideBatch = gradInputImages->stride[0]; |
126 | | - int gradInputImages_strideHeight = gradInputImages->stride[1]; |
127 | | - int gradInputImages_strideWidth = gradInputImages->stride[2]; |
| 125 | + int gradInputImages_strideBatch = THFloatTensor_stride(gradInputImages, 0); |
| 126 | + int gradInputImages_strideHeight = THFloatTensor_stride(gradInputImages, 1); |
| 127 | + int gradInputImages_strideWidth = THFloatTensor_stride(gradInputImages, 2); |
128 | 128 |
|
129 | | - int grids_strideBatch = grids->stride[0]; |
130 | | - int grids_strideHeight = grids->stride[1]; |
131 | | - int grids_strideWidth = grids->stride[2]; |
| 129 | + int grids_strideBatch = THFloatTensor_stride(grids, 0); |
| 130 | + int grids_strideHeight = THFloatTensor_stride(grids, 1); |
| 131 | + int grids_strideWidth = THFloatTensor_stride(grids, 2); |
132 | 132 |
|
133 | | - int gradGrids_strideBatch = gradGrids->stride[0]; |
134 | | - int gradGrids_strideHeight = gradGrids->stride[1]; |
135 | | - int gradGrids_strideWidth = gradGrids->stride[2]; |
| 133 | + int gradGrids_strideBatch = THFloatTensor_stride(gradGrids, 0); |
| 134 | + int gradGrids_strideHeight = THFloatTensor_stride(gradGrids, 1); |
| 135 | + int gradGrids_strideWidth = THFloatTensor_stride(gradGrids, 2); |
136 | 136 |
|
137 | 137 | real *inputImages_data, *gradOutput_data, *grids_data, *gradGrids_data, *gradInputImages_data; |
138 | 138 | inputImages_data = THFloatTensor_data(inputImages); |
@@ -246,29 +246,29 @@ int BilinearSamplerBHWD_updateGradInput(THFloatTensor *inputImages, THFloatTenso |
246 | 246 | int BilinearSamplerBCHW_updateOutput(THFloatTensor *inputImages, THFloatTensor *grids, THFloatTensor *output) |
247 | 247 | { |
248 | 248 |
|
249 | | - int batchsize = inputImages->size[0]; |
250 | | - int inputImages_height = inputImages->size[2]; |
251 | | - int inputImages_width = inputImages->size[3]; |
| 249 | + int batchsize = THFloatTensor_size(inputImages, 0); |
| 250 | + int inputImages_height = THFloatTensor_size(inputImages, 2); |
| 251 | + int inputImages_width = THFloatTensor_size(inputImages, 3); |
252 | 252 |
|
253 | | - int output_height = output->size[2]; |
254 | | - int output_width = output->size[3]; |
255 | | - int inputImages_channels = inputImages->size[1]; |
256 | | - |
257 | | - int output_strideBatch = output->stride[0]; |
258 | | - int output_strideHeight = output->stride[2]; |
259 | | - int output_strideWidth = output->stride[3]; |
260 | | - int output_strideChannel = output->stride[1]; |
| 253 | + int output_height = THFloatTensor_size(output, 2); |
| 254 | + int output_width = THFloatTensor_size(output, 3); |
| 255 | + int inputImages_channels = THFloatTensor_size(inputImages, 1); |
| 256 | + |
| 257 | + int output_strideBatch = THFloatTensor_stride(output, 0); |
| 258 | + int output_strideHeight = THFloatTensor_stride(output, 2); |
| 259 | + int output_strideWidth = THFloatTensor_stride(output, 3); |
| 260 | + int output_strideChannel = THFloatTensor_stride(output, 1); |
261 | 261 |
|
262 | 262 |
|
263 | | - int inputImages_strideBatch = inputImages->stride[0]; |
264 | | - int inputImages_strideHeight = inputImages->stride[2]; |
265 | | - int inputImages_strideWidth = inputImages->stride[3]; |
266 | | - int inputImages_strideChannel = inputImages->stride[1]; |
| 263 | + int inputImages_strideBatch = THFloatTensor_stride(inputImages, 0); |
| 264 | + int inputImages_strideHeight = THFloatTensor_stride(inputImages, 2); |
| 265 | + int inputImages_strideWidth = THFloatTensor_stride(inputImages, 3); |
| 266 | + int inputImages_strideChannel = THFloatTensor_stride(inputImages, 1); |
267 | 267 |
|
268 | | - int grids_strideBatch = grids->stride[0]; |
269 | | - int grids_strideHeight = grids->stride[2]; |
270 | | - int grids_strideWidth = grids->stride[3]; |
271 | | - int grids_strideChannel = grids->stride[1]; |
| 268 | + int grids_strideBatch = THFloatTensor_stride(grids, 0); |
| 269 | + int grids_strideHeight = THFloatTensor_stride(grids, 2); |
| 270 | + int grids_strideWidth = THFloatTensor_stride(grids, 3); |
| 271 | + int grids_strideChannel = THFloatTensor_stride(grids, 1); |
272 | 272 |
|
273 | 273 |
|
274 | 274 | real *inputImages_data, *output_data, *grids_data; |
@@ -352,38 +352,37 @@ int BilinearSamplerBCHW_updateGradInput(THFloatTensor *inputImages, THFloatTenso |
352 | 352 | { |
353 | 353 | bool onlyGrid=false; |
354 | 354 |
|
355 | | - int batchsize = inputImages->size[0]; |
356 | | - int inputImages_height = inputImages->size[2]; |
357 | | - int inputImages_width = inputImages->size[3]; |
358 | | - int gradOutput_height = gradOutput->size[2]; |
359 | | - int gradOutput_width = gradOutput->size[3]; |
360 | | - int inputImages_channels = inputImages->size[1]; |
361 | | - |
362 | | - int gradOutput_strideBatch = gradOutput->stride[0]; |
363 | | - int gradOutput_strideHeight = gradOutput->stride[2]; |
364 | | - int gradOutput_strideWidth = gradOutput->stride[3]; |
365 | | - int gradOutput_strideChannel = gradOutput->stride[1]; |
366 | | - |
367 | | - int inputImages_strideBatch = inputImages->stride[0]; |
368 | | - int inputImages_strideHeight = inputImages->stride[2]; |
369 | | - int inputImages_strideWidth = inputImages->stride[3]; |
370 | | - int inputImages_strideChannel = inputImages->stride[1]; |
371 | | - |
372 | | - |
373 | | - int gradInputImages_strideBatch = gradInputImages->stride[0]; |
374 | | - int gradInputImages_strideHeight = gradInputImages->stride[2]; |
375 | | - int gradInputImages_strideWidth = gradInputImages->stride[3]; |
376 | | - int gradInputImages_strideChannel = gradInputImages->stride[1]; |
377 | | - |
378 | | - int grids_strideBatch = grids->stride[0]; |
379 | | - int grids_strideHeight = grids->stride[2]; |
380 | | - int grids_strideWidth = grids->stride[3]; |
381 | | - int grids_strideChannel = grids->stride[1]; |
382 | | - |
383 | | - int gradGrids_strideBatch = gradGrids->stride[0]; |
384 | | - int gradGrids_strideHeight = gradGrids->stride[2]; |
385 | | - int gradGrids_strideWidth = gradGrids->stride[3]; |
386 | | - int gradGrids_strideChannel = gradGrids->stride[1]; |
| 355 | + int batchsize = THFloatTensor_size(inputImages, 0); |
| 356 | + int inputImages_height = THFloatTensor_size(inputImages, 2); |
| 357 | + int inputImages_width = THFloatTensor_size(inputImages, 3); |
| 358 | + int inputImages_channels = THFloatTensor_size(inputImages, 1); |
| 359 | + int gradOutput_height = THFloatTensor_size(gradOutput, 2); |
| 360 | + int gradOutput_width = THFloatTensor_size(gradOutput, 3); |
| 361 | + |
| 362 | + int gradOutput_strideBatch = THFloatTensor_stride(gradOutput, 0); |
| 363 | + int gradOutput_strideHeight = THFloatTensor_stride(gradOutput, 2); |
| 364 | + int gradOutput_strideWidth = THFloatTensor_stride(gradOutput, 3); |
| 365 | + int gradOutput_strideChannel = THFloatTensor_stride(gradOutput, 1); |
| 366 | + |
| 367 | + int inputImages_strideBatch = THFloatTensor_stride(inputImages, 0); |
| 368 | + int inputImages_strideHeight = THFloatTensor_stride(inputImages, 2); |
| 369 | + int inputImages_strideWidth = THFloatTensor_stride(inputImages, 3); |
| 370 | + int inputImages_strideChannel = THFloatTensor_stride(inputImages, 1); |
| 371 | + |
| 372 | + int gradInputImages_strideBatch = THFloatTensor_stride(gradInputImages, 0); |
| 373 | + int gradInputImages_strideHeight = THFloatTensor_stride(gradInputImages, 2); |
| 374 | + int gradInputImages_strideWidth = THFloatTensor_stride(gradInputImages, 3); |
| 375 | + int gradInputImages_strideChannel = THFloatTensor_stride(gradInputImages, 1); |
| 376 | + |
| 377 | + int grids_strideBatch = THFloatTensor_stride(grids, 0); |
| 378 | + int grids_strideHeight = THFloatTensor_stride(grids, 2); |
| 379 | + int grids_strideWidth = THFloatTensor_stride(grids, 3); |
| 380 | + int grids_strideChannel = THFloatTensor_stride(grids, 1); |
| 381 | + |
| 382 | + int gradGrids_strideBatch = THFloatTensor_stride(gradGrids, 0); |
| 383 | + int gradGrids_strideHeight = THFloatTensor_stride(gradGrids, 2); |
| 384 | + int gradGrids_strideWidth = THFloatTensor_stride(gradGrids, 3); |
| 385 | + int gradGrids_strideChannel = THFloatTensor_stride(gradGrids, 1); |
387 | 386 |
|
388 | 387 | real *inputImages_data, *gradOutput_data, *grids_data, *gradGrids_data, *gradInputImages_data; |
389 | 388 | inputImages_data = THFloatTensor_data(inputImages); |
|
0 commit comments