code: def bernoulli(
      probs: Union[float, torch.Tensor],
      *,
      logits: Union[float, torch.Tensor] = None,
      shape: Optional[Union[ivy.NativeArray, Sequence[int]]] = None,
      device: torch.device = None,
      dtype: torch.dtype,
      seed: Optional[int] = None,
      out: Optional[torch.Tensor] = None,
  ) -> torch.Tensor:
      if seed:
          torch.manual_seed(seed)
      if logits is not None:
          if not _check_shapes_broadcastable(shape, logits.shape):
              shape = logits.shape
      elif probs is not None:
          if not _check_shapes_broadcastable(shape, probs.shape):
              shape = probs.shape
      return (
          torch.distributions.bernoulli.Bernoulli(
              probs=probs, logits=logits
          )
          .sample(shape)
          .to(device, dtype)
      )
  
file_path: ivy/ivy/functional/backends/torch/experimental/random.py
imports: from typing import Optional, Union, Sequence
  import torch
  import ivy
  from ivy.func_wrapper import with_unsupported_dtypes
  from ..None import backend_version
  from ivy.functional.ivy.random import _check_bounds_and_get_shape, _check_shapes_broadcastable
label_desc: Use image node_id 6 for calling a global function with example usage: bernoulli(probs) and returns: torch