Class: Torch::Device
- Inherits:
-
Object
- Object
- Torch::Device
- Defined in:
- lib/torch/device.rb
Instance Method Summary collapse
Instance Method Details
#==(other) ⇒ Object
12 13 14 |
# File 'lib/torch/device.rb', line 12 def ==(other) eql?(other) end |
#eql?(other) ⇒ Boolean
16 17 18 |
# File 'lib/torch/device.rb', line 16 def eql?(other) other.is_a?(Device) && other.type == type && other.index == index end |
#hash ⇒ Object
20 21 22 |
# File 'lib/torch/device.rb', line 20 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
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 |