Class: Torch::NN::Conv1d

Inherits:
ConvNd show all
Defined in:
lib/torch/nn/conv1d.rb

Instance Attribute Summary

Attributes inherited from ConvNd

#dilation, #groups, #in_channels, #kernel_size, #out_channels, #output_paddding, #padding, #padding_mode, #stride, #transposed

Attributes inherited from Module

#training

Instance Method Summary collapse

Methods inherited from ConvNd

#reset_parameters

Methods inherited from Module

#_apply, #add_module, #apply, #buffers, #call, #children, #cpu, #cuda, #deep_dup, #double, #eval, #float, #half, #inspect, #load_state_dict, #method_missing, #modules, #named_buffers, #named_children, #named_modules, #named_parameters, #parameters, #register_buffer, #register_parameter, #requires_grad!, #respond_to?, #share_memory, #state_dict, #to, #train, #type, #zero_grad

Methods included from Utils

#_activation_fn, #_clones, #_ntuple, #_pair, #_quadrupal, #_single, #_triple

Constructor Details

#initialize(in_channels, out_channels, kernel_size, stride: 1, padding: 0, dilation: 1, groups: 1, bias: true, padding_mode: "zeros") ⇒ Conv1d

Returns a new instance of Conv1d.



4
5
6
7
8
9
10
11
12
# File 'lib/torch/nn/conv1d.rb', line 4

def initialize(in_channels, out_channels, kernel_size, stride: 1,
  padding: 0, dilation: 1, groups: 1, bias: true, padding_mode: "zeros")

  kernel_size = _single(kernel_size)
  stride = _single(stride)
  padding = _single(padding)
  dilation = _single(dilation)
  super(in_channels, out_channels, kernel_size, stride, padding, dilation, false, _single(0), groups, bias, padding_mode)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Torch::NN::Module

Instance Method Details

#forward(input) ⇒ Object



14
15
16
17
18
19
# File 'lib/torch/nn/conv1d.rb', line 14

def forward(input)
  if @padding_mode == "circular"
    raise NotImplementedError
  end
  F.conv1d(input, @weight, @bias, @stride, @padding, @dilation, @groups)
end