Sha256: c8a15e21d646c11aa24d1bdff5dc9cbf24f2db64d45b5606b0edf036fe21b149

Contents?: true

Size: 493 Bytes

Versions: 20

Compression:

Stored size: 493 Bytes

Contents

module Torch
  module NN
    class Parameter < Tensor
      # fix for issue w/ assignment methods
      alias_method :grad=, :_set_grad

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

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

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

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
torch-rb-0.18.0 lib/torch/nn/parameter.rb
torch-rb-0.17.1 lib/torch/nn/parameter.rb
torch-rb-0.17.0 lib/torch/nn/parameter.rb
torch-rb-0.16.0 lib/torch/nn/parameter.rb
torch-rb-0.15.0 lib/torch/nn/parameter.rb
torch-rb-0.14.1 lib/torch/nn/parameter.rb
torch-rb-0.14.0 lib/torch/nn/parameter.rb
torch-rb-0.13.2 lib/torch/nn/parameter.rb
torch-rb-0.13.1 lib/torch/nn/parameter.rb
torch-rb-0.13.0 lib/torch/nn/parameter.rb
torch-rb-0.12.2 lib/torch/nn/parameter.rb
torch-rb-0.12.1 lib/torch/nn/parameter.rb
torch-rb-0.12.0 lib/torch/nn/parameter.rb
torch-rb-0.11.2 lib/torch/nn/parameter.rb
torch-rb-0.11.1 lib/torch/nn/parameter.rb
torch-rb-0.11.0 lib/torch/nn/parameter.rb
torch-rb-0.10.2 lib/torch/nn/parameter.rb
torch-rb-0.10.1 lib/torch/nn/parameter.rb
torch-rb-0.10.0 lib/torch/nn/parameter.rb
torch-rb-0.9.2 lib/torch/nn/parameter.rb