Class: Integer

Inherits:
Object
  • Object
show all
Defined in:
lib/dnn/core/monkey_patch.rb

Instance Method Summary collapse

Instance Method Details

#*(other) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/dnn/core/monkey_patch.rb', line 21

def *(other)
  if other.is_a?(DNN::Tensor) || other.is_a?(DNN::Param)
    DNN::Layers::Mul.(DNN::Tensor.convert(self), other)
  else
    dnn__mul(other)
  end
end

#+(other) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/dnn/core/monkey_patch.rb', line 3

def +(other)
  if other.is_a?(DNN::Tensor) || other.is_a?(DNN::Param)
    DNN::Layers::Add.(DNN::Tensor.convert(self), other)
  else
    dnn__add(other)
  end
end

#-(other) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/dnn/core/monkey_patch.rb', line 12

def -(other)
  if other.is_a?(DNN::Tensor) || other.is_a?(DNN::Param)
    DNN::Layers::Sub.(DNN::Tensor.convert(self), other)
  else
    dnn__sub(other)
  end
end

#/(other) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/dnn/core/monkey_patch.rb', line 30

def /(other)
  if other.is_a?(DNN::Tensor) || other.is_a?(DNN::Param)
    DNN::Layers::Div.(DNN::Tensor.convert(self), other)
  else
    dnn__div(other)
  end
end

#dnn__addObject



2
# File 'lib/dnn/core/monkey_patch.rb', line 2

alias dnn__add +

#dnn__divObject



29
# File 'lib/dnn/core/monkey_patch.rb', line 29

alias dnn__div /

#dnn__mulObject



20
# File 'lib/dnn/core/monkey_patch.rb', line 20

alias dnn__mul *

#dnn__subObject



11
# File 'lib/dnn/core/monkey_patch.rb', line 11

alias dnn__sub -