class_docstr: Convert a deep renewal process sample that is composed of dense interval-
  size samples to a sparse forecast.
  
  In practice, this often only means taking the first few time steps of each
  sample trajectory and converting them to the sparse (intermittent)
  representation. Converts a (N, S, 2, T) array corresponding to the
  interval-size format to a (N, S, T) array.
class_docstr_tok: ["Convert","a","deep","renewal","process","sample","that","is","composed","of","dense","interval-","size","samples","to","a","sparse","forecast",".","In","practice",",","this","often","only","means","taking","the","first","few","time","steps","of","each","sample","trajectory","and","converting","them","to","the","sparse","(","intermittent",")","representation",".","Converts","a","(","N",",","S",",","2",",","T",")","array","corresponding","to","the","interval-size","format","to","a","(","N",",","S",",","T",")","array","."]
code: def __call__(
      self, entry: DataEntry, output: np.ndarray
  ) -> np.ndarray:
      ia_times, sizes = output[:, :, 0], output[:, :, 1]
      batch_size, num_samples, max_time = ia_times.shape
      max_time = ia_times.shape[-1]
      out = np.zeros_like(ia_times)
  
      times = np.cumsum(ia_times, axis=-1) - 1
  
      for i, j in itertools.product(
          range(batch_size), range(num_samples)
      ):
          t, s = times[i, j], sizes[i, j]
          ix = t[t < max_time].astype(int).tolist()
          if len(ix) > 0:
              out[i, j, ix] = s[: len(ix)]
  
      return out
  
imports: import itertools
  from functools import partial
  from pathlib import Path
  from typing import List, Optional, Callable, Iterator, Type
  import mxnet
  import numpy
  from gluonts.core.serde import load_json
  from gluonts.dataset.common import DataEntry, Dataset
  from gluonts.dataset.loader import InferenceDataLoader
  from gluonts.model.forecast import Forecast
  from gluonts.model.forecast_generator import ForecastGenerator, SampleForecastGenerator
  from gluonts.mx.batchify import batchify
  from gluonts.mx.model.predictor import RepresentableBlockPredictor
  from gluonts.transform import Transformation
label_desc: Use image node_id 1 for calling the DeepRenewalProcessSampleOutputTransform obj's underlying member method code with example usage: obj.__call__(entry, output) and returns: out