class_docstr: Helper class that wraps a torch dataset to make it work with
  sklearn.
  
  Sometimes, sklearn will touch the input data, e.g. when splitting
  the data for a grid search. This will fail when the input data is
  a torch dataset. To prevent this, use this wrapper class for your
  dataset.
  
  Note: This class will only return the X value by default (i.e. the
  first value returned by indexing the original dataset). Sklearn,
  and hence skorch, always require 2 values, X and y. Therefore, you
  still need to provide the y data separately.
  
  Note: This class behaves similarly to a PyTorch
  :class:`~torch.utils.data.Subset` when it is indexed by a slice or
  numpy array: It will return another ``SliceDataset`` that
  references the subset instead of the actual values. Only when it
  is indexed by an int does it return the actual values. The reason
  for this is to avoid loading all data into memory when sklearn,
  for instance, creates a train/validation split on the
  dataset. Data will only be loaded in batches during the fit loop.
  
  Examples
  --------
  >>> X = MyCustomDataset()
  >>> search = GridSearchCV(net, params, ...)
  >>> search.fit(X, y)  # raises error
  >>> ds = SliceDataset(X)
  >>> search.fit(ds, y)  # works
  
  Parameters
  ----------
  dataset : torch.utils.data.Dataset
    A valid torch dataset.
  
  idx : int (default=0)
    Indicates which element of the dataset should be
    returned. Typically, the dataset returns both X and y
    values. SliceDataset can only return 1 value. If you want to
    get X, choose idx=0 (default), if you want y, choose idx=1.
  
  indices : list, np.ndarray, or None (default=None)
    If you only want to return a subset of the dataset, indicate
    which subset that is by passing this argument. Typically, this
    can be left to be None, which returns all the data. See also
    :class:`~torch.utils.data.Subset`.
class_docstr_tok: ["Helper","class","that","wraps","a","torch","dataset","to","make","it","work","with","sklearn",".","Sometimes",",","sklearn","will","touch","the","input","data",",","e.g",".","when","splitting","the","data","for","a","grid","search",".","This","will","fail","when","the","input","data","is","a","torch","dataset",".","To","prevent","this",",","use","this","wrapper","class","for","your","dataset",".","Note",":","This","class","will","only","return","the","X","value","by","default","(","i.e",".","the","first","value","returned","by","indexing","the","original","dataset",")",".","Sklearn",",","and","hence","skorch",",","always","require","2","values",",","X","and","y",".","Therefore",",","you","still","need","to","provide","the","y","data","separately",".","Note",":","This","class","behaves","similarly","to","a","PyTorch",":","class",":","`","~torch.utils.data.Subset","`","when","it","is","indexed","by","a","slice","or","numpy","array",":","It","will","return","another","``","SliceDataset","``","that","references","the","subset","instead","of","the","actual","values",".","Only","when","it","is","indexed","by","an","int","does","it","return","the","actual","values",".","The","reason","for","this","is","to","avoid","loading","all","data","into","memory","when","sklearn",",","for","instance",",","creates","a","train\/validation","split","on","the","dataset",".","Data","will","only","be","loaded","in","batches","during","the","fit","loop",".","Examples","--","--","--","--",">",">",">","X","=","MyCustomDataset","(",")",">",">",">","search","=","GridSearchCV","(","net",",","params",",","...",")",">",">",">","search.fit","(","X",",","y",")","#","raises","error",">",">",">","ds","=","SliceDataset","(","X",")",">",">",">","search.fit","(","ds",",","y",")","#","works","Parameters","--","--","--","--","--","dataset",":","torch.utils.data.Dataset","A","valid","torch","dataset",".","idx",":","int","(","default=0",")","Indicates","which","element","of","the","dataset","should","be","returned",".","Typically",",","the","dataset","returns","both","X","and","y","values",".","SliceDataset","can","only","return","1","value",".","If","you","want","to","get","X",",","choose","idx=0","(","default",")",",","if","you","want","y",",","choose","idx=1",".","indices",":","list",",","np.ndarray",",","or","None","(","default=None",")","If","you","only","want","to","return","a","subset","of","the","dataset",",","indicate","which","subset","that","is","by","passing","this","argument",".","Typically",",","this","can","be","left","to","be","None",",","which","returns","all","the","data",".","See","also",":","class",":","`","~torch.utils.data.Subset","`","."]
code: def __len__(self):
      return len(self.indices_)
  
imports: from collections.abc import Sequence
  from functools import partial
  import numpy
  from sklearn.base import BaseEstimator
  from sklearn.base import TransformerMixin
  import torch
  from skorch._doctor import SkorchDoctor
  from skorch.cli import parse_args
  from skorch.utils import _make_split
  from skorch.utils import to_numpy
  from skorch.utils import is_torch_data_type
  from skorch.utils import to_tensor
label_desc: Use image node_id 2 for calling the SliceDataset obj's underlying member method code with example usage: obj.__len__() and returns: len