Skip to content

Instantly share code, notes, and snippets.

# An implementation for GPU based bilinear upsampling including its gradient
# WARNING: Untested code ahead!
# The code is a translation from the following files:
# https://github.com/pytorch/pytorch/blob/master/caffe2/operators/upsample_op.cu
# https://github.com/pytorch/pytorch/blob/master/caffe2/core/common_gpu.h
# Open issues:
# 1) type stability?
# 2) licensing?
# 3) the array indexing has to be corrected
using CUDAnative
using CuArrays
using StaticArrays
using BenchmarkTools
using Makie
using Test
@inline function lennard_jones(dr, ϵ::T, σ::T) where T
invr2 = inv(sum(abs2, dr) + T(1E-7))
six_term = (σ ^ 2 * invr2) ^ 3