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

Conversion of torch.Tensor to numpy object #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversion of torch.Tensor to numpy object #62

wants to merge 1 commit into from

Conversation

creativequotient
Copy link

Due to the possibility of x[1] being of type torch.Tensor, the np.mean(...) call fails with an AttributeError: torch.dtype object has no attribute type.

The full error is

[ERROR 03:50:05] pymarl Failed after 0:01:46! Traceback (most recent calls WITHOUT Sacred internals): File "src/main.py", line 35, in my_main run(_run, config, _log) File "/home/minerva/Projects/multiagentrl/pymarl/src/run.py", line 48, in run run_sequential(args=args, logger=logger) File "/home/minerva/Projects/multiagentrl/pymarl/src/run.py", line 209, in run_sequential logger.print_recent_stats() File "/home/minerva/Projects/multiagentrl/pymarl/src/utils/logging.py", line 48, in print_recent_stats item = "{:.4f}".format(np.mean([x[1] for x in self.stats[k][-window:]])) File "<__array_function__ internals>", line 6, in mean File "/home/minerva/anaconda3/envs/mpe/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 3335, in mean out=out, **kwargs) File "/home/minerva/anaconda3/envs/mpe/lib/python3.6/site-packages/numpy/core/_methods.py", line 161, in _mean ret = ret.dtype.type(ret / rcount) AttributeError: 'torch.dtype' object has no attribute 'type' [INFO 03:50:05] absl Shutdown gracefully. [INFO 03:50:05] absl Shutdown with return code: -15

Due to the possibility of `x[1]` being of type `torch.Tensor`, the `np.mean(...)` call fails with an `AttributeError: torch.dtype object has no attribute type`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant