Class: DNN::Savers::MarshalSaver
Instance Method Summary collapse
- #dump_bin ⇒ Object
-
#initialize(model, include_model: true) ⇒ MarshalSaver
constructor
A new instance of MarshalSaver.
Methods inherited from Saver
Constructor Details
#initialize(model, include_model: true) ⇒ MarshalSaver
Returns a new instance of MarshalSaver.
84 85 86 87 |
# File 'lib/dnn/core/savers.rb', line 84 def initialize(model, include_model: true) super(model) @include_model = include_model end |
Instance Method Details
#dump_bin ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/dnn/core/savers.rb', line 89 def dump_bin params_data = @model.get_all_params_data if @include_model @model.clean_layers data = { version: VERSION, class: @model.class.name, params: params_data, model: @model } else data = { version: VERSION, class: @model.class.name, params: params_data } end bin = Zlib::Deflate.deflate(Marshal.dump(data)) @model.set_all_params_data(params_data) if @include_model bin end |