<commit_before>#include <cudawarping.hpp>

extern "C"
struct TensorWrapper remapCuda(struct cutorchInfo info,
        struct TensorWrapper src, struct TensorWrapper map1,
        struct TensorWrapper map2, int interpolation, struct TensorWrapper dst,
        int borderMode, struct ScalarWrapper borderValue)
{
    if (dst.isNull()) {
        cuda::GpuMat retval;
        cuda::remap(src.toGpuMat(), retval, map1.toGpuMat(), map2.toGpuMat(),
                    interpolation, borderMode, borderValue, prepareStream(info));
        return TensorWrapper(retval, info.state);
    } else if (dst.tensorPtr == src.tensorPtr) {
        // in-place
        cuda::GpuMat source = src.toGpuMat();
        cuda::remap(source, source, map1.toGpuMat(), map2.toGpuMat(), interpolation,
                    borderMode, borderValue, prepareStream(info));
    } else {
        cuda::remap(src.toGpuMat(), dst.toGpuMat(), map1.toGpuMat(), map2.toGpuMat(),
                    interpolation, borderMode, borderValue, prepareStream(info));
    }
    return dst;
}

extern "C"
struct TensorWrapper resizeCuda(struct cutorchInfo info,
        struct TensorWrapper src, struct TensorWrapper dst,
        struct SizeWrapper dsize, double fx, double fy,
        int interpolation)
{
    GpuMatT dstMat = dst.toGpuMatT();
    cuda::resize(src.toGpuMat(), dstMat, dsize, fx, fy, interpolation, prepareStream(info));
    return TensorWrapper(dstMat, info.state);
}


extern "C"
struct TensorWrapper warpAffineCuda(struct cutorchInfo info,
        struct TensorWrapper src, struct TensorWrapper dst,
        struct TensorWrapper M, struct SizeWrapper dsize,
        int flags, int borderMode, struct ScalarWrapper borderValue)
{
    if (dst.isNull()) {
        cuda::GpuMat retval;
        cuda::warpAffine(src.toGpuMat(), retval, M.toGpuMat(), dsize, flags,
                         borderMode, borderValue, prepareStream(info));
        return TensorWrapper(retval, info.state);
    } else if (dst.tensorPtr == src.tensorPtr) {
        // in-place
        cuda::GpuMat source = src.toGpuMat();
        cuda::warpAffine(source, source, M.toGpuMat(), dsize, flags, borderMode,
                         borderValue, prepareStream(info));
    } else {
        cuda::warpAffine(src.toGpuMat(), dst.toGpuMat(), M.toGpuMat(), dsize,
                         flags, borderMode, borderValue, prepareStream(info));<commit_msg>Fix #132<commit_after>#include <cudawarping.hpp>

extern "C"
struct TensorWrapper remapCuda(struct cutorchInfo info,
        struct TensorWrapper src, struct TensorWrapper map1,
        struct TensorWrapper map2, int interpolation, struct TensorWrapper dst,
        int borderMode, struct ScalarWrapper borderValue)
{
    if (dst.isNull()) {
        cuda::GpuMat retval;
        cuda::remap(src.toGpuMat(), retval, map1.toGpuMat(), map2.toGpuMat(),
                    interpolation, borderMode, borderValue, prepareStream(info));
        return TensorWrapper(retval, info.state);
    } else if (dst.tensorPtr == src.tensorPtr) {
        // in-place
        cuda::GpuMat source = src.toGpuMat();
        cuda::remap(source, source, map1.toGpuMat(), map2.toGpuMat(), interpolation,
                    borderMode, borderValue, prepareStream(info));
    } else {
        cuda::remap(src.toGpuMat(), dst.toGpuMat(), map1.toGpuMat(), map2.toGpuMat(),
                    interpolation, borderMode, borderValue, prepareStream(info));
    }
    return dst;
}

extern "C"
struct TensorWrapper resizeCuda(struct cutorchInfo info,
        struct TensorWrapper src, struct TensorWrapper dst,
        struct SizeWrapper dsize, double fx, double fy,
        int interpolation)
{
    GpuMatT dstMat = dst.toGpuMatT();
    cuda::resize(src.toGpuMat(), dstMat, dsize, fx, fy, interpolation, prepareStream(info));
    return TensorWrapper(dstMat, info.state);
}


extern "C"
struct TensorWrapper warpAffineCuda(struct cutorchInfo info,
        struct TensorWrapper src, struct TensorWrapper dst,
        struct TensorWrapper M, struct SizeWrapper dsize,
        int flags, int borderMode, struct ScalarWrapper borderValue)
{
    if (dst.isNull()) {
        cuda::GpuMat retval;
        cuda::warpAffine(src.toGpuMat(), retval, M.toMat(), dsize, flags,
                         borderMode, borderValue, prepareStream(info));
        return TensorWrapper(retval, info.state);
    } else if (dst.tensorPtr == src.tensorPtr) {
        // in-place
        cuda::GpuMat source = src.toGpuMat();
        cuda::warpAffine(source, source, M.toMat(), dsize, flags, borderMode,
                         borderValue, prepareStream(info));
    } else {
        cuda::warpAffine(src.toGpuMat(), dst.toGpuMat(), M.toMat(), dsize,
                         flags, borderMode, borderValue, prepareStream(info));
{'fraction_non_alphanumeric': 0.11304530201342282, 'fraction_numerical': 0.003984899328859061, 'mean_word_length': 3.0008389261744965, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2806072', 'n_tokens_mistral': 1459, 'n_tokens_neox': 1436, 'n_words': 342}