[tensorboard SummaryWriter] add_custom_scalars

sakaia: <p>When I am executing add_custom_scalars then got error on Google Colab.</p>
<p>Script is follows, all script is taken from torch.utils.tensorboard document.</p>
<pre><code class="lang-auto">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']]}}

writer.add_custom_scalars(layout)
writer.close()
</code></pre>
<p>Error message  are follows</p>
<pre><code class="lang-auto">---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
&lt;ipython-input-19-6915b6548058&gt; in &lt;module&gt;()
     24                   'nasdaq':['Margin',   ['nasdaq/aaa', 'nasdaq/bbb', 'nasdaq/ccc']]}}
     25 
---&gt; 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')]
--&gt; 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.
</code></pre>
<p>Ref.<br>
<a href="https://pytorch.org/docs/stable/tensorboard.html" rel="nofollow noopener">https://pytorch.org/docs/stable/tensorboard.html</a></p>
<p>P.S.<br>
I think it is better to add new category (TensorBoard)<br>
Currently it is in Uncategrized</p>
<p>Setup TensorBoard Instruction is follows</p>
<pre><code class="lang-auto">!pip install tb-nightly
LOG_DIR = './runs'
get_ipython().system_raw(
    'tensorboard --logdir {} --host 0.0.0.0 --port 6006 &amp;'
    .format(LOG_DIR)
)
!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 &amp;')
!curl -s http://localhost:4040/api/tunnels | python3 -c \
    "import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])"
</code></pre>

hdkgr: <p>I had the same problem and found that this has been fixed recently <a href="https://github.com/pytorch/pytorch/commit/99b3f5cd705018c96b5559daa89aa71e66fc7e8a" rel="nofollow noopener">https://github.com/pytorch/pytorch/commit/99b3f5cd705018c96b5559daa89aa71e66fc7e8a</a></p>
<p>Unfortunately using <code>pytorch-nightly</code> instead of <code>1.1.0</code> broke my code somewhere else.<br>
Is there a list of breaking changes landing in <code>1.2</code> somewhere?</p>