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 \((\mbox{minibatch} , \mbox{in\_channels} , iW)\)

weight

filters of shape \((\mbox{out\_channels} , \frac{\mbox{in\_channels}}{\mbox{groups}} , kW)\)

bias

optional bias of shape \((\mbox{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, \(\mbox{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.3253  -4.6588   2.1731   1.4436   0.4239  -3.5681  -3.5062  11.4277
#>    3.1278   6.2965  -9.5875  -9.8928  10.0064   9.3870  -4.3782  -9.4908
#>  -14.4924   0.9071  -2.4768   5.7176  -0.6164 -11.0419   4.4035   6.8638
#>   -3.7752   7.1191  -3.2018 -14.7920  -0.4969  -3.1979 -17.2714 -13.6381
#>   -0.0087   2.4863  -2.5665  -6.3360 -11.7536  -7.6350  -2.7460  -5.0664
#>   -4.1200   6.3509  12.0308   7.4958   0.3596   0.2718   5.8559  11.0820
#>    6.3596   0.8484   5.7529   8.7732 -10.5011  -4.5293  17.7433   2.0522
#>    3.7105  -6.5706  -4.0995   3.3578   1.8492   6.5833   5.9011  -7.4979
#>    0.1574   2.2945   3.3310   1.5332   4.6116  -3.2115  -4.2782  10.1443
#>   -3.6005   1.9411  -3.2228  -0.0208   5.2345   0.8413   7.5317   5.9898
#>    5.4455   8.7521  -3.7901   3.4534   5.2674 -10.9926   1.1729   2.6905
#>    6.5125   2.4538 -14.4449   1.4616  -1.3603  -8.6483  -4.2813 -10.8432
#>   -2.5064   9.3786  -2.3310   5.8062  11.9209   3.9905  -5.4403  -4.8849
#>   -1.5111   4.3833 -17.5922   2.6250   1.3776   3.7735  -3.1354  -2.3753
#>   12.1398   1.0453  -2.5355  -5.0478  10.7709  10.9137  -8.0622  -5.8595
#>    5.3040  -4.8179  -6.8195  -1.8480   2.1540  -8.3365   4.6158   1.3832
#>    0.3971   5.9299   7.3874   2.2768   0.7514   4.9970  17.3693  -2.9553
#>    7.6319  -3.7230  -5.4099   0.3353   7.1248   5.2435   2.7309  -9.7317
#>    9.8628   0.0814 -18.8798   2.6261  11.4925   0.5105  -9.3308   2.0090
#>   -6.2019   7.5181   0.0596   1.8541   9.6589   5.6446   1.6680 -11.6379
#>    5.4245   9.7640 -11.0519   1.1734  -0.5569   6.6901   5.6946   7.2394
#>   13.7071 -11.8026  12.9395  11.1482 -15.6699   8.4226  19.8847   6.8077
#>    1.7427  10.2747  -8.8432   6.8128  10.8683  -8.2670 -10.8615  -1.0331
#>    6.1548 -12.5983  -1.3775  -5.5777  -3.1294   1.6432   3.9735   4.2585
#>   -8.8883  13.1505   2.8622   0.7258  -0.2564  -2.3229  -4.1816  -9.7045
#>   -7.5460   9.6440   3.0482  -0.1615   2.5811  -7.1612   3.4498  -1.0770
#>    2.5245   6.4389  -4.1319  -3.8157   3.4292  -5.2298  -7.9886   0.6691
#>    8.5781  -7.3539   1.9563   1.4533  -3.7459   4.7646  -2.6309  -0.0092
#>   -1.4993  12.9420   0.7125  -7.6552   3.4191  -2.2467  -3.1731   1.8526
#> ... [the output was truncated (use n=-1 to disable)]
#> [ CPUFloatType{20,33,48} ]