Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Support conversion of Transforms and TransformedDistributions to and from Funsors #365
Support conversion of Transforms and TransformedDistributions to and from Funsors #365
Changes from 43 commits
9b6a3bc
6b3371a
fcb70ea
78747a5
a469cd7
be80ef0
2016ba1
7880e40
2a4d548
2f0b0ea
08949cf
8d5a5ad
05cd1a2
a3f8050
fbc91b7
7400b41
77aca44
c14f3ac
67777fa
cd13b30
6765bd7
c89fa88
e10b962
d6efe96
18af534
1c42e8e
22b2115
f78b0ab
e18f5ce
f24a599
974b21b
2d93270
092141c
ddb6d86
bcf52cc
0d46e5d
6e33c93
0966eb0
6c2cc27
b59a0d8
8d9d965
bdde5b4
8aab02d
0df073f
b8f553f
18c87f3
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks weird. Can you explain what's going on? When is
value_name != "value"
? The assertion inself.__init__()
suggestsvalue_name == "value"
IIUC.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value_name
can potentially be anything, sinceself.value
is a lazy expression. This logic is meant to solve the problem of identifying the value name whenself.value
is not aVariable
or even has more than one input (which happens when constructing the Funsor version of aTransformedDistribution
).The simplest nontrivial example of the latter case would be an affine or power transform where the parameters are
funsor.Tensor
s with nontrivial.inputs
, although these are not handled in this PR sincefunsor.delta.solve
does not yet support inverting such expressions.The main use for
value_name
in this PR is inDistribution.unscaled_sample
, which needs to knowvalue_name
to construct a sampleDelta
with the correct.inputs
.