|
16 | 16 | #include <THC/generic/THCTensor.cpp> |
17 | 17 | #include <THC/THCGenerateBFloat16Type.h> |
18 | 18 |
|
19 | | -#include <THC/THCTensorInfo.cuh> |
20 | | - |
21 | 19 | #include <ATen/native/cuda/Resize.cuh> |
22 | 20 |
|
23 | 21 | int THCTensor_nDimension(THCState *state, const THCTensor *self) { |
@@ -326,51 +324,3 @@ int compareSizeAndStride(const void* a, const void* b) { |
326 | 324 | } |
327 | 325 |
|
328 | 326 | } |
329 | | - |
330 | | -/* Returns false if there is no possibility that the tensor */ |
331 | | -/* has "overlapping" indices and true otherwise. */ |
332 | | -/* "Overlapping" indices are two+ valid indices that specify */ |
333 | | -/* the same offset within the tensor. */ |
334 | | -/* The function does this by checking for a sufficient but not */ |
335 | | -/* necessary condition of no overlap. In particular, that */ |
336 | | -/* that there exists an ordering of the tensor's dimensions */ |
337 | | -/* that is nicely "nested," with each dimension contained */ |
338 | | -/* within the next one. */ |
339 | | -bool THCTensor_maybeOverlappingIndices(THCState* state, const THCTensor* t) { |
340 | | - /* Extract size/stride arrays; only consider size >1 dims. */ |
341 | | - SizeAndStride info[MAX_CUTORCH_DIMS]; |
342 | | - |
343 | | - int dims = THCTensor_nDimensionLegacyAll(state, t); |
344 | | - int nonSize1Dims = 0; |
345 | | - for (int i = 0; i < dims; ++i) { |
346 | | - int64_t size = THCTensor_sizeLegacyNoScalars(state, t, i); |
347 | | - |
348 | | - if (size > 1) { |
349 | | - info[nonSize1Dims].size = size; |
350 | | - info[nonSize1Dims].stride = |
351 | | - THCTensor_stride(state, t, i); |
352 | | - |
353 | | - if (info[nonSize1Dims].stride < 1) { |
354 | | - return true; |
355 | | - } |
356 | | - |
357 | | - ++nonSize1Dims; |
358 | | - } |
359 | | - } |
360 | | - |
361 | | - /* Short-circuits if tensor is a single element. */ |
362 | | - if (nonSize1Dims == 0) { |
363 | | - return false; |
364 | | - } |
365 | | - |
366 | | - /* Ascending order (innermost dimension in sorted view is at [0]) */ |
367 | | - qsort(info, nonSize1Dims, sizeof(SizeAndStride), compareSizeAndStride); |
368 | | - |
369 | | - for (int i = 0; i < (nonSize1Dims - 1); ++i) { |
370 | | - if (((info[i].size - 1) * info[i].stride) >= info[i + 1].stride) { |
371 | | - return true; |
372 | | - } |
373 | | - } |
374 | | - |
375 | | - return false; |
376 | | -} |
0 commit comments