Class: TorchVision::Datasets::VisionDataset
- Inherits:
-
Torch::Utils::Data::Dataset
- Object
- Torch::Utils::Data::Dataset
- TorchVision::Datasets::VisionDataset
- Defined in:
- lib/torchvision/datasets/vision_dataset.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#targets ⇒ Object
readonly
Returns the value of attribute targets.
Instance Method Summary collapse
-
#initialize(root, transforms: nil, transform: nil, target_transform: nil) ⇒ VisionDataset
constructor
A new instance of VisionDataset.
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
#data ⇒ Object (readonly)
Returns the value of attribute data.
4 5 6 |
# File 'lib/torchvision/datasets/vision_dataset.rb', line 4 def data @data end |
#targets ⇒ Object (readonly)
Returns the value of attribute targets.
4 5 6 |
# File 'lib/torchvision/datasets/vision_dataset.rb', line 4 def targets @targets end |