Class: Torch::NN::Parameter

Inherits:
Tensor
  • Object
show all
Defined in:
lib/torch/nn/parameter.rb

Constant Summary

Constants included from Inspector

Inspector::PRINT_OPTS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Tensor

#<=>, #[], #[]=, #coerce, #cpu, #cuda, #dtype, #each, #imag, #item, #layout, #length, #new, #numo, #random!, #real, #requires_grad=, #size, #stride, #to, #to_a, #to_f, #to_i, #to_s, #type

Class Method Details

.new(data = nil, requires_grad: true) ⇒ Object



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

def self.new(data = nil, requires_grad: true)
  data = Tensor.new unless data
  _make_subclass(data, requires_grad)
end

Instance Method Details

#dupObject



16
17
18
19
20
# File 'lib/torch/nn/parameter.rb', line 16

def dup
  Torch.no_grad do
    Parameter.new(clone, requires_grad: requires_grad)
  end
end

#inspectObject



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

def inspect
  "Parameter containing:\n#{super}"
end