Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/graph option #162

Merged
merged 2 commits into from
Jan 6, 2021
Merged

Fix/graph option #162

merged 2 commits into from
Jan 6, 2021

Conversation

ktaaaki
Copy link
Collaborator

@ktaaaki ktaaaki commented Dec 22, 2020

Issue

The following assertion fails and the sample shape is torch.Size([1]).

dist = Normal(var=['x'], cond_var=['y'],
      loc='y', scale=1) * Normal(var=['y'], loc=0, scale=1)
dist.graph.set_option(
      dict(batch_n=4, sample_shape=(2, 3)), ['y'])
sample = dist.sample()
assert sample['y'].shape == torch.Size([2, 3, 4])

This is because local options are overwritten by global options and ignored.

Solution

  • Changed the overwrite order of the option dictionary so that local options have priority
  • Changed operator for global_option from .update to =(set) so that global_option can be rewritten by set_option method.

@ktaaaki ktaaaki mentioned this pull request Dec 22, 2020
@masa-su masa-su merged commit dbbfb35 into develop/v0.3.2 Jan 6, 2021
@ktaaaki ktaaaki deleted the fix/graph_option branch February 9, 2021 09:13
@ktaaaki ktaaaki mentioned this pull request Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants