#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION) #pragma once #include #include #include #include namespace at::native { template inline std::vector generate_intervals( scalar_t sample, int64_t inputSize, int64_t outputSize, int64_t poolSize) { std::vector sequence(outputSize); if (outputSize > 1) { scalar_t alpha = static_cast(inputSize - poolSize) / static_cast(outputSize - 1); for (const auto i : c10::irange(outputSize - 1)) { sequence[i] = static_cast((i + sample) * alpha) - static_cast(sample * alpha); } } if (outputSize > 0) { sequence[outputSize - 1] = inputSize - poolSize; } return sequence; } } // namespace at::native #else #error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined." #endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)