Conv1d
Source:R/gen-namespace-docs.R
, R/gen-namespace-examples.R
, R/gen-namespace.R
torch_conv1d.Rd
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.9721 0.4012 -0.1686 0.9370 -0.2506 -12.3634 0.3104 8.9371
#> 5.7967 -3.2337 8.0294 -0.2222 -11.2563 0.0434 0.5289 -9.4182
#> 1.2705 10.0972 -11.5183 3.3898 2.6910 -4.2843 -7.0170 -0.5558
#> -0.4258 8.3421 7.6814 3.6658 6.2932 0.4534 -8.2000 -7.4022
#> -5.0344 -8.3952 12.1052 -5.2411 9.0322 -12.3735 9.7334 1.2510
#> -0.6253 2.2194 -1.7223 3.4245 -2.9102 8.8269 -6.5297 13.3282
#> -0.6032 -6.2317 6.6873 14.1832 4.5295 -6.0733 3.7231 2.5772
#> 4.4295 0.6661 3.4860 2.6089 -5.8823 -0.4205 -8.9927 6.6897
#> 15.8334 2.5788 -6.7531 2.1371 0.3357 -5.1441 -19.2163 -3.3502
#> 7.2101 4.9102 1.6454 1.9889 -0.1296 -9.0576 1.4023 4.2188
#> -0.1778 1.0934 -1.1782 10.2402 4.9157 -5.5493 0.6698 8.9676
#> 6.4662 8.2069 -7.8352 5.5900 2.3308 3.2582 -6.9394 -0.8818
#> 1.8453 11.2695 -1.2097 -7.3142 3.5464 14.8517 9.9521 -9.5284
#> 2.8641 -1.2875 4.2611 -5.7665 -4.2322 -3.1200 6.1232 -13.5325
#> 5.3822 4.0365 -2.8328 8.1731 -15.7333 1.9283 6.1614 3.0668
#> 4.1033 3.7994 3.6236 -8.2068 -5.8074 -11.6493 12.1785 6.2645
#> 19.7489 11.5494 6.2866 7.7508 6.7241 -10.6996 -7.7424 -8.2993
#> -10.4325 5.5580 9.9403 -5.8744 6.1081 5.2264 -4.0049 -9.8615
#> -12.4599 4.3089 13.9833 7.0562 -1.2945 -0.1112 3.8435 10.8694
#> 6.3934 7.7643 -10.3969 -5.9583 5.2962 -8.9333 -3.1270 -1.3038
#> 6.6776 7.0178 1.8489 -8.6961 5.2799 1.8824 0.1424 -7.5711
#> 3.1003 -0.1860 6.8955 -10.2304 6.1245 -13.6521 16.4608 -30.8328
#> -1.2411 12.9709 0.3968 -5.9572 -3.0361 5.0683 -4.7782 6.8338
#> 8.9884 -2.8470 2.1631 3.9775 -1.6239 7.9917 -7.0367 -2.2697
#> 1.4686 -12.8909 0.2674 6.6647 -5.5488 1.0755 -2.7906 18.7766
#> -3.3981 -4.2558 -1.5665 1.9402 -3.4117 -3.1792 4.8269 9.6574
#> -2.4361 -0.3107 3.9676 -1.0001 -10.8681 -3.4518 5.6043 5.8122
#> 0.3577 -11.9476 2.5167 7.0826 -2.0832 -9.6350 -1.0751 -1.5074
#> -3.5448 7.0308 -3.7205 -12.4894 1.6177 -2.1120 4.6454 -9.5807
#> ... [the output was truncated (use n=-1 to disable)]
#> [ CPUFloatType{20,33,48} ]