apache / apache/hamilton

parameterize decorator should add values to default_parameter_values

Open
#1,124 18 comments 0 reactions 0 assignees View on GitHub
triage
Dominant language
Jupyter Notebook
Stars
2.6k
Forks
213
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
When a vanilla node is created the default values of its parameters, if any, are available via `node.default_parameter_values` attribute. However, when a node is created by `@parameterize`, the values passed to the decorator are not available via the attribute. In fact they are not available from the node object at all.

The point I am making is that those values are essentially default values for the expanded node and should be surfaced in the same fashion. This feature would make expanded nodes equivalent to vanilla nodes in this regards.

**Describe the solution you'd like**
Define a node
```
x_value = {}
@parameterize(output_node=dict(x=value(x_value))
def fun(x):
return x
```

The following should hold
```
node = driver.graph.nodes['output_node']
# the passed in x_value and the stored value are the same objects
assert 'x' in node.default_parameter_values
assert node.default_parameter_values['x'] is x_value

# the passed in x_value and the object returned by the node are the same objects
result = driver.execute(final_vars=['output_node'])
assert result['output_node'] is x_value
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.