class_docstr: Base class for distributed computation models and defines interface methods.
  This class is public and should be used for other custom derived distributed models.
class_docstr_tok: ["Base","class","for","distributed","computation","models","and","defines","interface","methods",".","This","class","is","public","and","should","be","used","for","other","custom","derived","distributed","models","."]
code: def _get_max_length(self, x: str, device: torch.device) -> int:
      size = torch.tensor([len(x)], device=device)
      size = self._do_all_reduce(size, op="MAX")
      return cast(int, size.item())
  
imports: from abc import ABCMeta, abstractmethod
  from numbers import Number
  from typing import Any, Callable, cast, List, Optional, Union
  import torch
  from packaging.version import Version
label_desc: Use image node_id 17 for calling the ComputationModel obj's underlying member method code with example usage: obj._get_max_length(x, device) and returns: cast