class_docstr: Environment for fault-tolerant and elastic training with `torchelastic <https://pytorch.org/elastic/>`_
class_docstr_tok: ["Environment","for","fault-tolerant","and","elastic","training","with","`","torchelastic","<","https",":","\/\/pytorch.org\/elastic\/",">","`","_"]
code: def validate_settings(self, num_devices: int, num_nodes: int) -> None:
      if num_devices * num_nodes != self.world_size():
          raise ValueError(
              f"You set `devices={num_devices}` and `num_nodes={num_nodes}` in Lightning, but the product"
              f" ({num_devices} * {num_nodes}) does not match the world size ({self.world_size()})."
          )
  
file_path: pytorch-lightning/src/lightning/fabric/plugins/environments/torchelastic.py
imports: import logging
  import os
  import torch.distributed
  from typing_extensions import override
  from lightning.fabric.plugins.environments.cluster_environment import ClusterEnvironment
  from lightning.fabric.utilities.rank_zero import rank_zero_warn
label_desc: Use image node_id 11 for calling the TorchElasticEnvironment obj's underlying member method code with example usage: obj.validate_settings(num_devices, num_nodes) without return types