Module: Torch::NN::Utils

Included in:
Functional, Module
Defined in:
lib/torch/nn/utils.rb

Instance Method Summary collapse

Instance Method Details

#_ntuple(n, value) ⇒ Object



20
21
22
# File 'lib/torch/nn/utils.rb', line 20

def _ntuple(n, value)
  value.is_a?(Array) ? value : [value] * n
end

#_pair(value) ⇒ Object



8
9
10
# File 'lib/torch/nn/utils.rb', line 8

def _pair(value)
  _ntuple(2, value)
end

#_quadrupal(value) ⇒ Object



16
17
18
# File 'lib/torch/nn/utils.rb', line 16

def _quadrupal(value)
  _ntuple(4, value)
end

#_single(value) ⇒ Object



4
5
6
# File 'lib/torch/nn/utils.rb', line 4

def _single(value)
  _ntuple(1, value)
end

#_triple(value) ⇒ Object



12
13
14
# File 'lib/torch/nn/utils.rb', line 12

def _triple(value)
  _ntuple(3, value)
end