Class: Chainer::Initializers::Constant
- Inherits:
-
Chainer::Initializer
- Object
- Chainer::Initializer
- Chainer::Initializers::Constant
- Defined in:
- lib/chainer/initializers/constant.rb
Instance Attribute Summary
Attributes inherited from Chainer::Initializer
Instance Method Summary collapse
- #call(array) ⇒ Object
-
#initialize(fill_value, dtype: nil) ⇒ Constant
constructor
A new instance of Constant.
Constructor Details
#initialize(fill_value, dtype: nil) ⇒ Constant
Returns a new instance of Constant.
4 5 6 7 |
# File 'lib/chainer/initializers/constant.rb', line 4 def initialize(fill_value, dtype: nil) @fill_value = fill_value super(dtype: dtype) end |
Instance Method Details
#call(array) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/chainer/initializers/constant.rb', line 9 def call(array) if @dtype raise ArgumentError unless array.class == @dtype end array.store(@fill_value) array end |