Skip to content

Commit 5cce0af

Browse files
wylimonai-bot
andauthored
3697 add spatial resample (Project-MONAI#3701)
* temp spatial_resample Signed-off-by: Wenqi Li <[email protected]> * fixes resampling Signed-off-by: Wenqi Li <[email protected]> * fixes precisions Signed-off-by: Wenqi Li <[email protected]> * update dict version Signed-off-by: Wenqi Li <[email protected]> * fixes unit tests Signed-off-by: Wenqi Li <[email protected]> * adds docs Signed-off-by: Wenqi Li <[email protected]> * copy grid for resampling Signed-off-by: Wenqi Li <[email protected]> * fixes unit tests Signed-off-by: Wenqi Li <[email protected]> * remove normalize coordinates Signed-off-by: Wenqi Li <[email protected]> * [MONAI] python code formatting Signed-off-by: monai-bot <[email protected]> * try to fix Project-MONAI#3621 (Project-MONAI#3673) Signed-off-by: Wenqi Li <[email protected]> * fixes typing Signed-off-by: Wenqi Li <[email protected]> * fixes grid_sample, interpolate URLs Signed-off-by: Wenqi Li <[email protected]> * simplify norm_coords Signed-off-by: Wenqi Li <[email protected]> * update docstring Signed-off-by: Wenqi Li <[email protected]> * update moveaxis Signed-off-by: Wenqi Li <[email protected]> * spatial sample tests Signed-off-by: Wenqi Li <[email protected]> * additional tests spatial resample Signed-off-by: Wenqi Li <[email protected]> * test invert saptial resample Signed-off-by: Wenqi Li <[email protected]> * fixes unit tests Signed-off-by: Wenqi Li <[email protected]> * rtol assert close Signed-off-by: Wenqi Li <[email protected]> * fixes TF32 tests Signed-off-by: Wenqi Li <[email protected]> * smaller tests Signed-off-by: Wenqi Li <[email protected]> * skip when quick testing Signed-off-by: Wenqi Li <[email protected]> * comp tensor and ndarray Signed-off-by: Wenqi Li <[email protected]> * update based on comments Signed-off-by: Wenqi Li <[email protected]> * fixes tests Signed-off-by: Wenqi Li <[email protected]> * try to use torch.solve Signed-off-by: Wenqi Li <[email protected]> * Revert "fixes tests" This reverts commit e532490. Signed-off-by: Wenqi Li <[email protected]> * update based on comments Signed-off-by: Wenqi Li <[email protected]> * fixes test_affined Signed-off-by: Wenqi Li <[email protected]> * default to float32 rotate/randrotate Signed-off-by: Wenqi Li <[email protected]> * workaround for Project-MONAI#3752 Signed-off-by: Wenqi Li <[email protected]> * default to float32 rotate/randrotate Signed-off-by: Wenqi Li <[email protected]> * temp test Signed-off-by: Wenqi Li <[email protected]> * update docstring Signed-off-by: Wenqi Li <[email protected]> Co-authored-by: monai-bot <[email protected]>
1 parent 6c75550 commit 5cce0af

38 files changed

+959
-323
lines changed

.github/workflows/integration.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: integration
33
on:
44
repository_dispatch:
55
type: [integration-test-command]
6+
push:
7+
branches:
8+
- add-spatial-resample
69

710
jobs:
811
integration-py3:
@@ -32,7 +35,7 @@ jobs:
3235
- name: Install the dependencies
3336
run: |
3437
which python
35-
python -m pip install --upgrade pip wheel
38+
python -m pip install --upgrade pip==21.3.1 wheel # workaround monai##3752
3639
python -m pip uninstall -y torch torchvision
3740
python -m pip install torch==1.10.1+cu111 torchvision==0.11.2+cu111 -f https://download.pytorch.org/whl/torch_stable.html
3841
python -m pip install -r requirements-dev.txt

docs/source/transforms.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,12 @@ Post-processing
557557
Spatial
558558
^^^^^^^
559559

560+
`SpatialResample`
561+
"""""""""""""""""
562+
.. autoclass:: SpatialResample
563+
:members:
564+
:special-members: __call__
565+
560566
`Spacing`
561567
"""""""""
562568
.. image:: https://github.com/Project-MONAI/DocImages/raw/main/transforms/Spacing.png
@@ -1398,6 +1404,12 @@ Post-processing (Dict)
13981404
Spatial (Dict)
13991405
^^^^^^^^^^^^^^
14001406

1407+
`SpatialResampled`
1408+
""""""""""""""""""
1409+
.. autoclass:: SpatialResampled
1410+
:members:
1411+
:special-members: __call__
1412+
14011413
`Spacingd`
14021414
""""""""""
14031415
.. image:: https://github.com/Project-MONAI/DocImages/raw/main/transforms/Spacingd.png

monai/apps/deepgrow/transforms.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ class SpatialCropForegroundd(MapTransform):
374374
the meta data is a dictionary object which contains: filename, original_shape, etc.
375375
it can be a sequence of string, map to the `keys`.
376376
if None, will try to construct meta_keys by `key_{meta_key_postfix}`.
377-
meta_key_postfix: if meta_keys is None, use `{key}_{meta_key_postfix}` to to fetch/store the meta data according
377+
meta_key_postfix: if meta_keys is None, use `{key}_{meta_key_postfix}` to fetch/store the meta data according
378378
to the key data, default is `meta_dict`, the meta data is a dictionary object.
379379
For example, to handle key `image`, read/write affine matrices from the
380380
metadata `image_meta_dict` dictionary's `affine` field.
@@ -474,7 +474,7 @@ class AddGuidanceFromPointsd(Transform):
474474
for example, for data with key `image`, the metadata by default is in `image_meta_dict`.
475475
the meta data is a dictionary object which contains: filename, original_shape, etc.
476476
if None, will try to construct meta_keys by `{ref_image}_{meta_key_postfix}`.
477-
meta_key_postfix: if meta_key is None, use `{ref_image}_{meta_key_postfix}` to to fetch the meta data according
477+
meta_key_postfix: if meta_key is None, use `{ref_image}_{meta_key_postfix}` to fetch the meta data according
478478
to the key data, default is `meta_dict`, the meta data is a dictionary object.
479479
For example, to handle key `image`, read/write affine matrices from the
480480
metadata `image_meta_dict` dictionary's `affine` field.
@@ -589,7 +589,7 @@ class SpatialCropGuidanced(MapTransform):
589589
the meta data is a dictionary object which contains: filename, original_shape, etc.
590590
it can be a sequence of string, map to the `keys`.
591591
if None, will try to construct meta_keys by `key_{meta_key_postfix}`.
592-
meta_key_postfix: if meta_keys is None, use `key_{postfix}` to to fetch the meta data according
592+
meta_key_postfix: if meta_keys is None, use `key_{postfix}` to fetch the meta data according
593593
to the key data, default is `meta_dict`, the meta data is a dictionary object.
594594
For example, to handle key `image`, read/write affine matrices from the
595595
metadata `image_meta_dict` dictionary's `affine` field.
@@ -787,7 +787,7 @@ class RestoreLabeld(MapTransform):
787787
the meta data is a dictionary object which contains: filename, original_shape, etc.
788788
it can be a sequence of string, map to the `keys`.
789789
if None, will try to construct meta_keys by `key_{meta_key_postfix}`.
790-
meta_key_postfix: if meta_key is None, use `key_{meta_key_postfix} to to fetch the meta data according
790+
meta_key_postfix: if meta_key is None, use `key_{meta_key_postfix} to fetch the meta data according
791791
to the key data, default is `meta_dict`, the meta data is a dictionary object.
792792
For example, to handle key `image`, read/write affine matrices from the
793793
metadata `image_meta_dict` dictionary's `affine` field.
@@ -897,7 +897,7 @@ class Fetch2DSliced(MapTransform):
897897
the meta data is a dictionary object which contains: filename, original_shape, etc.
898898
it can be a sequence of string, map to the `keys`.
899899
if None, will try to construct meta_keys by `key_{meta_key_postfix}`.
900-
meta_key_postfix: use `key_{meta_key_postfix}` to to fetch the meta data according to the key data,
900+
meta_key_postfix: use `key_{meta_key_postfix}` to fetch the meta data according to the key data,
901901
default is `meta_dict`, the meta data is a dictionary object.
902902
For example, to handle key `image`, read/write affine matrices from the
903903
metadata `image_meta_dict` dictionary's `affine` field.

monai/csrc/ext.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
3131
py::enum_<monai::BoundType>(m, "BoundType")
3232
.value("replicate", monai::BoundType::Replicate, "a a a | a b c d | d d d")
3333
.value("nearest", monai::BoundType::Replicate, "a a a | a b c d | d d d")
34+
.value("border", monai::BoundType::Replicate, "a a a | a b c d | d d d")
3435
.value("dct1", monai::BoundType::DCT1, "d c b | a b c d | c b a")
3536
.value("mirror", monai::BoundType::DCT1, "d c b | a b c d | c b a")
3637
.value("dct2", monai::BoundType::DCT2, "c b a | a b c d | d c b")
@@ -43,6 +44,7 @@ PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
4344
.value("wrap", monai::BoundType::DFT, "b c d | a b c d | a b c")
4445
// .value("sliding", monai::BoundType::Sliding)
4546
.value("zero", monai::BoundType::Zero, "0 0 0 | a b c d | 0 0 0")
47+
.value("zeros", monai::BoundType::Zero, "0 0 0 | a b c d | 0 0 0")
4648
.export_values();
4749

4850
// resample interpolation mode

monai/csrc/resample/pushpull_cpu.cpp

Lines changed: 23 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,10 +1527,10 @@ MONAI_NAMESPACE_DEVICE { // cpu
15271527
iy0 = bound::index(bound1, iy0, src_Y);
15281528
iz0 = bound::index(bound2, iz0, src_Z);
15291529

1530-
// Offsets into source volume
15311530
offset_t o000, o100, o010, o001, o110, o011, o101, o111;
15321531

15331532
if (do_pull || do_grad || do_sgrad) {
1533+
// Offsets into source volume
15341534
o000 = ix0 * src_sX + iy0 * src_sY + iz0 * src_sZ;
15351535
o100 = ix1 * src_sX + iy0 * src_sY + iz0 * src_sZ;
15361536
o010 = ix0 * src_sX + iy1 * src_sY + iz0 * src_sZ;
@@ -1539,18 +1539,20 @@ MONAI_NAMESPACE_DEVICE { // cpu
15391539
o011 = ix0 * src_sX + iy1 * src_sY + iz1 * src_sZ;
15401540
o101 = ix1 * src_sX + iy0 * src_sY + iz1 * src_sZ;
15411541
o111 = ix1 * src_sX + iy1 * src_sY + iz1 * src_sZ;
1542+
} else {
1543+
// Offsets into 'push' volume
1544+
o000 = ix0 * out_sX + iy0 * out_sY + iz0 * out_sZ;
1545+
o100 = ix1 * out_sX + iy0 * out_sY + iz0 * out_sZ;
1546+
o010 = ix0 * out_sX + iy1 * out_sY + iz0 * out_sZ;
1547+
o001 = ix0 * out_sX + iy0 * out_sY + iz1 * out_sZ;
1548+
o110 = ix1 * out_sX + iy1 * out_sY + iz0 * out_sZ;
1549+
o011 = ix0 * out_sX + iy1 * out_sY + iz1 * out_sZ;
1550+
o101 = ix1 * out_sX + iy0 * out_sY + iz1 * out_sZ;
1551+
o111 = ix1 * out_sX + iy1 * out_sY + iz1 * out_sZ;
15421552
}
15431553

15441554
// ~~~~~~~~~~~~~~~~~~~~~~~~~~ Grid gradient ~~~~~~~~~~~~~~~~~~~~~~~~~~
15451555
if (do_grad) {
1546-
o000 = ix0 * src_sX + iy0 * src_sY + iz0 * src_sZ;
1547-
o100 = ix1 * src_sX + iy0 * src_sY + iz0 * src_sZ;
1548-
o010 = ix0 * src_sX + iy1 * src_sY + iz0 * src_sZ;
1549-
o001 = ix0 * src_sX + iy0 * src_sY + iz1 * src_sZ;
1550-
o110 = ix1 * src_sX + iy1 * src_sY + iz0 * src_sZ;
1551-
o011 = ix0 * src_sX + iy1 * src_sY + iz1 * src_sZ;
1552-
o101 = ix1 * src_sX + iy0 * src_sY + iz1 * src_sZ;
1553-
o111 = ix1 * src_sX + iy1 * src_sY + iz1 * src_sZ;
15541556
scalar_t gx = static_cast<scalar_t>(0);
15551557
scalar_t gy = static_cast<scalar_t>(0);
15561558
scalar_t gz = static_cast<scalar_t>(0);
@@ -1659,14 +1661,6 @@ MONAI_NAMESPACE_DEVICE { // cpu
16591661
}
16601662
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Pull ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16611663
if (do_pull) {
1662-
o000 = ix0 * src_sX + iy0 * src_sY + iz0 * src_sZ;
1663-
o100 = ix1 * src_sX + iy0 * src_sY + iz0 * src_sZ;
1664-
o010 = ix0 * src_sX + iy1 * src_sY + iz0 * src_sZ;
1665-
o001 = ix0 * src_sX + iy0 * src_sY + iz1 * src_sZ;
1666-
o110 = ix1 * src_sX + iy1 * src_sY + iz0 * src_sZ;
1667-
o011 = ix0 * src_sX + iy1 * src_sY + iz1 * src_sZ;
1668-
o101 = ix1 * src_sX + iy0 * src_sY + iz1 * src_sZ;
1669-
o111 = ix1 * src_sX + iy1 * src_sY + iz1 * src_sZ;
16701664
scalar_t* out_ptr_NCXYZ = out_ptr + n * out_sN + w * out_sX + h * out_sY + d * out_sZ;
16711665
scalar_t* src_ptr_NC = src_ptr + n * src_sN;
16721666
for (offset_t c = 0; c < C; ++c, out_ptr_NCXYZ += out_sC, src_ptr_NC += src_sC) {
@@ -1678,14 +1672,6 @@ MONAI_NAMESPACE_DEVICE { // cpu
16781672
}
16791673
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SGrad ~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
16801674
else if (do_sgrad) {
1681-
o000 = ix0 * src_sX + iy0 * src_sY + iz0 * src_sZ;
1682-
o100 = ix1 * src_sX + iy0 * src_sY + iz0 * src_sZ;
1683-
o010 = ix0 * src_sX + iy1 * src_sY + iz0 * src_sZ;
1684-
o001 = ix0 * src_sX + iy0 * src_sY + iz1 * src_sZ;
1685-
o110 = ix1 * src_sX + iy1 * src_sY + iz0 * src_sZ;
1686-
o011 = ix0 * src_sX + iy1 * src_sY + iz1 * src_sZ;
1687-
o101 = ix1 * src_sX + iy0 * src_sY + iz1 * src_sZ;
1688-
o111 = ix1 * src_sX + iy1 * src_sY + iz1 * src_sZ;
16891675
scalar_t* out_ptr_NCXYZ = out_ptr + n * out_sN + w * out_sX + h * out_sY + d * out_sZ;
16901676
scalar_t* src_ptr_NC = src_ptr + n * src_sN;
16911677

@@ -1758,16 +1744,6 @@ MONAI_NAMESPACE_DEVICE { // cpu
17581744
}
17591745
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Push ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17601746
else if (do_count) {
1761-
// Offsets into 'push' volume
1762-
o000 = ix0 * out_sX + iy0 * out_sY + iz0 * out_sZ;
1763-
o100 = ix1 * out_sX + iy0 * out_sY + iz0 * out_sZ;
1764-
o010 = ix0 * out_sX + iy1 * out_sY + iz0 * out_sZ;
1765-
o001 = ix0 * out_sX + iy0 * out_sY + iz1 * out_sZ;
1766-
o110 = ix1 * out_sX + iy1 * out_sY + iz0 * out_sZ;
1767-
o011 = ix0 * out_sX + iy1 * out_sY + iz1 * out_sZ;
1768-
o101 = ix1 * out_sX + iy0 * out_sY + iz1 * out_sZ;
1769-
o111 = ix1 * out_sX + iy1 * out_sY + iz1 * out_sZ;
1770-
17711747
scalar_t* out_ptr_N = out_ptr + n * out_sN;
17721748
bound::add(out_ptr_N, o000, w000, s000);
17731749
bound::add(out_ptr_N, o100, w100, s100);
@@ -1822,21 +1798,23 @@ MONAI_NAMESPACE_DEVICE { // cpu
18221798
ix0 = bound::index(bound0, ix0, src_X);
18231799
iy0 = bound::index(bound1, iy0, src_Y);
18241800

1825-
// Offsets into source volume
18261801
offset_t o00, o10, o01, o11;
18271802
if (do_pull || do_grad || do_sgrad) {
1803+
// Offsets into source volume
18281804
o00 = ix0 * src_sX + iy0 * src_sY;
18291805
o10 = ix1 * src_sX + iy0 * src_sY;
18301806
o01 = ix0 * src_sX + iy1 * src_sY;
18311807
o11 = ix1 * src_sX + iy1 * src_sY;
1808+
} else {
1809+
// Offsets into 'push' volume
1810+
o00 = ix0 * out_sX + iy0 * out_sY;
1811+
o10 = ix1 * out_sX + iy0 * out_sY;
1812+
o01 = ix0 * out_sX + iy1 * out_sY;
1813+
o11 = ix1 * out_sX + iy1 * out_sY;
18321814
}
18331815

18341816
// ~~~~~~~~~~~~~~~~~~~~~~~~~~ Grid gradient ~~~~~~~~~~~~~~~~~~~~~~~~~~
18351817
if (do_grad) {
1836-
o00 = ix0 * src_sX + iy0 * src_sY;
1837-
o10 = ix1 * src_sX + iy0 * src_sY;
1838-
o01 = ix0 * src_sX + iy1 * src_sY;
1839-
o11 = ix1 * src_sX + iy1 * src_sY;
18401818
scalar_t gx = static_cast<scalar_t>(0);
18411819
scalar_t gy = static_cast<scalar_t>(0);
18421820
scalar_t* trgt_ptr_NCXY = trgt_ptr + n * trgt_sN + w * trgt_sX + h * trgt_sY;
@@ -1895,10 +1873,6 @@ MONAI_NAMESPACE_DEVICE { // cpu
18951873
}
18961874
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Pull ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18971875
if (do_pull) {
1898-
o00 = ix0 * src_sX + iy0 * src_sY;
1899-
o10 = ix1 * src_sX + iy0 * src_sY;
1900-
o01 = ix0 * src_sX + iy1 * src_sY;
1901-
o11 = ix1 * src_sX + iy1 * src_sY;
19021876
scalar_t* out_ptr_NCXY = out_ptr + n * out_sN + w * out_sX + h * out_sY;
19031877
scalar_t* src_ptr_NC = src_ptr + n * src_sN;
19041878
for (offset_t c = 0; c < C; ++c, out_ptr_NCXY += out_sC, src_ptr_NC += src_sC) {
@@ -1908,10 +1882,6 @@ MONAI_NAMESPACE_DEVICE { // cpu
19081882
}
19091883
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SGrad ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19101884
else if (do_sgrad) {
1911-
o00 = ix0 * src_sX + iy0 * src_sY;
1912-
o10 = ix1 * src_sX + iy0 * src_sY;
1913-
o01 = ix0 * src_sX + iy1 * src_sY;
1914-
o11 = ix1 * src_sX + iy1 * src_sY;
19151885
scalar_t* out_ptr_NCXY = out_ptr + n * out_sN + w * out_sX + h * out_sY;
19161886
scalar_t* src_ptr_NC = src_ptr + n * src_sN;
19171887

@@ -1926,11 +1896,6 @@ MONAI_NAMESPACE_DEVICE { // cpu
19261896
}
19271897
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Push ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19281898
else if (do_push) {
1929-
// Offsets into 'push' volume
1930-
o00 = ix0 * out_sX + iy0 * out_sY;
1931-
o10 = ix1 * out_sX + iy0 * out_sY;
1932-
o01 = ix0 * out_sX + iy1 * out_sY;
1933-
o11 = ix1 * out_sX + iy1 * out_sY;
19341899
scalar_t* trgt_ptr_NCXY = trgt_ptr + n * trgt_sN + w * trgt_sX + h * trgt_sY;
19351900
scalar_t* out_ptr_NC = out_ptr + n * out_sN;
19361901
if (trgt_K == 0) {
@@ -1960,12 +1925,6 @@ MONAI_NAMESPACE_DEVICE { // cpu
19601925
}
19611926
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Push ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19621927
else if (do_count) {
1963-
// Offsets into 'push' volume
1964-
o00 = ix0 * out_sX + iy0 * out_sY;
1965-
o10 = ix1 * out_sX + iy0 * out_sY;
1966-
o01 = ix0 * out_sX + iy1 * out_sY;
1967-
o11 = ix1 * out_sX + iy1 * out_sY;
1968-
19691928
scalar_t* out_ptr_N = out_ptr + n * out_sN;
19701929
bound::add(out_ptr_N, o00, w00, s00);
19711930
bound::add(out_ptr_N, o10, w10, s10);
@@ -1996,20 +1955,21 @@ MONAI_NAMESPACE_DEVICE { // cpu
19961955
ix1 = bound::index(bound0, ix0 + 1, src_X);
19971956
ix0 = bound::index(bound0, ix0, src_X);
19981957

1999-
// Offsets into source volume
20001958
offset_t o0, o1;
20011959
if (do_pull || do_grad || do_sgrad) {
1960+
// Offsets into source volume
20021961
o0 = ix0 * src_sX;
20031962
o1 = ix1 * src_sX;
1963+
} else {
1964+
// Offsets into 'push' volume
1965+
o0 = ix0 * out_sX;
1966+
o1 = ix1 * out_sX;
20041967
}
20051968

20061969
// ~~~~~~~~~~~~~~~~~~~~~~~~~~ Grid gradient ~~~~~~~~~~~~~~~~~~~~~~~~~~
20071970
if (do_grad) {
20081971
if (trgt_K == 0) {
20091972
// backward w.r.t. push/pull
2010-
2011-
o0 = ix0 * src_sX;
2012-
o1 = ix1 * src_sX;
20131973
scalar_t gx = static_cast<scalar_t>(0);
20141974
scalar_t* trgt_ptr_NCX = trgt_ptr + n * trgt_sN + w * trgt_sX;
20151975
scalar_t* src_ptr_NC = src_ptr + n * src_sN;
@@ -2037,8 +1997,6 @@ MONAI_NAMESPACE_DEVICE { // cpu
20371997
}
20381998
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Pull ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20391999
if (do_pull) {
2040-
o0 = ix0 * src_sX;
2041-
o1 = ix1 * src_sX;
20422000
scalar_t* out_ptr_NCX = out_ptr + n * out_sN + w * out_sX;
20432001
scalar_t* src_ptr_NC = src_ptr + n * src_sN;
20442002
for (offset_t c = 0; c < C; ++c, out_ptr_NCX += out_sC, src_ptr_NC += src_sC) {
@@ -2047,8 +2005,6 @@ MONAI_NAMESPACE_DEVICE { // cpu
20472005
}
20482006
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SGrad ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20492007
else if (do_sgrad) {
2050-
o0 = ix0 * src_sX;
2051-
o1 = ix1 * src_sX;
20522008
scalar_t* out_ptr_NCX = out_ptr + n * out_sN + w * out_sX;
20532009
scalar_t* src_ptr_NC = src_ptr + n * src_sN;
20542010

@@ -2058,9 +2014,6 @@ MONAI_NAMESPACE_DEVICE { // cpu
20582014
}
20592015
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Push ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20602016
else if (do_push) {
2061-
// Offsets into 'push' volume
2062-
o0 = ix0 * out_sX;
2063-
o1 = ix1 * out_sX;
20642017
scalar_t* trgt_ptr_NCX = trgt_ptr + n * trgt_sN + w * trgt_sX;
20652018
scalar_t* out_ptr_NC = out_ptr + n * out_sN;
20662019
if (trgt_K == 0) {
@@ -2081,10 +2034,6 @@ MONAI_NAMESPACE_DEVICE { // cpu
20812034
}
20822035
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Push ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20832036
else if (do_count) {
2084-
// Offsets into 'push' volume
2085-
o0 = ix0 * out_sX;
2086-
o1 = ix1 * out_sX;
2087-
20882037
scalar_t* out_ptr_N = out_ptr + n * out_sN;
20892038
bound::add(out_ptr_N, o0, w0, s0);
20902039
bound::add(out_ptr_N, o1, w1, s1);

0 commit comments

Comments
 (0)