code: def set_sparse_value(adj: Tensor, value: Tensor) -> Tensor:
      if value.dim() > 1:
          size = adj.size() + value.size()[1:]
      else:
          size = adj.size()
  
      if adj.layout == torch.sparse_coo:
          return torch.sparse_coo_tensor(
              indices=adj.indices(),
              values=value,
              size=size,
              device=value.device,
          ).coalesce()
  
      if adj.layout == torch.sparse_csr:
          return torch.sparse_csr_tensor(
              crow_indices=adj.crow_indices(),
              col_indices=adj.col_indices(),
              values=value,
              size=size,
              device=value.device,
          )
  
      if (
          torch_geometric.typing.WITH_PT112
          and adj.layout == torch.sparse_csc
      ):
          return torch.sparse_csc_tensor(
              ccol_indices=adj.ccol_indices(),
              row_indices=adj.row_indices(),
              values=value,
              size=size,
              device=value.device,
          )
  
      raise ValueError(
          f"Unexpected sparse tensor layout (got '{adj.layout}')"
      )
  
imports: import typing
  import warnings
  from typing import Any, List, Optional, Tuple, Union
  import torch
  from torch import Tensor
  import torch_geometric.typing
  from torch_geometric.typing import SparseTensor
  from torch_geometric.utils import coalesce, cumsum
label_desc: Use image node_id 10 for calling a global function with example usage: set_sparse_value(adj, value) and returns: torch, torch, torch