Class: Chainer::Functions::Math::Identity

Inherits:
Chainer::Function show all
Defined in:
lib/chainer/functions/math/identity.rb

Overview

Identity function.

Instance Attribute Summary

Attributes inherited from Chainer::Function

#inputs, #output_data, #outputs, #rank, #retain_after_backward

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Chainer::Function

#call, #forward_cpu, #initialize, #retain_inputs, #retain_outputs

Constructor Details

This class inherits a constructor from Chainer::Function

Class Method Details

.identity(*inputs) ⇒ Object

Just returns input variables.



20
21
22
# File 'lib/chainer/functions/math/identity.rb', line 20

def self.identity(*inputs)
  self.new.(*inputs)
end

Instance Method Details

#backward(xs, gys) ⇒ Object



15
16
17
# File 'lib/chainer/functions/math/identity.rb', line 15

def backward(xs, 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