I think this is starting to shape up nicely. Although I have to admit that I'm still quite concerned about the added complexity for something that feels like it should be simple (but provably turns out not to be). Usually I would not be too concerned about complexity, especially if it's well documented, commented, and tested like here. However, this is core code and shape
is something that has caused us tremendous amounts of work in the past because we did not get it right the first time, so I think for developer generations to come it is important to get this right this time around.
I actually had a thought that I'd love to get your input on @michaelosthege. Currently a lot of the complexity comes from the fact that we are trying to convert shape
to size
, and that's really hard because of all the edge cases, then throw dims
, Ellipses
, and observed
into the mix and here we are. My idea currently only pertains to shape
and the simplest implementation to get that.
What if instead of doing the shape
->size
conversion, could we just create the RV with the specified shape
and be done with it? I think we might be able to do this by just broadcasting the dist_params
that are inputted to the specified shape
and everything follows from there.
We should be able to do that quite easily with at.broadcast_to()
. There is still an issue with ndims
but I found https://github.com/pymc-devs/aesara/blob/master/aesara/tensor/random/utils.py#L53 that seems to take care of that case.
Not thinking about dims
or Ellipses
for now, I think that should be quite straight forward and get us reasonably close with just a few lines (famous last words ;)).
From there, I think we'd be in a good spot where we can just use the dims
->shape
translation that you already implemented here in a separate PR.
Anyway, I know this thing is testing all of our patience to the maximum but thinking about our future selves and new contributors we owe it to us/them to think through various options here and pick the best path forward.
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing