Skip to content
This repository was archived by the owner on Mar 31, 2025. It is now read-only.
This repository was archived by the owner on Mar 31, 2025. It is now read-only.

objax.variable.VarCollection.update not compliant with key-value assignment #254

@alvarobartt

Description

@alvarobartt

Hi everyone! Thanks for the awesome work with objax and the JAX environment, and happy holidays!

I'm trying to load some VarCollection and/or Dict[str, jnp.DeviceArray] params into the model.vars() which is a VarCollection class, and I can do so by:

for key, value in new_params.items():
    model.vars()[key].assign(value)

But I'd expect objax.variable.VarCollection.update to work the same way e.g.

model.vars().update(new_params)

And the later doesn't work while the first one does, not sure if it's because that's not the intended behavior for VarCollection.update or if I'm doing anything wrong... But just the first one works, which for the moment is fine for what I need, but wanted to mention this just in case there's something not working as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions