Skip to content

Fixes error with custom scalars, fixes #20579#20580

Closed
baldassarreFe wants to merge 1 commit intopytorch:masterfrom
baldassarreFe:patch-1
Closed

Fixes error with custom scalars, fixes #20579#20580
baldassarreFe wants to merge 1 commit intopytorch:masterfrom
baldassarreFe:patch-1

Conversation

@baldassarreFe
Copy link
Contributor

When adding custom scalars like this

from torch.utils.tensorboard import SummaryWriter

with SummaryWriter() as writer:
    writer.add_custom_scalars({'Stuff': {
        'Losses': ['MultiLine', ['loss/(one|two)']],
        'Metrics': ['MultiLine', ['metric/(three|four)']],
    }})

This error is raised:

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

Removing the square brackets around SummaryMetadata.PluginData(plugin_name='custom_scalars') should be enough to fix it.

When adding custom scalars like this
```python
from torch.utils.tensorboard import SummaryWriter

with SummaryWriter() as writer:
    writer.add_custom_scalars({'Stuff': {
        'Losses': ['MultiLine', ['loss/(one|two)']],
        'Metrics': ['MultiLine', ['metric/(three|four)']],
    }})
```
This error is raised:
```
TypeError: Parameter to MergeFrom() must be instance of same class: expected tensorboard.SummaryMetadata.PluginData got list.
```

Removing the square brackets around `SummaryMetadata.PluginData(plugin_name='custom_scalars')` should be enough to fix it.
@li-roy li-roy added module: tensorboard triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels May 16, 2019
@ezyang ezyang requested a review from lanpa May 17, 2019 14:40
Copy link
Collaborator

@lanpa lanpa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the correct fix.

@lanpa lanpa changed the title Fixes error with custom scalars, see issue #20579 Fixes error with custom scalars, fixes #20579 May 18, 2019
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orionr is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@orionr merged this pull request in 99b3f5c.

facebook-github-bot pushed a commit that referenced this pull request May 28, 2019
Summary:
As a part of #20580 I noticed that we had some unusual variable naming in `summary.py`. This cleans it up and also removes some variables that weren't being used.

I'll wait until we have an `add_custom_scalars` test to land this.

cc lanpa natalialunova
Pull Request resolved: #20861

Differential Revision: D15503420

Pulled By: orionr

fbshipit-source-id: 86d105a346198a1ca543d1c5d297804402ab5a0c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged module: tensorboard open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants