# Function differences with torchvision.transforms.ToPILImage
## torchvision.transforms.ToPILImage
```python
class torchvision.transforms.ToPILImage(
mode=None
)
```
For more information, see [torchvision.transforms.ToPILImage](https://pytorch.org/vision/0.10/transforms.html#torchvision.transforms.ToPILImage).
## mindspore.dataset.vision.ToPIL
```python
class mindspore.dataset.vision.ToPIL
```
For more information, see [mindspore.dataset.vision.ToPIL](https://mindspore.cn/docs/en/r2.0.0-alpha/api_python/dataset_vision/mindspore.dataset.vision.ToPIL.html#mindspore.dataset.vision.ToPIL).
## Differences
PyTorch: Converts a tensor or numpy array to PIL Image. The input can be a torch Tensor in the format of , or a numpy array in the format of .
MindSpore: The input is a decoded numpy array, which is converted into a PIL type image.
## Code Example
```python
import numpy as np
import torch as T
from torchvision.transforms import ToPILImage
import mindspore.dataset.vision as vision
# In MindSpore, ToPIL transform the numpy.ndarray to PIL Image.
image = np.random.random((64,64))
img = vision.ToPIL()(image)
img.show()
# Out:
# window of PIL image
# In torch, ToPILImage transforms the input to PIL Image.
image = T.randn((64, 64))
img = ToPILImage()(image)
img.show()
# Out:
# window of PIL image
```