class Chainer::Functions::Math::Identity

Identity function.

Public Class Methods

identity(*inputs) click to toggle source

Just returns input variables.

# 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

Public Instance Methods

backward(indexes, gys) click to toggle source
# File lib/chainer/functions/math/identity.rb, line 15
def backward(indexes, gys)
  return gys
end
check_type_forward(in_types) click to toggle source
# File lib/chainer/functions/math/identity.rb, line 6
def check_type_forward(in_types)
  # pass
end
forward(xs) click to toggle source
# File lib/chainer/functions/math/identity.rb, line 10
def forward(xs)
  retain_inputs([])
  return xs
end