class DNN::Savers::Saver

Public Class Methods

new(model) click to toggle source
# File lib/dnn/core/savers.rb, line 67
def initialize(model)
  @model = model
end

Public Instance Methods

save(file_name) click to toggle source
# File lib/dnn/core/savers.rb, line 71
def save(file_name)
  bin = dump_bin
  begin
    File.binwrite(file_name, bin)
  rescue Errno::ENOENT
    dir_name = file_name.match(%r`(.*)/.+$`)[1]
    Dir.mkdir(dir_name)
    File.binwrite(file_name, bin)
  end
end

Private Instance Methods

dump_bin() click to toggle source
# File lib/dnn/core/savers.rb, line 84
def dump_bin
  raise NotImplementedError, "Class '#{self.class.name}' has implement method 'dump_bin'"
end