jonbarron / robust_loss_pytorch

A pytorch port of google-research/google-research/robust_loss/
Apache License 2.0
656 stars 88 forks source link

Support for PyTorch 1.3? #11

Closed SunnerLi closed 4 years ago

SunnerLi commented 4 years ago

Hi, recently, I try to adopt the Adaptive loss in my project. However, I encounter this problem:

return loss_fn.AdaptiveImageLossFunction(image_size=image_size, float_dtype=np.float32, device=device, color_space='RGB')
  File "/home/sunner/Save/Project/Music-to-music-Transfer-2019-/SVC/loss/robust_loss_pytorch/adaptive.py", line 429, in __init__
    x_example_mat = self.transform_to_mat(x_example)
  File "/home/sunner/Save/Project/Music-to-music-Transfer-2019-/SVC/loss/robust_loss_pytorch/adaptive.py", line 311, in transform_to_mat
    x = torch.as_tensor(x)
AttributeError: module 'torch' has no attribute 'as_tensor'

It seems that pytorch doesn't have the as_tensor function. Is there any advice to fix the issue? As the requirement, this project only request for the pytorch version >= 1.1.0 My version is 1.3.0

jonbarron commented 4 years ago

I just updated my pytorch and it looks like torch.as_tensor() still exists and works as intended. Can you send me minimal code for reproducing this?

SunnerLi commented 4 years ago

I think it's my fault. Now my virtual environment is crash. Maybe I try to re-allocate my environment again. Thank for your testing :-)