code: def baseline_implementation(
      token_ids: torch.Tensor,
      embedding_table: torch.Tensor,
      unpadded_size: int,
      positional_embedding_table: Optional[torch.Tensor] = None,
      positional_ids: Optional[torch.Tensor] = None,
  ) -> torch.Tensor:
      """
      Baseline implementation for our ragged embedding kernel.
      """
      if unpadded_size == token_ids.shape[0]:
          token_embed = torch.nn.functional.embedding(
              token_ids, embedding_table
          )
  
          if positional_embedding_table is not None:
              pos_embed = torch.nn.functional.embedding(
                  positional_ids, positional_embedding_table
              )
              token_embed += pos_embed
          return token_embed
      else:
          real_token_ids = token_ids[:unpadded_size]
          output = torch.empty(
              (token_ids.shape[0], embedding_table.shape[1]),
              dtype=embedding_table.dtype,
              device=get_accelerator().current_device(),
          )
          unpadded_output = torch.nn.functional.embedding(
              real_token_ids, embedding_table
          )
  
          # Positional embeddings aren't padded because it's simulated
          if positional_embedding_table is not None:
              pos_embed = torch.nn.functional.embedding(
                  positional_ids, positional_embedding_table
              )
              unpadded_output += pos_embed
  
          output[:unpadded_size] = unpadded_output
          return output
  
file_path: deepspeed/tests/unit/inference/v2/kernels/ragged_ops/test_ragged_embed.py
imports: from typing import List, Optional, Tuple
  import pytest
  import torch
  from deepspeed.accelerator import get_accelerator
  from deepspeed.inference.v2.kernels.ragged_ops import RaggedEmbeddingKernel
  from ....v2.inference_test_utils import allclose, get_dtypes
  from .ragged_testing_utils import build_batch_and_manager
label_desc: Use image node_id 1 for calling a global function with example usage: baseline_implementation(token_ids, embedding_table, unpadded_size, positional_embedding_table, positional_ids) and returns: token_embed, output