Skip to contents

Conv1d

Usage

torch_conv1d(
  input,
  weight,
  bias = list(),
  stride = 1L,
  padding = 0L,
  dilation = 1L,
  groups = 1L
)

Arguments

input

input tensor of shape (minibatch,in\_channels,iW)

weight

filters of shape (out\_channels,in\_channelsgroups,kW)

bias

optional bias of shape (out\_channels). Default: NULL

stride

the stride of the convolving kernel. Can be a single number or a one-element tuple (sW,). Default: 1

padding

implicit paddings on both sides of the input. Can be a single number or a one-element tuple (padW,). Default: 0

dilation

the spacing between kernel elements. Can be a single number or a one-element tuple (dW,). Default: 1

groups

split input into groups, in\_channels should be divisible by the number of groups. Default: 1

conv1d(input, weight, bias=NULL, stride=1, padding=0, dilation=1, groups=1) -> Tensor

Applies a 1D convolution over an input signal composed of several input planes.

See nn_conv1d() for details and output shape.

Examples

if (torch_is_installed()) {

filters = torch_randn(c(33, 16, 3))
inputs = torch_randn(c(20, 16, 50))
nnf_conv1d(inputs, filters)
}
#> torch_tensor
#> (1,.,.) = 
#>  Columns 1 to 8   1.8773   3.8270  -2.0085   2.2047   4.7765   8.5147   9.2855   5.9509
#>    0.2103  -1.1423   1.2525  -1.1455  -5.2979   3.2512  -8.2822  -6.5076
#>    8.4963  10.4915  12.3501   0.0996  11.2060   2.6952   8.9502   0.5847
#>   -6.9101  -1.1191  -1.9844  -9.9915 -10.6002  -6.8776  -7.2207  -4.5275
#>   -1.4377  12.2075  -4.9638   9.8613  -2.7525   2.0959  -5.8531  10.3158
#>   -5.9119   2.1524   1.1103  14.6864   0.1861  -0.3529   0.1218   2.1229
#>    1.8779  -7.5407  10.1930  -4.9219  -4.7589   0.0839   5.8208  -8.2069
#>   14.0567   4.3517  -5.3931  10.8250  -2.4659  -1.4528  -5.4472 -11.8957
#>    3.3352  -2.1849   3.3825  -5.7497   9.3860   2.8892  -9.5488  10.0246
#>    3.7139  -1.1893   5.8524  -4.1144  -3.8379  -3.2715  12.3648  -7.3022
#>    6.3391   3.8490   0.0966  14.1187  -2.3296  -0.0499   3.3738   2.5069
#>   -3.6039  -2.5855  -1.3693  -2.9448  -0.4943  11.5554 -18.9318   3.8286
#>    3.5501   0.7022   2.9863  -3.7678   5.5417 -12.0948   2.3262   8.9773
#>  -10.2856   0.7309  -2.2191  -2.6726   8.9700   5.1367  -5.8212   6.7705
#>   -6.2699   7.7844   1.1992  -9.8723   3.4002   1.0824   0.5633 -15.2554
#>    2.1602   4.6129   0.3140   2.4626   4.8185  10.2248  -7.9947  -1.0807
#>   -3.0402  -1.2173   1.9523   2.3152 -10.9796   9.4768   1.9507  -5.2450
#>    9.8341  -0.3357   2.0597   1.1952  -1.9214 -17.4927   4.2024   2.6981
#>    1.7595   4.9181   8.0015  -9.8762   1.2017  10.8301   7.8083  -8.4442
#>   -2.0629  -2.0021  -4.3751  -0.4534  -1.3962   4.8429   2.8299  -3.6940
#>    0.6280  -1.6077  13.0193  -0.7761   4.6628   2.7861  15.3083   6.0344
#>    0.0044  11.4955  -0.1855   4.5168  -8.7276   9.0557  -1.6152  -4.2556
#>   -4.8506   9.5743   4.1419   2.7906   2.0023  11.7027   0.5959  -1.6895
#>    0.9182  -0.3823 -10.4505  -0.0190  -6.4589  -1.4466  -7.3250  -1.9068
#>    3.8625  -7.3053   7.0725  -8.6134  -6.7165   3.7123  -8.7002  -5.5387
#>    5.9330   4.9813   5.4131   3.0484   7.1562  10.4064   0.6227  11.3842
#>  -10.1675   5.8252   2.6986  -7.9222  10.5096   1.6551   2.3947   0.3311
#>   -4.4995  -5.1192  -6.8450   9.7043  -6.3504 -10.6412  -0.4556   1.8581
#>   -4.1302   7.5991  -1.7031   2.8951  -1.7518   7.0743  -1.3617  10.7666
#> ... [the output was truncated (use n=-1 to disable)]
#> [ CPUFloatType{20,33,48} ]