code: def _where(mask: Tensor, input: Tensor, fill_value: Tensor) -> Tensor:
      """torch.where with sparse inputs support.
  
      _where implements the following invariant:
  
        _where(mask, input, fill_value).to_dense(fill_value) ==
          torch.where(mask.to_dense(), input.to_dense(), torch.full(input.shape, fill_value))
  
      where `a == b` means `assertEqual(a, b)`, mask is boolean sparse
      tensor, and `to_dense(fill_value)` is like `to_dense()` except
      that the unspecified elements are mapped to `fill_value` rather
      than to `0`.
  
      Returns a sparse tensor with the following features:
  
      - all specified elements correspond to masked-in elements that
        have the values of the input tensor. If there exists a masked-in
        element (as specified by mask) that is not specified in the
        input, in the result tensor, the corresponding element has value
        0. In the dense part of the sparse tensor, the masked-out
        elements are replaced with fill_value.
  
      - all unspecified elements correspond to masked-out elements.
      """
      if mask.layout == torch.strided:
          return torch.where(mask, input, fill_value)
      elif mask.layout == torch.sparse_coo:
          return _sparse_coo_where(mask, input, fill_value)
      elif mask.layout == torch.sparse_csr:
          return _sparse_csr_where(mask, input, fill_value)
      else:
          raise ValueError(
              f"_where expects strided or sparse COO or sparse CSR tensor but got {mask.layout}"
          )
  
imports: import warnings
  from typing import Any, List, Optional, Tuple, TYPE_CHECKING, Union
  import torch
  from torch import Tensor
  from torch.masked import as_masked_tensor, is_masked_tensor, MaskedTensor
  from .None import _docs
  from torch._prims_common import corresponding_real_dtype
  from torch import sym_float
label_desc: Use image node_id 11 for calling a global function with example usage: _where(mask, input, fill_value) and returns: torch, _sparse_coo_where, _sparse_csr_where