docstr: Merge the just-computed predictions with empty vectors for empty input items.
  Making sure everything is well-aligned"
docstr_tok: ["Merge","the","just-computed","predictions","with","empty","vectors","for","empty","input","items",".","Making","sure","everything","is","well-aligned","''"]
code: def _rebuild_predictions_with_mask(
      self, mask: List[bool], predictions: Dict[str, "np.ndarray"]
  ) -> List[Dict[str, Any]]:
      """Merge the just-computed predictions with empty vectors for empty input items.
      Making sure everything is well-aligned"
      """
      i = 0
      results = []
      for mask_value in mask:
          if mask_value:
              results.append(self._generate_empty_prediction())
          else:
              results.append(
                  {
                      name: predictions[name][i]
                      for name in self.output_tensor_mapping
                  }
              )
              i += 1
      return results
  
imports: import abc
  import json
  import os
  from typing import Any, Dict, List, Optional, Tuple, Type
  import aiohttp
  import requests
  from structlog import get_logger
  from tenacity import Retrying, retry_if_exception, stop_after_attempt, wait_random_exponential
  from modelkit.core.model import AsyncModel, Model
  from modelkit.core.types import ItemType, ReturnType
  from modelkit.utils.serialization import safe_np_dump
label_desc: Use image node_id 4 for calling the TensorflowModelMixin obj's underlying member method code with example usage: obj._rebuild_predictions_with_mask(mask, predictions) and returns: results