-
Notifications
You must be signed in to change notification settings - Fork 45
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
Customized selector
functions for user-defined Pytree
classes
#10
Comments
Thanks for the question! I'm not sure I fully understand what you are trying to do? By design, Penzai's selector system uses the actual
That said, I'm curious what problems you're running into right now? Have you run into problems trying to use Penzai with your custom classes already? There's a chance things would "just work" out of the box. |
Thanks for the answer! Right, a bit tough to explain succinctly, but I'll give it a shot: the data structures which I'm letting users pretty print have a specified interface for accessors and setters. This is different than just the These objects can represent things like "these are the samples that a probabilistic program sampled when it was executed" -- they can also represent things like "the constraints that a probabilistic program should execute under". In both cases, how these objects are constructed is important, and I have something very similar to a "data DSL" for creating these objects, and mutating them. Maybe an immediate question (and my attempt at a quick answer): why have a "data DSL" at all -- and not just have a system like the selector system which works on Pytree? Because in the programs written in my system, "the identity of a random variable and its sampled value" is specified using a type of addressing system which is different from where the data actually lives in the fields of the Pytree. That's the main problem -- and the thing I'm trying to resolve (by e.g. providing a custom handler so that -- when a user pretty prints with From your answer, I think I should investigate:
Just to clarify -- |
Closing, as I have several ideas to think about. |
Hi! Awesome package -- had a great sense of "I absolutely must use this" when I was looking at the documentation and the repository.
I have a library I'm developing for probabilistic programming, where I define custom nested
Pytree
classes. The "getter" and "setter" interfaces for these classes are not just like normalPytree
accessing (via fields) -- they are defined to ensure consistency with the rest of the semantics of the system.I'd like to use
penzai
andpenzai.treescope
with these objects -- so I'm wondering if there's some way to overload the selectors to use my own interfaces, and have this reflected in e.g. the lambda functions to access pieces of data from the visuals?Thanks -- and again, awesome package -- I'm totally willing to read your code, and try to figure out a solution to the above, if you're enthusiastic about it.
The text was updated successfully, but these errors were encountered: