Skip to content

Conversation

@torfjelde
Copy link
Member

@torfjelde torfjelde commented Dec 28, 2022

Use Setfield.need_dynamic_lens as the default value for concretize in varname. This way we preserve pre-0.6 behavior, thus not make the 0.6-release "less" breaking.

Ref: TuringLang/DynamicPPL.jl#440

@yebai
Copy link
Member

yebai commented Dec 28, 2022

bors try

bors bot added a commit that referenced this pull request Dec 28, 2022
@torfjelde
Copy link
Member Author

This won't fix the DPPL tests alone. The PR causing these fundamentally changes how we treat Colon, hence we need to change DPPL to accommodate these.

return first_subsumed && subsumes_indices(Base.tail(t1), Base.tail(t2))
end

subsumes_index(i::Colon, ::Colon) = error("Colons cannot be subsumed")
Copy link
Member Author

Choose a reason for hiding this comment

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

This line causes downstream issues @yebai

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the investigation; can you list an example of how/where this is used in DynamicPPL?

Copy link
Member Author

Choose a reason for hiding this comment

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

It affects every model which uses : for indexing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Because we then try to call subsumes on it when checking.

Copy link
Member Author

Choose a reason for hiding this comment

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

I might have a fix

Copy link
Member

Choose a reason for hiding this comment

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

I remember these issues from the latent Dirichlet allocation model and MCMCChains; IMO, we should always replace : with 1:N where N is a constant.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, but this issue goes a bit deeper than that.

The PR causing these issues were trying to address things like OffsetArrays.jl not working properly, etc. So I think we're now also in need of concretization stuff like x[2:3], etc. I'm trying to figure this out.

@yebai
Copy link
Member

yebai commented Dec 29, 2022

bors r+

bors bot pushed a commit that referenced this pull request Dec 29, 2022
Use `Setfield.need_dynamic_lens` as the default value for `concretize` in `varname`. This way we preserve pre-0.6 behavior, thus not make the 0.6-release "less" breaking.

Ref: TuringLang/DynamicPPL.jl#440

Co-authored-by: Hong Ge <[email protected]>
@bors
Copy link

bors bot commented Dec 29, 2022

@bors bors bot changed the title Fix concretization for varname [Merged by Bors] - Fix concretization for varname Dec 29, 2022
@bors bors bot closed this Dec 29, 2022
@bors bors bot deleted the torfjelde/fix-default-for-varname branch December 29, 2022 17:14
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.

3 participants