def conv1d(x, kernel, stride=1, border_mode='valid',
image_shape=None, filter_shape=None):
"""1D convolution.
# Arguments
kernel: kernel tensor.
strides: stride integer.
border_mode: string, `"same"` or `"valid"`.
# Returns
A tensor, result of 1D convolution.
"""
# pre-process dtype
x_dtype = dtype(x)
if x_dtype == 'float64':
x = tf.cast(x, 'float32')
kernel = tf.cast(kernel, 'float32')
padding = _preprocess_border_mode(border_mode)
x = tf.nn.conv1d(x, kernel, stride, padding=padding)
# post-process dtype
if x_dtype == 'float64':
x = tf.cast(x, 'float64')
return x
tensorflow_backend.py 文件源码
python
阅读 34
收藏 0
点赞 0
评论 0
评论列表
文章目录