Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PTAL]Gridsample op support #4288

Merged
merged 36 commits into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
00e9943
Add the naive impl but many bugs
LRY89757 Oct 19, 2022
2d96bb5
apply code-format changes
LRY89757 Oct 19, 2022
b28e6f9
Merge branch 'Tencent:master' into gridsample
LRY89757 Oct 19, 2022
19e4511
Pass the correctness check
LRY89757 Oct 19, 2022
9c77f2e
Add the cmath header
LRY89757 Oct 19, 2022
0a10106
grid_sample to gridsample
LRY89757 Oct 20, 2022
793be94
temporarily disable the test of 5d input
LRY89757 Oct 20, 2022
acf0109
fix small bugs
LRY89757 Oct 20, 2022
48387c6
remove omp collapse
LRY89757 Oct 20, 2022
ec7c4e1
Add the support for 5d in torch
LRY89757 Oct 21, 2022
4f5b319
apply code-format changes
LRY89757 Oct 21, 2022
56b5f3e
Merge branch 'Tencent:master' into gridsample
LRY89757 Oct 21, 2022
0a0b2df
Update 5d support add gridsample batch_index
LRY89757 Oct 21, 2022
b5bcd6d
apply code-format changes
LRY89757 Oct 21, 2022
25cba0c
Update the test func
LRY89757 Oct 21, 2022
fc3b74a
apply code-format changes
LRY89757 Oct 21, 2022
e1a0be6
remove cmath header for ci
LRY89757 Oct 22, 2022
917f19e
clang-format
LRY89757 Oct 22, 2022
5b65777
Update the Operators doc
LRY89757 Oct 25, 2022
84f3969
Update the Operators doc
LRY89757 Oct 25, 2022
876633a
Update the pnnx doc
LRY89757 Oct 25, 2022
04342c5
fix bugs of int and remove hacks
LRY89757 Oct 31, 2022
e66f034
Merge remote-tracking branch 'upstream/master' into gridsample
nihui Nov 1, 2022
9022828
NCNN_FORCEINLINE thx to Yoh
LRY89757 Nov 1, 2022
041c759
simplify reflect coord
nihui Nov 1, 2022
2b4bcb6
linear_interp1d,3d, rm nearest redundant
LRY89757 Nov 1, 2022
b7ceb6a
apply code-format changes
LRY89757 Nov 1, 2022
0eb87e4
change to c,d,h,w loop for better reading
LRY89757 Nov 1, 2022
7aaeb6a
apply code-format changes
LRY89757 Nov 1, 2022
6ddff1c
drw2zxy, rm _, resize2sample
LRY89757 Nov 2, 2022
025a0b2
apply code-format changes
LRY89757 Nov 2, 2022
db12e8b
nearest fixed
LRY89757 Nov 3, 2022
bd29ece
nearest fixed
LRY89757 Nov 3, 2022
c96ed53
Merge branch 'master' into gridsample
nihui Nov 3, 2022
b13e514
Merge remote-tracking branch 'upstream/master' into gridsample
nihui Nov 11, 2022
3990c33
update gridsample
nihui Nov 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions docs/developer-guide/operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* [GELU](#gelu)
* [GLU](#glu)
* [Gemm](#gemm)
* [GridSample](#gridsample)
* [GroupNorm](#groupnorm)
* [GRU](#gru)
* [HardSigmoid](#hardsigmoid)
Expand Down Expand Up @@ -816,6 +817,34 @@ y = gemm(a, b) * alpha + c * beta
| 2 | transA | int | 0 | |
| 3 | transb | int | 0 | |

# GridSample
```
Given an input and a flow-field grid, computes the output using input values and pixel locations from grid.

For each output location output[:, h2, w2], the size-2 vector grid[h2, w2, 2] specifies input pixel[:, h1, w1] locations x and y,
which are used to interpolate the output value output[:, h2, w2]

This function is often used in conjunction with affine_grid() to build Spatial Transformer Networks .
```

| param id | name | type | default | description |
| --------- | ------------- | ----- | --------- | ----------------- |
| 0 | resize_type | int | 1 | |
| 1 | padding_mode | int | 1 | |
| 2 | align_corner | int | 0 | |


Resize type:
- 1 = Nearest
- 2 = Bilinear
- 3 = Bicubic

Padding mode:
- 1 = zeros
- 2 = border
- 3 = reflection


# GroupNorm
```
split x along channel axis into group x0, x1 ...
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ ncnn_add_layer(DeconvolutionDepthWise3D)
ncnn_add_layer(Einsum)
ncnn_add_layer(DeformableConv2D)
ncnn_add_layer(GLU)
ncnn_add_layer(GridSample)

if(NCNN_VULKAN)
ncnn_add_shader(${CMAKE_CURRENT_SOURCE_DIR}/convert_ycbcr.comp)
Expand Down
Loading