lib/dnn/core/utils.rb in ruby-dnn-0.13.1 vs lib/dnn/core/utils.rb in ruby-dnn-0.13.2
- old
+ new
@@ -16,13 +16,10 @@
# Convert hash to an object.
def self.hash_to_obj(hash)
return nil if hash == nil
dnn_class = DNN.const_get(hash[:class])
- if dnn_class.respond_to?(:from_hash)
- return dnn_class.from_hash(hash)
- end
- dnn_class.new
+ dnn_class.from_hash(hash)
end
# Return the result of the sigmoid function.
def self.sigmoid(x)
Activations::Sigmoid.new.forward(x)