Hi, I’m currently attempting to re-implement a Tensorflow project using PyTorch. For reference, I’m currently utilizing the following virtual environment setup for the project:
- OS: Pop_OS 18.04 (Ubuntu 18.04 derivative)
- Python version: 3.6.9
- PyTorch version: 1.7.1+cu10
- CUDA version : 11.1
Unfortunately, I’ve encountered a problem in re-implementing one of the code lines, which called for use of tf.tile
(link to Tensorflow’s documentation on tf.tile) in the original Tensorflow project.
I’ve noted that in one page of PyTorch’s official documentation, that a similar torch.tile
functionality seem to be available, hence I decided to try and utilize this. However, whenever I call this method, I always encounter the following error instead:
>>> import torch
>>> test_tensor = torch.tensor([1,2,3,4])
>>> test_tensor.tile((2,))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Tensor' object has no attribute 'tile'
>>>
Please do note that the same error still occurs even if I call the tile
as a function applied on the created Tensor object, as seen below:
>>> import torch
>>> test_tensor = torch.tensor([1,2,3,4])
>>> torch.tile(test_tensor, (2,2))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'torch' has no attribute 'tile'
Looking at similar posts of unable to call some specific PyTorch methods, I thought that perhaps there was a problem with the PyTorch implementation with my machine specifically which caused this issue. Hence, I then tried to call the same function in a different machine which this time has the following Virtual Environment config:
- OS: Pop_OS 20.04 (Ubuntu 20.04 derivative)
- Python version: 3.8.5
- PyTorch version: 1.6.0
- CUDA version:
Unfortunately, I was still met with the exact same error as the original machine, which made me think that tile
has been deprecated as per title. May I confirm with anyone whether this is true, and if yes: why the PyTorch’s documentation has not yet been updated with this deprecation?
In the meantime I understand that the tile
function could be effectively replaced in functionality by the similar Tensor.repeat
method, so I’ll be using that for now. However, I’d just like to have a confirmation/clarification on the errors/behaviors that I’ve encountered on torch.tile
.
Thank you for any replies or confirmation in advance!