class_docstr: Create a PyTorch dataset of a tabularized time-series
class_docstr_tok: ["Create","a","PyTorch","dataset","of","a","tabularized","time-series"]
docstr: Create Timedataset with data.
  Parameters
  ----------
      inputs : ordered dict
          Identical to returns from :meth:`tabularize_univariate_datetime`
      targets : np.array, float
          Identical to returns from :meth:`tabularize_univariate_datetime`
docstr_tok: ["Create","Timedataset","with","data",".","Parameters","--","--","--","--","--","inputs",":","ordered","dict","Identical","to","returns","from",":","meth",":","`","tabularize_univariate_datetime","`","targets",":","np.array",",","float","Identical","to","returns","from",":","meth",":","`","tabularize_univariate_datetime","`"]
code: def init_after_tabularized(self, inputs, targets=None):
      """Create Timedataset with data.
      Parameters
      ----------
          inputs : ordered dict
              Identical to returns from :meth:`tabularize_univariate_datetime`
          targets : np.array, float
              Identical to returns from :meth:`tabularize_univariate_datetime`
      """
      inputs_dtype = {
          "time": torch.float,
          "timestamps": np.datetime64,
          "seasonalities": torch.float,
          "events": torch.float,
          "lags": torch.float,
          "covariates": torch.float,
          "regressors": torch.float,
      }
      targets_dtype = torch.float
      self.length = inputs["time"].shape[0]
  
      for key, data in inputs.items():
          if key in self.two_level_inputs:
              self.inputs[key] = OrderedDict({})
              for name, features in data.items():
                  if features.dtype != np.float32:
                      features = features.astype(np.float32, copy=False)
  
                  tensor = torch.from_numpy(features)
  
                  if tensor.dtype != inputs_dtype[key]:
                      self.inputs[key][name] = tensor.to(
                          dtype=inputs_dtype[key]
                      )  # this can probably be removed, but was included in the previous code
                  else:
                      self.inputs[key][name] = tensor
          else:
              if key == "timestamps":
                  self.inputs[key] = data
              else:
                  self.inputs[key] = torch.from_numpy(data).type(
                      inputs_dtype[key]
                  )
      self.targets = (
          torch.from_numpy(targets).type(targets_dtype).unsqueeze(dim=2)
      )
      self.meta["df_name"] = self.name
      self.samples = self._split_nested_dict(self.inputs)
  
imports: import logging
  from collections import OrderedDict, defaultdict
  from datetime import datetime
  from typing import Optional
  import numpy
  import pandas
  import torch
  from torch.utils.data.dataset import Dataset
  from neuralprophet import configure, utils
  from neuralprophet.df_utils import get_max_num_lags
  from neuralprophet.hdays_utils import get_country_holidays
label_desc: Use image node_id 4 for calling the TimeDataset obj's underlying member method code with example usage: obj.init_after_tabularized(inputs, targets) without return types