Update Optional[x] -> x | None and Union[x, y] to x | y (#26633)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
|
||||
import inspect
|
||||
from collections.abc import Sequence
|
||||
from typing import Optional
|
||||
|
||||
import numpy as np
|
||||
import pytest
|
||||
@@ -271,7 +270,7 @@ def test_sampling_metadata_in_input_batch(device: str, batch_size: int):
|
||||
reqs, req_ids_retained, input_batch.req_id_to_index, device=torch.device(device)
|
||||
)
|
||||
|
||||
def same(t1: Optional[torch.Tensor], t2: Optional[torch.Tensor]) -> bool:
|
||||
def same(t1: torch.Tensor | None, t2: torch.Tensor | None) -> bool:
|
||||
return (t1 is None and t2 is None) or (
|
||||
t1 is not None and t2 is not None and torch.allclose(t1, t2)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user