简体   繁体   中英

Trying to use Tensorboard on Google Colab

The page below gives informations about Tensorboard: https://pytorch.org/docs/stable/tensorboard.html I am using Google Colab and when i write the following instructions(which are in the link above):

!pip install tensorboard
tensorboard --logdir=runs

it sends me the following error message:

 File "<ipython-input-111-949c7e8e565e>", line 2
tensorboard --logdir=runs
                         ^
SyntaxError: can't assign to operator

so when i copy paste their own example:

from torch.utils.tensorboard import SummaryWriter
writer = SummaryWriter()
x = range(100)
for i in x:
    writer.add_scalar('y=2x', i * 2, i)
writer.close()

it does not return the expected graph. Could someone help me fix this problem?Thank you in advance!

As explained in How to use Tensorboard with PyTorch in Google Colab<\/a> .

%load_ext tensorboard

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM