Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Implement "FactorGraph.get_component(str)" method #167

Open
meissnereric opened this issue Apr 18, 2019 · 1 comment
Open

Implement "FactorGraph.get_component(str)" method #167

meissnereric opened this issue Apr 18, 2019 · 1 comment

Comments

@meissnereric
Copy link
Contributor

In a few cases (namely, when building models of repeated layers), I've noticed people doing things like:

z = variables[getattr(self.model, 'inducing_inputs_' + str(layer))]

which seems a bit unsafe. A better way of accessing the components here would be to just have a getter function on the FactorGraph that returns the component of that name.

def get_component(self, name):
    ...
@zhenwendai
Copy link
Contributor

Why it is unsafe? I think it is the python way to call self.model.inducing_inputs_str(layer) dynamically.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants