MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / conv1d

Function conv1d

tensorflow/python/ops/nn_ops.py:1640–1724  ·  view source on GitHub ↗

r"""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 "NWC", or [batch, in_channels, in_width] if data_format is "NCW", and a filter / kernel tensor of shape [filter_width, in_channels, ou

(
    value=None,
    filters=None,
    stride=None,
    padding=None,
    use_cudnn_on_gpu=None,
    data_format=None,
    name=None,
    input=None,  # pylint: disable=redefined-builtin
    dilations=None)

Source from the content-addressed store, hash-verified

1638 warn_once=True,
1639 data_format="NHWC")
1640def conv1d(
1641 value=None,
1642 filters=None,
1643 stride=None,
1644 padding=None,
1645 use_cudnn_on_gpu=None,
1646 data_format=None,
1647 name=None,
1648 input=None, # pylint: disable=redefined-builtin
1649 dilations=None):
1650 r"""Computes a 1-D convolution given 3-D input and filter tensors.
1651
1652 Given an input tensor of shape
1653 [batch, in_width, in_channels]
1654 if data_format is "NWC", or
1655 [batch, in_channels, in_width]
1656 if data_format is "NCW",
1657 and a filter / kernel tensor of shape
1658 [filter_width, in_channels, out_channels], this op reshapes
1659 the arguments to pass them to conv2d to perform the equivalent
1660 convolution operation.
1661
1662 Internally, this op reshapes the input tensors and invokes `tf.nn.conv2d`.
1663 For example, if `data_format` does not start with "NC", a tensor of shape
1664 [batch, in_width, in_channels]
1665 is reshaped to
1666 [batch, 1, in_width, in_channels],
1667 and the filter is reshaped to
1668 [1, filter_width, in_channels, out_channels].
1669 The result is then reshaped back to
1670 [batch, out_width, out_channels]
1671 \(where out_width is a function of the stride and padding as in conv2d\) and
1672 returned to the caller.
1673
1674 Args:
1675 value: A 3D `Tensor`. Must be of type `float16`, `float32`, or `float64`.
1676 filters: A 3D `Tensor`. Must have the same type as `value`.
1677 stride: An int or list of `ints` that has length `1` or `3`. The number of
1678 entries by which the filter is moved right at each step.
1679 padding: 'SAME' or 'VALID'
1680 use_cudnn_on_gpu: An optional `bool`. Defaults to `True`.
1681 data_format: An optional `string` from `"NWC", "NCW"`. Defaults to `"NWC"`,
1682 the data is stored in the order of [batch, in_width, in_channels]. The
1683 `"NCW"` format stores data as [batch, in_channels, in_width].
1684 name: A name for the operation (optional).
1685 input: Alias for value.
1686 dilations: An int or list of `ints` that has length `1` or `3` which
1687 defaults to 1. The dilation factor for each dimension of input. If set to
1688 k > 1, there will be k-1 skipped cells between each filter element on that
1689 dimension. Dilations in the batch and depth dimensions must be 1.
1690
1691 Returns:
1692 A `Tensor`. Has the same type as input.
1693
1694 Raises:
1695 ValueError: if `data_format` is invalid.
1696 """
1697 value = deprecation.deprecated_argument_lookup("input", input, "value", value)

Callers 2

_conv1dMethod · 0.70
conv1d_v2Function · 0.70

Calls 3

_get_sequenceFunction · 0.70
name_scopeMethod · 0.45
expand_dimsMethod · 0.45

Tested by

no test coverage detected