@@ -35,10 +35,43 @@ Base.unsafe_convert(::Type{CuPtr{T}}, A::NNlib.BatchedAdjOrTrans{T}) where {T} =
35
35
# Upsampling
36
36
#
37
37
38
- # An implementation for GPU based bilinear upsampling including its gradient
38
+ # GPU based bilinear upsampling including its gradient
39
+ #
40
+ # Based on the Caffe2 implementation at:
39
41
# The code is a translation from the following files:
40
- # https://github.com/pytorch/pytorch/blob/master/caffe2/operators/upsample_op.cu
41
- # https://github.com/pytorch/pytorch/blob/master/caffe2/core/common_gpu.h
42
+ # - https://github.com/pytorch/pytorch/blob/v1.8.0-rc1/caffe2/operators/upsample_op.cu
43
+ # - https://github.com/pytorch/pytorch/blob/v1.8.0-rc1/caffe2/core/common_gpu.h
44
+ #
45
+ # Copyright (c) 2016-2021 Facebook Inc.
46
+ # Copyright (c) 2015 Google Inc.
47
+ # Copyright (c) 2015 Yangqing Jia
48
+ # Copyright 2019-2020 Kakao Brain
49
+ #
50
+ # All rights reserved.
51
+ #
52
+ # Redistribution and use in source and binary forms, with or without modification, are
53
+ # permitted provided that the following conditions are met:
54
+ #
55
+ # 1. Redistributions of source code must retain the above copyright notice, this list of
56
+ # conditions and the following disclaimer.
57
+ #
58
+ # 2. Redistributions in binary form must reproduce the above copyright notice, this list of
59
+ # conditions and the following disclaimer in the documentation and/or other materials
60
+ # provided with the distribution.
61
+ #
62
+ # 3. Neither the names of Facebook, Deepmind Technologies, NYU, NEC Laboratories America and
63
+ # IDIAP Research Institute nor the names of its contributors may be used to endorse or
64
+ # promote products derived from this software without specific prior written permission.
65
+ #
66
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
67
+ # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
68
+ # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
69
+ # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
70
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
71
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
72
+ # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
73
+ # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
74
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42
75
43
76
# Forward and backward pass have been tested to produce the same output
44
77
# as pytorch with align_corners=True - it works modulo bit noise.
@@ -124,7 +157,6 @@ function ∇upsample_bilinear_whcn_kernel!(n_elem, rheight, rwidth, Δ, dx)
124
157
return nothing
125
158
end
126
159
127
-
128
160
function NNlib. upsample_bilinear_whcn! (y:: CuArray{T,4} , x:: CuArray{T,4} ) where T
129
161
w,h,c,n = size (x)
130
162
out_w, out_h = (size (y,1 ), size (y,2 ))
0 commit comments