Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid AttributeError: 'torch.dtype' object has no attribute 'type' #89

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Commits on Nov 16, 2020

  1. avoid AttributeError: 'torch.dtype' object has no attribute 'type'

    …error
    
    avoid `AttributeError: 'torch.dtype' object has no attribute 'type'` error
    GoingMyWay committed Nov 16, 2020
    Configuration menu
    Copy the full SHA
    547a8c1 View commit details
    Browse the repository at this point in the history

Commits on May 1, 2021

  1. check the type with isinstance(vshape, numbers.Integral)

    ```Python
    In [7]: import numpy as np                                                                                                                                
    
    In [8]: np.prod((1, 2, 3, 4))                                                                                                                             
    Out[8]: 24
    
    In [9]: type(np.prod((1, 2, 3, 4)))                                                                                                                       
    Out[9]: numpy.int64
    
    In [10]: type(int(np.prod((1, 2, 3, 4))))                                                                                                                 
    Out[10]: int
    
    In [11]: import numbers                                                                                                                                   
    
    In [12]: isinstance(np.prod((1, 2, 3, 4)), numbers.Integral)                                                                                              
    Out[12]: True
    
    In [13]: isinstance(np.prod((1, 2, 3, 4)), int)                                                                                                           
    Out[13]: False
    ```
    GoingMyWay authored May 1, 2021
    Configuration menu
    Copy the full SHA
    f31037c View commit details
    Browse the repository at this point in the history

Commits on Aug 25, 2021

  1. suppress the UserWarning raised by th.tensor(...)

     src/components/episode_buffer.py:103: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
      v = th.tensor(v, dtype=dtype, device=self.device)
    GoingMyWay authored Aug 25, 2021
    Configuration menu
    Copy the full SHA
    67bcf21 View commit details
    Browse the repository at this point in the history