Skip to content

RandZoom change the input type #2920

@bhashemian

Description

@bhashemian

Describe the bug
When using RandZoom with the input type of torch.Tensor it will output np.array!

To Reproduce

import torch
from monai.transforms import RandZoom
a = torch.randn(10, 3, 20, 20)
type(RandZoom(prob=1.0, min_zoom=0.9, max_zoom=1.1)(a))

Expected behavior
expected correct output:

<class 'torch.Tensor'>

but this will output:

<class 'numpy.ndarray'>

Environment

================================
Printing MONAI config...
================================
MONAI version: 0.6.0+117.g97fd2b92
Numpy version: 1.21.1
Pytorch version: 1.10.0a0+ecc3718
MONAI flags: HAS_EXT = False, USE_COMPILED = False
MONAI rev id: 97fd2b9201ea5e21692126539b0bddb99f1f7b23

Optional dependencies:
Pytorch Ignite version: 0.4.5
Nibabel version: 3.2.1
scikit-image version: 0.15.0
Pillow version: 8.2.0
Tensorboard version: 2.5.0
gdown version: 3.13.0
TorchVision version: 0.11.0a0
tqdm version: 4.53.0
lmdb version: 1.2.1
psutil version: 5.8.0
pandas version: 1.1.4
einops version: 0.3.0

For details about installing the optional dependencies, please visit:
    https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies


================================
Printing system config...
================================
System: Linux
Linux version: Ubuntu 20.04.2 LTS
Platform: Linux-5.8.0-59-generic-x86_64-with-glibc2.10
Processor: x86_64
Machine: x86_64
Python version: 3.8.10
Process name: python
Command: ['python', '-c', 'import monai; monai.config.print_debug_info()']
Open files: []
Num physical CPUs: 8
Num logical CPUs: 16
Num usable CPUs: 16
CPU usage (%): [1.4, 0.7, 96.5, 1.4, 3.5, 0.7, 2.1, 3.4, 0.7, 2.0, 0.7, 0.7, 0.0, 0.0, 0.0, 0.0]
CPU freq. (MHz): 1206
Load avg. in last 1, 5, 15 mins (%): [2.8, 3.6, 11.3]
Disk usage (%): 93.5
Avg. sensor temp. (Celsius): UNKNOWN for given OS
Total physical memory (GB): 31.1
Available memory (GB): 25.3
Used memory (GB): 5.3

================================
Printing GPU config...
================================
Num GPUs: 2
Has CUDA: True
CUDA version: 11.4
cuDNN enabled: True
cuDNN version: 8202
Current device: 0
Library compiled for CUDA architectures: ['sm_52', 'sm_60', 'sm_61', 'sm_70', 'sm_75', 'sm_80', 'sm_86', 'compute_86']
GPU 0 Name: NVIDIA TITAN RTX
GPU 0 Is integrated: False
GPU 0 Is multi GPU board: False
GPU 0 Multi processor count: 72
GPU 0 Total memory (GB): 23.7
GPU 0 CUDA capability (maj.min): 7.5
GPU 1 Name: NVIDIA TITAN RTX
GPU 1 Is integrated: False
GPU 1 Is multi GPU board: False
GPU 1 Multi processor count: 72
GPU 1 Total memory (GB): 23.7
GPU 1 CUDA capability (maj.min): 7.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions