code: def create_data(loader=False):
      num_train_samples = 1000
      num_val_samples = 400
      num_test_samples = 400
      input_time_steps = 24
      input_feature_dim = 1
      output_time_steps = 5
      output_feature_dim = 1
  
      def get_x_y(num_samples):
          x = np.random.rand(
              num_samples, input_time_steps, input_feature_dim
          ).astype(np.float32)
          y = x[:, -output_time_steps:, :] * 2 + np.random.rand(
              num_samples, output_time_steps, output_feature_dim
          ).astype(np.float32)
          return x, y
  
      train_data = get_x_y(num_train_samples)
      val_data = get_x_y(num_val_samples)
      test_data = get_x_y(num_test_samples)
  
      if loader:
          from torch.utils.data import DataLoader, TensorDataset
  
          train_loader = DataLoader(
              TensorDataset(
                  torch.from_numpy(train_data[0]),
                  torch.from_numpy(train_data[1]),
              ),
              batch_size=32,
          )
          val_loader = DataLoader(
              TensorDataset(
                  torch.from_numpy(val_data[0]),
                  torch.from_numpy(val_data[1]),
              ),
              batch_size=32,
          )
          test_loader = DataLoader(
              TensorDataset(
                  torch.from_numpy(test_data[0]),
                  torch.from_numpy(test_data[1]),
              ),
              batch_size=32,
          )
          return train_loader, val_loader, test_loader
      else:
          return train_data, val_data, test_data
  
imports: import numpy
  import tempfile
  import os
  from bigdl.chronos.utils import LazyImport
  from unittest import TestCase
  import pytest
  from ..None import op_torch, op_distributed, op_inference, op_automl
label_desc: Use image node_id 1 for calling a global function with example usage: create_data(loader) and returns: x,  y, train_loader,  val_loader,  test_loader, train_data,  val_data,  test_data