Reputation: 61
I tried to use tensorboard in torch.utils, but it says "module 'torch.utils' has no attribute 'tensorboard'". My torch version is "1.6.0+cu101"
PS C:\Users\kelekelekle> python
Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 01:54:44) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> print(torch.__version__)
1.6.0+cu101
>>> writer = torch.utils.tensorboard.SummaryWriter()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'torch.utils' has no attribute 'tensorboard'
>>>
Upvotes: 6
Views: 5257
Reputation: 24681
You have to install tensorboard
via:
pip install tensorboard
(or a-like). Given that is done, you should import tensorboard
module from torch.utils
package:
from torch.utils import tensorboard
tensorboard.SummaryWriter("foo")
Or you can import SummaryWriter
directly:
from torch.utils.tensorboard import SummaryWriter
SummaryWriter("bar")
Upvotes: 4