Class: TorchText::Datasets::TextClassificationDataset
- Inherits:
-
Torch::Utils::Data::Dataset
- Object
- Torch::Utils::Data::Dataset
- TorchText::Datasets::TextClassificationDataset
- Defined in:
- lib/torchtext/datasets/text_classification_dataset.rb
Instance Attribute Summary collapse
-
#labels ⇒ Object
readonly
Returns the value of attribute labels.
-
#vocab ⇒ Object
readonly
Returns the value of attribute vocab.
Instance Method Summary collapse
- #[](i) ⇒ Object
- #each ⇒ Object
-
#initialize(vocab, data, labels) ⇒ TextClassificationDataset
constructor
A new instance of TextClassificationDataset.
- #length ⇒ Object (also: #size)
Constructor Details
#initialize(vocab, data, labels) ⇒ TextClassificationDataset
Returns a new instance of TextClassificationDataset.
6 7 8 9 10 11 |
# File 'lib/torchtext/datasets/text_classification_dataset.rb', line 6 def initialize(vocab, data, labels) super() @data = data @labels = labels @vocab = vocab end |
Instance Attribute Details
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
4 5 6 |
# File 'lib/torchtext/datasets/text_classification_dataset.rb', line 4 def labels @labels end |
#vocab ⇒ Object (readonly)
Returns the value of attribute vocab.
4 5 6 |
# File 'lib/torchtext/datasets/text_classification_dataset.rb', line 4 def vocab @vocab end |
Instance Method Details
#[](i) ⇒ Object
13 14 15 |
# File 'lib/torchtext/datasets/text_classification_dataset.rb', line 13 def [](i) @data[i] end |
#each ⇒ Object
22 23 24 25 26 |
# File 'lib/torchtext/datasets/text_classification_dataset.rb', line 22 def each @data.each do |x| yield x end end |
#length ⇒ Object Also known as: size
17 18 19 |
# File 'lib/torchtext/datasets/text_classification_dataset.rb', line 17 def length @data.length end |