Class: Torch::Device
- Inherits:
-
Object
- Object
- Torch::Device
- Defined in:
- lib/torch/device.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
- #index ⇒ Object
- #inspect ⇒ Object (also: #to_s)
Instance Method Details
#==(other) ⇒ Object
13 14 15 |
# File 'lib/torch/device.rb', line 13 def ==(other) eql?(other) end |
#eql?(other) ⇒ Boolean
17 18 19 |
# File 'lib/torch/device.rb', line 17 def eql?(other) other.is_a?(Device) && other.type == type && other.index == index end |
#hash ⇒ Object
21 22 23 |
# File 'lib/torch/device.rb', line 21 def hash [type, index].hash end |
#index ⇒ Object
3 4 5 |
# File 'lib/torch/device.rb', line 3 def index index? ? _index : nil end |
#inspect ⇒ Object Also known as: to_s
7 8 9 10 |
# File 'lib/torch/device.rb', line 7 def inspect extra = ", index: #{index.inspect}" if index? "device(type: #{type.inspect}#{extra})" end |