Class: Float

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

Instance Method Summary collapse

Instance Method Details

#*(other) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/dnn/core/monkey_patch.rb', line 59

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



41
42
43
44
45
46
47
# File 'lib/dnn/core/monkey_patch.rb', line 41

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



50
51
52
53
54
55
56
# File 'lib/dnn/core/monkey_patch.rb', line 50

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



68
69
70
71
72
73
74
# File 'lib/dnn/core/monkey_patch.rb', line 68

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



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

alias dnn__add +

#dnn__divObject



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

alias dnn__div /

#dnn__mulObject



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

alias dnn__mul *

#dnn__subObject



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

alias dnn__sub -