class_docstr: A wrapper of :class:`~optuna.trial.Trial` to incorporate Optuna with PyTorch distributed.
  
  .. seealso::
      :class:`~optuna.integration.TorchDistributedTrial` provides the same interface as
      :class:`~optuna.trial.Trial`. Please refer to :class:`optuna.trial.Trial` for further
      details.
  
  See `the example <https://github.com/optuna/optuna-examples/blob/main/
  pytorch/pytorch_distributed_simple.py>`__
  if you want to optimize an objective function that trains neural network
  written with PyTorch distributed data parallel.
  
  Args:
      trial:
          A :class:`~optuna.trial.Trial` object or :obj:`None`. Please set trial object in
          rank-0 node and set :obj:`None` in the other rank node.
      group:
          A `torch.distributed.ProcessGroup` to communicate with the other nodes.
          TorchDistributedTrial use CPU tensors to communicate, make sure the group
          supports CPU tensors communications.
  
          Use `gloo` backend when group is None.
          Create a global `gloo` backend when group is None and WORLD is nccl.
  
  .. note::
      The methods of :class:`~optuna.integration.TorchDistributedTrial` are expected to be
      called by all workers at once. They invoke synchronous data transmission to share
      processing results and synchronize timing.
class_docstr_tok: ["A","wrapper","of",":","class",":","`","~optuna.trial.Trial","`","to","incorporate","Optuna","with","PyTorch","distributed",".","..","seealso",":",":",":","class",":","`","~optuna.integration.TorchDistributedTrial","`","provides","the","same","interface","as",":","class",":","`","~optuna.trial.Trial","`",".","Please","refer","to",":","class",":","`","optuna.trial.Trial","`","for","further","details",".","See","`","the","example","<","https",":","\/\/github.com\/optuna\/optuna-examples\/blob\/main\/","pytorch\/pytorch_distributed_simple.py",">","`","__","if","you","want","to","optimize","an","objective","function","that","trains","neural","network","written","with","PyTorch","distributed","data","parallel",".","Args",":","trial",":","A",":","class",":","`","~optuna.trial.Trial","`","object","or",":","obj",":","`","None","`",".","Please","set","trial","object","in","rank-0","node","and","set",":","obj",":","`","None","`","in","the","other","rank","node",".","group",":","A","`","torch.distributed.ProcessGroup","`","to","communicate","with","the","other","nodes",".","TorchDistributedTrial","use","CPU","tensors","to","communicate",",","make","sure","the","group","supports","CPU","tensors","communications",".","Use","`","gloo","`","backend","when","group","is","None",".","Create","a","global","`","gloo","`","backend","when","group","is","None","and","WORLD","is","nccl",".","..","note",":",":","The","methods","of",":","class",":","`","~optuna.integration.TorchDistributedTrial","`","are","expected","to","be","called","by","all","workers","at","once",".","They","invoke","synchronous","data","transmission","to","share","processing","results","and","synchronize","timing","."]
code: def number(self) -> int:
      return self._number
  
imports: from datetime import datetime
  import functools
  import pickle
  from typing import Any
  from typing import Callable
  from typing import Dict
  from typing import Optional
  from typing import overload
  from typing import Sequence
  from typing import TYPE_CHECKING
  from typing import TypeVar
  import optuna
  from optuna._deprecated import deprecated_func
  from optuna._experimental import experimental_class
  from optuna._imports import try_import
  from optuna.distributions import BaseDistribution
  from optuna.distributions import CategoricalChoiceType
label_desc: Use image node_id 18 for calling the TorchDistributedTrial obj's underlying member method code with example usage: obj.number() and returns: self