Skip to content

An operation trying to do the opposite of F.grid_sample

License

Notifications You must be signed in to change notification settings

ashawkey/grid_put

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grid Put

An operation trying to do the opposite of F.grid_sample().

Install

Assume torch already installed.

pip install git+https://github.com/ashawkey/grid_put

# or locally
git clone https://github.com/ashawkey/grid_put
cd grid_put
pip install .

Usage

from grid_put import grid_put

# only support 2D and 3D grid, we take 2D as an example:
H, W # target grid shape
coords # [N, 2], float grid coords in [-1, 1]
values # [N, C], values to put into grid

# mode: nearest, linear, linear-mipmap (default)
out = grid_put((H, W), coords, values, mode='linear-mipmap') # [H, W, C]

Examples

# extra dependency: pip install kiui
python test.py --mode <random|grid> --ratio <float>
mode-ratio nearest linear linear-mipmap
grid-10%
grid-90%
random-10%
random-90%

About

An operation trying to do the opposite of F.grid_sample

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages