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".
'''
# 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
评论列表
文章目录