Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Creating NDVariableArray is slow #132

Closed
antoine-dedieu opened this issue Apr 4, 2022 · 0 comments · Fixed by #136
Closed

Creating NDVariableArray is slow #132

antoine-dedieu opened this issue Apr 4, 2022 · 0 comments · Fixed by #136
Labels
enhancement New feature or request

Comments

@antoine-dedieu
Copy link
Contributor

We are currently adding the variables one at a time via:

names_to_variables = collections.OrderedDict()
for name in itertools.product(*[list(range(k)) for k in self.shape]):
    names_to_variables[name] = nodes.Variable(self.num_states)

Dropping the Variable object to create a numpy array can be 100x faster

@antoine-dedieu antoine-dedieu changed the title Creating NDVariableArray Creating NDVariableArray is slow Apr 4, 2022
@antoine-dedieu antoine-dedieu added the enhancement New feature or request label Apr 4, 2022
@StannisZhou StannisZhou linked a pull request Apr 26, 2022 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant