Skip to content

maintain data/static definition in split / state#5227

Open
copybara-service[bot] wants to merge 1 commit intomainfrom
test_866680531
Open

maintain data/static definition in split / state#5227
copybara-service[bot] wants to merge 1 commit intomainfrom
test_866680531

Conversation

@copybara-service
Copy link

maintain data/static definition in split / state

nnx.graph APIs now follow the data / static definitions for nnx.Pytree instances. Previously nnx.graph.flatten match the default definitions for Pytree most of the time but deviated on edcases, now they always match. Example

    class Foo(nnx.Pytree):
      def __init__(self, data, static):
        self.data = nnx.data(data)
        self.static = nnx.static(static)

    tree = Foo(1, 2)
    state = nnx.state(tree)

    # previously this was false
    assert 'data' in state

`nnx.graph` APIs now follow the data / static definitions for `nnx.Pytree` instances. Previously `nnx.graph.flatten` match the default definitions for Pytree most of the time but deviated on edcases, now they always match. Example

```python
    class Foo(nnx.Pytree):
      def __init__(self, data, static):
        self.data = nnx.data(data)
        self.static = nnx.static(static)

    tree = Foo(1, 2)
    state = nnx.state(tree)

    # previously this was false
    assert 'data' in state
```

PiperOrigin-RevId: 866680531
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

Successfully merging this pull request may close these issues.

0 participants