Skip to content

Commit 0bd50d8

Browse files
ConchylicultorThe dataclass_array Authors
authored andcommitted
Better fake array support
PiperOrigin-RevId: 595326519
1 parent a5dbd21 commit 0bd50d8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ To release a new version (e.g. from `1.0.0` -> `2.0.0`):
2323

2424
## [Unreleased]
2525

26-
* Fix `etree.spec_like` support
26+
* Fix `etree.spec_like`, `jax.ShapeDtypeStruct`,... support
2727

2828
## [1.5.1] - 2023-08-30
2929

dataclass_array/array_dataclass.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,15 +1103,15 @@ def is_value_missing(self) -> bool:
11031103
# In `jax/_src/api_util.py` for `flatten_axes`, jax set all values to a
11041104
# dummy sentinel `object()` value.
11051105
return True
1106-
elif isinstance(self.value, enp.ArraySpec):
1107-
# `etree.spec_like` compatibility
1108-
return True
11091106
elif (
11101107
isinstance(self.value, DataclassArray) and not self.value._array_fields # pylint: disable=protected-access
11111108
):
11121109
# Nested dataclass case (if all attributes are `object`, so no active
11131110
# array fields)
11141111
return True
1112+
elif enp.array_spec.is_fake_array(self.value):
1113+
# `etree.spec_like`, Flax summary, ShapeDtypeStruct, ... compatibility
1114+
return True
11151115
return False
11161116

11171117
@property

0 commit comments

Comments
 (0)