Skip to content

Commit e04ae08

Browse files
author
The kauldron Authors
committed
Wrap RandomMapTransform to remove Grain's meta features.
PiperOrigin-RevId: 870905223
1 parent 66af85d commit e04ae08

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

kauldron/data/tf/random_transforms.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ class ElementWiseRandomTransform(
3636
)
3737

3838

39+
@dataclasses.dataclass(frozen=True, kw_only=True)
40+
class RandomMapTransform(grain.RandomMapTransform):
41+
"""Wraps RandomMapTransform with an adapter to remove Grain meta features."""
42+
43+
# Wrap `random_map` to remove the `grain.META_FEATURES`
44+
random_map = transform_utils.wrap_map(grain.RandomMapTransform.random_map)
45+
46+
3947
@dataclasses.dataclass(kw_only=True, frozen=True, eq=True)
4048
class InceptionCrop(ElementWiseRandomTransform):
4149
"""Makes inception-style image crop and optionally resizes afterwards.

0 commit comments

Comments
 (0)