Skip to content
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

Evaluating operations outside the with block in Jupyter Notebook grows the graph.operations dict #55

Open
MatusGasparik opened this issue May 9, 2023 · 0 comments

Comments

@MatusGasparik
Copy link

This seem like a bug, and probably related to fact that I am running this in a jupyter notebook. Given this example:

import pythonflow as pf

with pf.Graph() as graph:
    a = pf.constant(4, name='a')
    b = pf.constant(38, name='b')
    x = (a + b).set_name('x')

looking at the graph.operations looks fine initially:

{'a': <pf.func_op 'a' target=<function identity at 0x106500310> args=<1 items> kwargs=<0 items>>,
 'b': <pf.func_op 'b' target=<function identity at 0x106500310> args=<1 items> kwargs=<0 items>>,
 'x': <pf.func_op 'x' target=<built-in function add> args=<2 items> kwargs=<0 items>>}

However, if I evaluate any of the Operation instances in the notebook cell (e.g. a or b at the end of the cell) the dictionary with graph.operations grows with additional items (and continues growing by a dozen new getattr operations every time I evaluate any of the operations)

Here a screenshot that is self-explaining:

image

Is there a way to prevent this behavior?

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

No branches or pull requests

1 participant