[tensorboard SummaryWriter] add_custom_scalars

When I am executing add_custom_scalars then got error on Google Colab.

Script is follows, all script is taken from torch.utils.tensorboard document.

import torch
import torchvision
from torch.utils.tensorboard import SummaryWriter
from torchvision import datasets, transforms

# Writer will output to ./runs/ directory by default
writer = SummaryWriter()

transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize((0.5,), (0.5,))])
trainset = datasets.MNIST('mnist_train', train=True, download=True, transform=transform)
trainloader = torch.utils.data.DataLoader(trainset, batch_size=64, shuffle=True)
model = torchvision.models.resnet50(False)
# Have ResNet model take in grayscale rather than RGB
model.conv1 = torch.nn.Conv2d(1, 64, kernel_size=7, stride=2, padding=3, bias=False)
images, labels = next(iter(trainloader))

grid = torchvision.utils.make_grid(images)
writer.add_image('images', grid, 0)
writer.add_graph(model, images)
writer.add_text('lstm', 'This is an lstm', 0)
writer.add_text('rnn', 'This is an rnn', 10)
layout = {'Taiwan':{'twse':['Multiline',['twse/0050', 'twse/2330']]},
             'USA':{ 'dow':['Margin',   ['dow/aaa', 'dow/bbb', 'dow/ccc']],
                  'nasdaq':['Margin',   ['nasdaq/aaa', 'nasdaq/bbb', 'nasdaq/ccc']]}}


Error message are follows

TypeError                                 Traceback (most recent call last)
<ipython-input-19-6915b6548058> in <module>()
     24                   'nasdaq':['Margin',   ['nasdaq/aaa', 'nasdaq/bbb', 'nasdaq/ccc']]}}
---> 26 writer.add_custom_scalars(layout)
     27 writer.close()

1 frames
/usr/local/lib/python3.6/dist-packages/torch/utils/tensorboard/summary.py in custom_scalars(layout)
    381     layout = layout_pb2.Layout(category=categories)
    382     PluginData = [SummaryMetadata.PluginData(plugin_name='custom_scalars')]
--> 383     smd = SummaryMetadata(plugin_data=PluginData)
    384     tensor = TensorProto(dtype='DT_STRING',
    385                          string_val=[layout.SerializeToString()],

TypeError: Parameter to MergeFrom() must be instance of same class: expected tensorboard.SummaryMetadata.PluginData got list.


I think it is better to add new category (TensorBoard)
Currently it is in Uncategrized

Setup TensorBoard Instruction is follows

!pip install tb-nightly
LOG_DIR = './runs'
    'tensorboard --logdir {} --host --port 6006 &'
!wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
!unzip ngrok-stable-linux-amd64.zip
get_ipython().system_raw('./ngrok http 6006 &')
!curl -s http://localhost:4040/api/tunnels | python3 -c \
    "import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])"

I had the same problem and found that this has been fixed recently https://github.com/pytorch/pytorch/commit/99b3f5cd705018c96b5559daa89aa71e66fc7e8a

Unfortunately using pytorch-nightly instead of 1.1.0 broke my code somewhere else.
Is there a list of breaking changes landing in 1.2 somewhere?