Class: Chainer::Functions::Math::Identity
- Inherits:
-
Chainer::FunctionNode
- Object
- Chainer::FunctionNode
- Chainer::Functions::Math::Identity
- Defined in:
- lib/chainer/functions/math/identity.rb
Overview
Identity function.
Instance Attribute Summary
Attributes inherited from Chainer::FunctionNode
Class Method Summary collapse
-
.identity(*inputs) ⇒ Object
Just returns input variables.
Instance Method Summary collapse
Methods inherited from Chainer::FunctionNode
#apply, #backward_accumulate, #forward_cpu, #get_retained_inputs, #get_retained_outputs, #initialize, #label, #output_data, #retain_inputs, #retain_outputs, #unchain
Constructor Details
This class inherits a constructor from Chainer::FunctionNode
Class Method Details
.identity(*inputs) ⇒ Object
Just returns input variables.
20 21 22 23 |
# File 'lib/chainer/functions/math/identity.rb', line 20 def self.identity(*inputs) ret = self.new.apply(inputs) ret.size == 1 ? ret[0] : ret end |
Instance Method Details
#backward(indexes, gys) ⇒ Object
15 16 17 |
# File 'lib/chainer/functions/math/identity.rb', line 15 def backward(indexes, gys) return gys end |
#check_type_forward(in_types) ⇒ Object
6 7 8 |
# File 'lib/chainer/functions/math/identity.rb', line 6 def check_type_forward(in_types) # pass end |
#forward(xs) ⇒ Object
10 11 12 13 |
# File 'lib/chainer/functions/math/identity.rb', line 10 def forward(xs) retain_inputs([]) return xs end |