code: def sklearn_dataset_to_loaders(
      data,
      train_prop=0.7,
      batch_size=64,
      num_workers=4,
      shuffle=False,
      one_hot=False,
  ):
      xs, ys = data
      if one_hot and ys.dtype != float:
          oh = np.zeros((ys.size, ys.max() + 1))
          oh[np.arange(ys.size), ys] = 1
          ys = oh
  
      dataset = TensorDataset(
          torch.FloatTensor(xs), torch.FloatTensor(ys)
      )
  
      lens = [int(train_prop * len(xs))]
      lens += [len(xs) - lens[0]]
      train_dset, val_dset = torch.utils.data.random_split(
          dataset, lens
      )
  
      train_loader = DataLoader(
          train_dset,
          batch_size=min(batch_size, lens[0]),
          shuffle=shuffle,
          num_workers=num_workers,
      )
      val_loader = DataLoader(
          val_dset,
          batch_size=min(batch_size, lens[1]),
          num_workers=num_workers,
          shuffle=False,
      )
  
      return train_loader, val_loader, xs.shape[1], xs.shape[0]
  
file_path: captum/tests/utils/models/linear_models/_test_linear_classifier.py
imports: import argparse
  import random
  from typing import Optional
  import captum._utils.models.linear_model.model
  import numpy
  import sklearn.datasets
  import torch
  from tests.utils.test_linear_model import _evaluate
  from torch.utils.data import DataLoader, TensorDataset
label_desc: Use image node_id 1 for calling a global function with example usage: sklearn_dataset_to_loaders(data, train_prop, batch_size, num_workers, shuffle, one_hot) and returns: train_loader,  val_loader,  xs,  xs