diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f4324e4..2d7633a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,11 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Preserve dict key order in the output of `tree_unflatten`, `tree_map`, and `tree_map_with_path` by [@XuehaiPan](https://github.com/XuehaiPan) in [#46](https://github.com/metaopt/optree/pull/46). +- ### Changed -- Change keyword argument `initializer` back to `initial` for `tree_reduce` to align with `functools.reduce` C implementation by [@XuehaiPan](https://github.com/XuehaiPan) in [#47](https://github.com/metaopt/optree/pull/47). +- ### Fixed @@ -29,6 +29,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ------ +## [0.9.0] - 2023-03-23 + +### Added + +- Preserve dict key order in the output of `tree_unflatten`, `tree_map`, and `tree_map_with_path` by [@XuehaiPan](https://github.com/XuehaiPan) in [#46](https://github.com/metaopt/optree/pull/46). + +### Changed + +- Change keyword argument `initializer` back to `initial` for `tree_reduce` to align with `functools.reduce` C implementation by [@XuehaiPan](https://github.com/XuehaiPan) in [#47](https://github.com/metaopt/optree/pull/47). + +------ + ## [0.8.0] - 2023-03-14 ### Added @@ -185,7 +197,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ------ -[Unreleased]: https://github.com/metaopt/optree/compare/v0.8.0...HEAD +[Unreleased]: https://github.com/metaopt/optree/compare/v0.9.0...HEAD +[0.9.0]: https://github.com/metaopt/optree/compare/v0.8.0...v0.9.0 [0.8.0]: https://github.com/metaopt/optree/compare/v0.7.0...v0.8.0 [0.7.0]: https://github.com/metaopt/optree/compare/v0.6.0...v0.7.0 [0.6.0]: https://github.com/metaopt/optree/compare/v0.5.1...v0.6.0 diff --git a/README.md b/README.md index 9dd2369b..3a3b651b 100644 --- a/README.md +++ b/README.md @@ -496,7 +496,7 @@ False ([3, 1, 2], PyTreeSpec(OrderedDict([('b', [*]), ('a', [*, *])]))) ``` -Since OpTree v0.9.0, the key order of the reconstructed output dictionaries from `tree_unflatten` is guaranteed to be consistent with the key order of the input dictionaries in `tree_flatten`. +**Since OpTree v0.9.0, the key order of the reconstructed output dictionaries from `tree_unflatten` is guaranteed to be consistent with the key order of the input dictionaries in `tree_flatten`.** ```python >>> leaves, treespec = optree.tree_flatten({'b': [3], 'a': [1, 2]}) @@ -525,7 +525,7 @@ This property is also preserved during serialization/deserialization. > Note that there are no restrictions on the `dict` to require the keys are comparable (sortable). > There can be multiple types of keys in the dictionary. -> The keys are sorted in ascending order by `key=lambda k: k` first if capable otherwise fallback to `key=lambda k: (k.__class__.__qualname__, k)`. This handles most cases. +> The keys are sorted in ascending order by `key=lambda k: k` first if capable otherwise fallback to `key=lambda k: (f'{k.__class__.__module__}.{k.__class__.__qualname__}', k)`. This handles most cases. > > ```python > >>> sorted({1: 2, 1.5: 1}.keys()) @@ -534,7 +534,7 @@ This property is also preserved during serialization/deserialization. > Traceback (most recent call last): > ... > TypeError: '<' not supported between instances of 'int' and 'str' -> >>> sorted({'a': 3, 1: 2, 1.5: 1}.keys(), key=lambda k: (k.__class__.__qualname__, k)) +> >>> sorted({'a': 3, 1: 2, 1.5: 1}.keys(), key=lambda k: (f'{k.__class__.__module__}.{k.__class__.__qualname__}', k)) > [1.5, 1, 'a'] > ``` diff --git a/optree/version.py b/optree/version.py index 499c6389..1dd19d2d 100644 --- a/optree/version.py +++ b/optree/version.py @@ -14,7 +14,7 @@ # ============================================================================== """OpTree: Optimized PyTree Utilities.""" -__version__ = '0.8.0' +__version__ = '0.9.0' __license__ = 'Apache License, Version 2.0' __author__ = 'OpTree Contributors' __release__ = False