TileOnGrid support for Tensor input#3384
Merged
bhashemian merged 5 commits intoProject-MONAI:devfrom Nov 23, 2021
Merged
Conversation
Signed-off-by: Behrooz <[email protected]>
Signed-off-by: Behrooz <[email protected]>
Signed-off-by: Behrooz <[email protected]>
Signed-off-by: Behrooz <[email protected]>
Nic-Ma
reviewed
Nov 23, 2021
Signed-off-by: Behrooz <[email protected]>
Contributor
|
/build |
Nic-Ma
approved these changes
Nov 23, 2021
wyli
reviewed
Nov 23, 2021
| from monai.utils import convert_data_type, convert_to_dst_type | ||
| from monai.utils.enums import TransformBackends | ||
|
|
||
| __all__ = ["SplitOnGrid", "TileOnGrid"] |
Contributor
There was a problem hiding this comment.
looks like SplitOnGrid(2, 2)(torch.arange(12).reshape(1, 3, 4)) works fine but SplitOnGrid(2, 2)(np.arange(12).reshape(1, 3, 4)) doesn't work, could you help fix it here? #3378 was merged too quickly
Member
Author
There was a problem hiding this comment.
@wyli, sorry I missed this. I will fix it now.
| x_size, y_size = self.tile_size, self.tile_size | ||
| c_len, x_len, y_len = image.shape | ||
| c_stride, x_stride, y_stride = image.strides | ||
| h_step, w_step = self.step, self.step |
Contributor
There was a problem hiding this comment.
I feel the previous variable x_step is better than h_step, x indicates the axis direction, h indicates height which is the length of x direction
Member
Author
There was a problem hiding this comment.
Sure, I can fix this too. sorry that I didn't see your comments before merging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3379
Description
This PR updates
TileOnGridto supporttorch.Tensorthrough type conversion while the backend isnumpy. It also updates the unittests to includetorch.Tenorinputs on cpu and cuda device.Status
Ready
Types of changes
./runtests.sh -f -u --net --coverage../runtests.sh --quick --unittests.