-
Notifications
You must be signed in to change notification settings - Fork 351
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
Implementing 3D dilation #408
Conversation
This pull request was exported from Phabricator. Differential Revision: D35381703 |
Summary: Pull Request resolved: pytorch#408 Implemented 3D dilation for values that aren't `(1, 1, 1)` as requested by [this issue](pytorch#182). ## The Algorithm Algorithm works by dilating the kernel (see below) and then removing extraneous points after the tensor has been unfolded with the dilated kernel. Removing extraneous points is done by calculating which points were from the original kernel (i.e. not introduced by dilation) and removing all of the others. ## Dilation The dilated kernel size (for one dimension) is `kernel_size + (kernel_size - 1) * (dilation - 1)`. This is best explained through visualization (in 1D). Suppose we have a kernel that is 3 units long and we wish to dilate it by 3. Let `x` represent the units originally in the kernel and `o` represent the units introduced via dilation. ``` xooxoox ``` There are `kernel_size - 1` places to insert units from dilation and we want to insert `dilation - 1` units in each place. This leads to `(kernel_size - 1) * (dilation - 1)` total units from dilation and `kernel_size` original units, making a total `kernel_size + (kernel_size - 1) * (dilation - 1)` units. Differential Revision: D35381703 fbshipit-source-id: accce169b5d79a12015e3d2d56e279217e29dfa8
This pull request was exported from Phabricator. Differential Revision: D35381703 |
ac099e9
to
0bfe008
Compare
Summary: Pull Request resolved: pytorch#408 Implemented 3D dilation for values that aren't `(1, 1, 1)` as requested by [this issue](pytorch#182). ## The Algorithm Algorithm works by dilating the kernel (see below) and then removing extraneous points after the tensor has been unfolded with the dilated kernel. Removing extraneous points is done by calculating which points were from the original kernel (i.e. not introduced by dilation) and removing all of the others. ## Dilation The dilated kernel size (for one dimension) is `kernel_size + (kernel_size - 1) * (dilation - 1)`. This is best explained through visualization (in 1D). Suppose we have a kernel that is 3 units long and we wish to dilate it by 3. Let `x` represent the units originally in the kernel and `o` represent the units introduced via dilation. ``` xooxoox ``` There are `kernel_size - 1` places to insert units from dilation and we want to insert `dilation - 1` units in each place. This leads to `(kernel_size - 1) * (dilation - 1)` total units from dilation and `kernel_size` original units, making a total `kernel_size + (kernel_size - 1) * (dilation - 1)` units. Differential Revision: D35381703 fbshipit-source-id: a40456d98df5a7c6007d2d6c7d840c4173fde7bf
0bfe008
to
a29184c
Compare
This pull request was exported from Phabricator. Differential Revision: D35381703 |
1 similar comment
This pull request was exported from Phabricator. Differential Revision: D35381703 |
Summary: Pull Request resolved: pytorch#408 Implemented 3D dilation for values that aren't `(1, 1, 1)` as requested by [this issue](pytorch#182). ## The Algorithm Algorithm works by dilating the kernel (see below) and then removing extraneous points after the tensor has been unfolded with the dilated kernel. Removing extraneous points is done by calculating which points were from the original kernel (i.e. not introduced by dilation) and removing all of the others. ## Dilation The dilated kernel size (for one dimension) is `kernel_size + (kernel_size - 1) * (dilation - 1)`. This is best explained through visualization (in 1D). Suppose we have a kernel that is 3 units long and we wish to dilate it by 3. Let `x` represent the units originally in the kernel and `o` represent the units introduced via dilation. ``` xooxoox ``` There are `kernel_size - 1` places to insert units from dilation and we want to insert `dilation - 1` units in each place. This leads to `(kernel_size - 1) * (dilation - 1)` total units from dilation and `kernel_size` original units, making a total `kernel_size + (kernel_size - 1) * (dilation - 1)` units. Differential Revision: D35381703 fbshipit-source-id: d917e2e459d2bb00bd7a4b4d9b67abfaea780efb
a29184c
to
2612bd6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fantastic! The PR summary is fabulous as well and made code review very easy; thanks a lot.
Summary: Pull Request resolved: pytorch#408 Implemented 3D dilation for values that aren't `(1, 1, 1)` as requested by [this issue](pytorch#182). ## The Algorithm Algorithm works by dilating the kernel (see below) and then removing extraneous points after the tensor has been unfolded with the dilated kernel. Removing extraneous points is done by calculating which points were from the original kernel (i.e. not introduced by dilation) and removing all of the others. ## Dilation The dilated kernel size (for one dimension) is `kernel_size + (kernel_size - 1) * (dilation - 1)`. This is best explained through visualization (in 1D). Suppose we have a kernel that is 3 units long and we wish to dilate it by 3. Let `x` represent the units originally in the kernel and `o` represent the units introduced via dilation. ``` xooxoox ``` There are `kernel_size - 1` places to insert units from dilation and we want to insert `dilation - 1` units in each place. This leads to `(kernel_size - 1) * (dilation - 1)` total units from dilation and `kernel_size` original units, making a total `kernel_size + (kernel_size - 1) * (dilation - 1)` units. Reviewed By: karthikprasad Differential Revision: D35381703 fbshipit-source-id: b9ebe9d124a1ffc88c2838681dc4f899efbdf973
2612bd6
to
6ee4170
Compare
This pull request was exported from Phabricator. Differential Revision: D35381703 |
Summary: Pull Request resolved: pytorch#408 Implemented 3D dilation for values that aren't `(1, 1, 1)` as requested by [this issue](pytorch#182). ## The Algorithm Algorithm works by dilating the kernel (see below) and then removing extraneous points after the tensor has been unfolded with the dilated kernel. Removing extraneous points is done by calculating which points were from the original kernel (i.e. not introduced by dilation) and removing all of the others. ## Dilation The dilated kernel size (for one dimension) is `kernel_size + (kernel_size - 1) * (dilation - 1)`. This is best explained through visualization (in 1D). Suppose we have a kernel that is 3 units long and we wish to dilate it by 3. Let `x` represent the units originally in the kernel and `o` represent the units introduced via dilation. ``` xooxoox ``` There are `kernel_size - 1` places to insert units from dilation and we want to insert `dilation - 1` units in each place. This leads to `(kernel_size - 1) * (dilation - 1)` total units from dilation and `kernel_size` original units, making a total `kernel_size + (kernel_size - 1) * (dilation - 1)` units. Reviewed By: karthikprasad Differential Revision: D35381703 fbshipit-source-id: 8ad87dae95a91d954600cdd75aaf26f1e7039dde
6ee4170
to
50cabf3
Compare
This pull request was exported from Phabricator. Differential Revision: D35381703 |
Summary: Pull Request resolved: pytorch#408 Implemented 3D dilation for values that aren't `(1, 1, 1)` as requested by [this issue](pytorch#182). ## The Algorithm Algorithm works by dilating the kernel (see below) and then removing extraneous points after the tensor has been unfolded with the dilated kernel. Removing extraneous points is done by calculating which points were from the original kernel (i.e. not introduced by dilation) and removing all of the others. ## Dilation The dilated kernel size (for one dimension) is `kernel_size + (kernel_size - 1) * (dilation - 1)`. This is best explained through visualization (in 1D). Suppose we have a kernel that is 3 units long and we wish to dilate it by 3. Let `x` represent the units originally in the kernel and `o` represent the units introduced via dilation. ``` xooxoox ``` There are `kernel_size - 1` places to insert units from dilation and we want to insert `dilation - 1` units in each place. This leads to `(kernel_size - 1) * (dilation - 1)` total units from dilation and `kernel_size` original units, making a total `kernel_size + (kernel_size - 1) * (dilation - 1)` units. Reviewed By: karthikprasad Differential Revision: D35381703 fbshipit-source-id: 762850a9c0e5fcb0f57cc3ce1e0323a2c0bded40
50cabf3
to
49ad93f
Compare
This pull request was exported from Phabricator. Differential Revision: D35381703 |
Summary: Pull Request resolved: pytorch#408 Implemented 3D dilation for values that aren't `(1, 1, 1)` as requested by [this issue](pytorch#182). ## The Algorithm Algorithm works by dilating the kernel (see below) and then removing extraneous points after the tensor has been unfolded with the dilated kernel. Removing extraneous points is done by calculating which points were from the original kernel (i.e. not introduced by dilation) and removing all of the others. ## Dilation The dilated kernel size (for one dimension) is `kernel_size + (kernel_size - 1) * (dilation - 1)`. This is best explained through visualization (in 1D). Suppose we have a kernel that is 3 units long and we wish to dilate it by 3. Let `x` represent the units originally in the kernel and `o` represent the units introduced via dilation. ``` xooxoox ``` There are `kernel_size - 1` places to insert units from dilation and we want to insert `dilation - 1` units in each place. This leads to `(kernel_size - 1) * (dilation - 1)` total units from dilation and `kernel_size` original units, making a total `kernel_size + (kernel_size - 1) * (dilation - 1)` units. Reviewed By: karthikprasad Differential Revision: D35381703 fbshipit-source-id: 212222a57cfd76abe1a3cf11d60c97a9823e9809
This pull request was exported from Phabricator. Differential Revision: D35381703 |
49ad93f
to
36d2817
Compare
Summary:
Implemented 3D dilation for values that aren't
(1, 1, 1)
as requested by this issue.The Algorithm
Algorithm works by dilating the kernel (see below) and then removing extraneous points after the tensor has been unfolded with the dilated kernel. Removing extraneous points is done by calculating which rows/columns/etc. would have had zeros on them with the dilated kernel and removing them.
Dilation
The dilated kernel size (for one dimension) is
kernel_size + (kernel_size - 1) * (dilation - 1)
. This is best explained through visualization (in 1D). Suppose we have a kernel that is 3 units long and we wish to dilate it by 3. Letx
represent the units originally in the kernel ando
represent the units introduced via dilation.There are
kernel_size - 1
places to insert units from dilation and we want to insertdilation - 1
units in each place. This leads to(kernel_size - 1) * (dilation - 1)
total units from dilation andkernel_size
original units, making a totalkernel_size + (kernel_size - 1) * (dilation - 1)
units.Differential Revision: D35381703