code: def apply_rnnt_prune_ranges(
      encoder_outputs: torch.Tensor,
      decoder_outputs: torch.Tensor,
      ranges: torch.Tensor,
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      """Prepares pruned encoder and decoder outputs according to the prune ranges.
      Based on k2.do_rnnt_pruning(...)
      """
      B, T, window_size_with_blank = ranges.size()
      D1 = encoder_outputs.size(-1)
      _, U, D2 = decoder_outputs.size()
      assert B == encoder_outputs.size(0)
      assert T == encoder_outputs.size(1)
      assert B == decoder_outputs.size(0)
      encoder_outputs_pruned = encoder_outputs.unsqueeze(2).expand(
          (B, T, window_size_with_blank, D1)
      )
      decoder_outputs_pruned = torch.gather(
          decoder_outputs.unsqueeze(1).expand((B, T, U, D2)),
          dim=2,
          index=ranges.reshape(
              (B, T, window_size_with_blank, 1)
          ).expand((B, T, window_size_with_blank, D2)),
      )
      return encoder_outputs_pruned, decoder_outputs_pruned
  
imports: import os
  import struct
  from pickle import UnpicklingError
  from typing import List, Optional, Tuple, Union
  import torch
  from nemo.core.utils.k2_guard import k2
  from nemo.utils import logging
label_desc: Use image node_id 17 for calling a global function with example usage: apply_rnnt_prune_ranges(encoder_outputs, decoder_outputs, ranges) and returns: encoder_outputs_pruned,  decoder_outputs_pruned