Class: Torchrb::Lua

Inherits:
Object
  • Object
show all
Defined in:
lib/torchrb/lua.rb

Direct Known Subclasses

Torch

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Lua

Returns a new instance of Lua.



6
7
8
9
10
# File 'lib/torchrb/lua.rb', line 6

def initialize options={}
  self.enable_cuda = options.delete(:enable_cuda) { false }
  self.debug = options.delete(:debug) { false }
  @additional_libraries = options.delete(:lua_libs){[]}
end

Instance Attribute Details

#debugObject

Returns the value of attribute debug.



4
5
6
# File 'lib/torchrb/lua.rb', line 4

def debug
  @debug
end

#enable_cudaObject

Returns the value of attribute enable_cuda.



3
4
5
# File 'lib/torchrb/lua.rb', line 3

def enable_cuda
  @enable_cuda
end

Instance Method Details

#eval(command, file = __FILE__, line = __LINE__, debug: false) ⇒ Object



13
14
15
16
17
18
# File 'lib/torchrb/lua.rb', line 13

def eval(command, file=__FILE__, line=__LINE__, debug: false)
  load_libraries unless @libraries_loaded
  @last_command = command
  puts command if debug || @debug
  state.eval command, nil, file, line
end