Skip to content

Commit

Permalink
No need for union since vz.Trial is already a subclass
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 595732945
  • Loading branch information
xingyousong authored and copybara-github committed Jan 4, 2024
1 parent 7484605 commit 2d338a5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions vizier/pyvizier/converters/jnp_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

"""Converters that use JAX."""

from typing import Sequence, Tuple, Union
from typing import Sequence, Tuple

import attr
import attrs
Expand Down Expand Up @@ -204,9 +204,7 @@ def create_output_converter(metric):
padding_schedule=padding_schedule,
)

def to_features(
self, trials: Sequence[Union[vz.Trial, vz.TrialSuggestion]]
) -> vt.ModelInput:
def to_features(self, trials: Sequence[vz.TrialSuggestion]) -> vt.ModelInput:
"""Returns the features array with dimension: (n_trials, n_features)."""
# Pad up the features.
features = self._impl.to_features(trials)
Expand Down Expand Up @@ -265,7 +263,7 @@ class TrialToContinuousAndCategoricalConverter:
_impl: core.DefaultTrialConverter

def to_features(
self, trials: Sequence[vz.Trial]
self, trials: Sequence[vz.TrialSuggestion]
) -> vt.ContinuousAndCategoricalArray:
"""Returns a structure of arrays with first dimension `n_trials`."""
features = self._impl.to_features(trials)
Expand Down

0 comments on commit 2d338a5

Please sign in to comment.