Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
66bbcbc
Rewrite NDVariableArray
antoine-dedieu Apr 12, 2022
d816f63
Falke8
antoine-dedieu Apr 12, 2022
58b0115
Test + HashableDict
antoine-dedieu Apr 12, 2022
c8f2c5e
Minbor
antoine-dedieu Apr 13, 2022
39b546a
Variables as tuple + Remove BPOuputs/HashableDict
antoine-dedieu Apr 20, 2022
ef92d1b
Start tests + mypy
antoine-dedieu Apr 21, 2022
7e55e5c
Tests passing
antoine-dedieu Apr 21, 2022
9a2dcd2
Variables
antoine-dedieu Apr 21, 2022
c6ae8d8
Tests + mypy
antoine-dedieu Apr 21, 2022
5c8b381
Some docstrings
antoine-dedieu Apr 22, 2022
40ec519
Stannis first comments
antoine-dedieu Apr 22, 2022
96c7fe3
Remove add_factor
antoine-dedieu Apr 22, 2022
88f8e23
Test
antoine-dedieu Apr 23, 2022
033d176
Docstring
antoine-dedieu Apr 23, 2022
89767c8
Coverage
antoine-dedieu Apr 25, 2022
1ccfcf5
Coverage
antoine-dedieu Apr 25, 2022
ecaab6c
Coverage 100%
antoine-dedieu Apr 25, 2022
cbd136b
Remove factor group names
antoine-dedieu Apr 25, 2022
22b604e
Remove factor group names
antoine-dedieu Apr 25, 2022
87fcfd9
Modify hash + add_factors
antoine-dedieu Apr 26, 2022
0f639fe
Stannis' comments
antoine-dedieu Apr 26, 2022
546b790
Flattent / unflattent
antoine-dedieu Apr 26, 2022
35ce6c0
Unflatten with nan
antoine-dedieu Apr 26, 2022
704ee3a
Speeding up
antoine-dedieu Apr 27, 2022
aaa67ef
max size
antoine-dedieu Apr 27, 2022
04c4d89
Understand timings
antoine-dedieu Apr 27, 2022
a276ce5
Some comments
antoine-dedieu Apr 27, 2022
a839be6
Comments
antoine-dedieu Apr 27, 2022
05de350
Minor
antoine-dedieu Apr 27, 2022
1e0c93d
Docstring
antoine-dedieu Apr 27, 2022
63c6738
Minor changes
antoine-dedieu Apr 28, 2022
0397f9b
Doc
antoine-dedieu Apr 28, 2022
8b3d60e
Rename this_hash
StannisZhou Apr 30, 2022
8751e90
Final comments
antoine-dedieu May 2, 2022
b265f14
Minor
antoine-dedieu May 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Variables
  • Loading branch information
antoine-dedieu committed Apr 21, 2022
commit 9a2dcd215f322029a6ed5173bb5c893b03d99bfd
9 changes: 4 additions & 5 deletions pgmax/groups/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ def variables(self) -> List[Tuple]:
)

def __getitem__(self, val):
# Numpy indexation will throw IndexError for us if out-of-bounds
if val not in self.variable_names:
raise ValueError(f"Variable {val} is not in VariableDict")
return (val, self.num_states)

def flatten(
Expand All @@ -170,7 +171,7 @@ def flatten(
(2) data is not of the correct shape
"""
for name in data:
if name not in self.variable_names:
if name not in self.variables:
raise ValueError(
f"data is referring to a non-existent variable {name}."
)
Expand All @@ -181,9 +182,7 @@ def flatten(
f"{(self.num_states,)} or (1,). Got {data[name].shape}."
)

flat_data = jnp.concatenate(
[data[name].flatten() for name in self.variable_names]
)
flat_data = jnp.concatenate([data[name].flatten() for name in self.variables])
return flat_data

def unflatten(
Expand Down