Skip to content

Commit

Permalink
remove AcceleratorConnector.tpu_id
Browse files Browse the repository at this point in the history
  • Loading branch information
DuYicong515 committed Mar 21, 2022
1 parent 5232009 commit 00026d5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
7 changes: 0 additions & 7 deletions pytorch_lightning/trainer/connectors/accelerator_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,13 +802,6 @@ def tpu_cores(self) -> Optional[Union[List[int], int]]:
return self._tpu_cores # type: ignore
return 0

@property
def tpu_id(self) -> Optional[int]:
if isinstance(self.accelerator, TPUAccelerator):
if isinstance(self._tpu_cores, list):
return self._tpu_cores[0]
return None

@property
def num_ipus(self) -> int:
if isinstance(self.accelerator, IPUAccelerator):
Expand Down
10 changes: 0 additions & 10 deletions tests/models/test_tpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,6 @@ def test_dataloaders_passed_to_fit(tmpdir):
assert trainer.state.finished, f"Training failed with {trainer.state}"


@pytest.mark.parametrize(
["tpu_cores", "expected_tpu_id"],
[(1, None), (8, None), ([1], 1), ([8], 8)],
)
@RunIf(tpu=True)
def test_tpu_id_to_be_as_expected(tpu_cores, expected_tpu_id):
"""Test if trainer.tpu_id is set as expected."""
assert Trainer(tpu_cores=tpu_cores)._accelerator_connector.tpu_id == expected_tpu_id


def test_tpu_misconfiguration():
"""Test if trainer.tpu_id is set as expected."""
with pytest.raises(MisconfigurationException, match="`tpu_cores` can only be"):
Expand Down

0 comments on commit 00026d5

Please sign in to comment.