tf.nn.conv1d
tf.nn.conv1d
tf.nn.conv1d
conv1d( value, filters, stride, padding, use_cudnn_on_gpu=None, data_format=None, name=None )
Defined in tensorflow/python/ops/nn_ops.py
.
See the guide: Neural Network > Convolution
Computes a 1-D convolution given 3-D input and filter tensors.
Given an input tensor of shape [batch, in_width, in_channels] if data_format is "NHWC", or [batch, in_channels, in_width] if data_format is "NCHW", and a filter / kernel tensor of shape [filter_width, in_channels, out_channels], this op reshapes the arguments to pass them to conv2d to perform the equivalent convolution operation.
Internally, this op reshapes the input tensors and invokes tf.nn.conv2d
. For example, if data_format
does not start with "NC", a tensor of shape [batch, in_width, in_channels] is reshaped to [batch, 1, in_width, in_channels], and the filter is reshaped to [1, filter_width, in_channels, out_channels]. The result is then reshaped back to [batch, out_width, out_channels] (where out_width is a function of the stride and padding as in conv2d) and returned to the caller.
Args:
-
value
: A 3DTensor
. Must be of typefloat32
orfloat64
. -
filters
: A 3DTensor
. Must have the same type asinput
. -
stride
: Aninteger
. The number of entries by which the filter is moved right at each step. -
padding
: 'SAME' or 'VALID' -
use_cudnn_on_gpu
: An optionalbool
. Defaults toTrue
. -
data_format
: An optionalstring
from"NHWC", "NCHW"
. Defaults to"NHWC"
, the data is stored in the order of [batch, in_width, in_channels]. The"NCHW"
format stores data as [batch, in_channels, in_width]. -
name
: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input.
Raises:
-
ValueError
: ifdata_format
is invalid.
© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/nn/conv1d