code: def make_inference_history_mask_3d(block):
      batch, length = block.shape
      arange = torch.arange(length, device=block.device)
      history_mask = (arange[None,] <= arange[:, None])[None,]
      history_mask = history_mask.expand(batch, length, length)
      return history_mask
  
imports: import itertools
  import math
  from typing import Dict, Iterator, List, Tuple, Union
  import torch
  import torch.nn
  from torch import Tensor
label_desc: Use image node_id 19 for calling a global function with example usage: make_inference_history_mask_3d(block) and returns: history_mask