Class: TorchVision::Datasets::VisionDataset

Inherits:
Torch::Utils::Data::Dataset
  • Object
show all
Defined in:
lib/torchvision/datasets/vision_dataset.rb

Direct Known Subclasses

CIFAR10, DatasetFolder, MNIST

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root, transforms: nil, transform: nil, target_transform: nil) ⇒ VisionDataset

Returns a new instance of VisionDataset.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/torchvision/datasets/vision_dataset.rb', line 6

def initialize(root, transforms: nil, transform: nil, target_transform: nil)
  @root = root

  has_transforms = !transforms.nil?
  has_separate_transform = !transform.nil? || !target_transform.nil?
  if has_transforms && has_separate_transform
    raise ArgumentError, "Only transforms or transform/target_transform can be passed as argument"
  end

  @transform = transform
  @target_transform = target_transform

  if has_separate_transform
    # transforms = StandardTransform.new(transform, target_transform)
  end
  @transforms = transforms
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/torchvision/datasets/vision_dataset.rb', line 4

def data
  @data
end

#targetsObject (readonly)

Returns the value of attribute targets.



4
5
6
# File 'lib/torchvision/datasets/vision_dataset.rb', line 4

def targets
  @targets
end