Class: RubyZero::Core::Device

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyzero/core/device.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier) ⇒ Device

Returns a new instance of Device.



4
5
6
7
8
9
10
11
12
# File 'lib/rubyzero/core/device.rb', line 4

def initialize(identifier)
    sym = identifier.to_sym
    if sym == :cpu
        @caluculator = Numo
        @identifier = sym
    else
        raise RubyZero::Core::Exceptions::DeviceNotSupported, "Device #{identifier} is not supported."
    end
end

Instance Attribute Details

#caluculatorObject (readonly)

Returns the value of attribute caluculator.



3
4
5
# File 'lib/rubyzero/core/device.rb', line 3

def caluculator
  @caluculator
end

#identifierObject (readonly)

Returns the value of attribute identifier.



3
4
5
# File 'lib/rubyzero/core/device.rb', line 3

def identifier
  @identifier
end

Instance Method Details

#xmoObject



13
14
15
16
17
# File 'lib/rubyzero/core/device.rb', line 13

def xmo
    if @identifier == :cpu
        return Numo
    end
end