This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |