Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
POSTECH-CVLab
GitHub Repository: POSTECH-CVLab/PyTorch-StudioGAN
Path: blob/master/src/utils/style_ops/upfirdn2d.h
809 views
1
// Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2
//
3
// NVIDIA CORPORATION and its licensors retain all intellectual property
4
// and proprietary rights in and to this software, related documentation
5
// and any modifications thereto. Any use, reproduction, disclosure or
6
// distribution of this software and related documentation without an express
7
// license agreement from NVIDIA CORPORATION is strictly prohibited.
8
9
#include <cuda_runtime.h>
10
11
//------------------------------------------------------------------------
12
// CUDA kernel parameters.
13
14
struct upfirdn2d_kernel_params
15
{
16
const void* x;
17
const float* f;
18
void* y;
19
20
int2 up;
21
int2 down;
22
int2 pad0;
23
int flip;
24
float gain;
25
26
int4 inSize; // [width, height, channel, batch]
27
int4 inStride;
28
int2 filterSize; // [width, height]
29
int2 filterStride;
30
int4 outSize; // [width, height, channel, batch]
31
int4 outStride;
32
int sizeMinor;
33
int sizeMajor;
34
35
int loopMinor;
36
int loopMajor;
37
int loopX;
38
int launchMinor;
39
int launchMajor;
40
};
41
42
//------------------------------------------------------------------------
43
// CUDA kernel specialization.
44
45
struct upfirdn2d_kernel_spec
46
{
47
void* kernel;
48
int tileOutW;
49
int tileOutH;
50
int loopMinor;
51
int loopX;
52
};
53
54
//------------------------------------------------------------------------
55
// CUDA kernel selection.
56
57
template <class T> upfirdn2d_kernel_spec choose_upfirdn2d_kernel(const upfirdn2d_kernel_params& p);
58
59
//------------------------------------------------------------------------
60
61