首页 > 解决方案 > Keras - Conv1D 层 - 深度理解

问题描述

我正在尝试理解转换层

x = Conv1D(256, 3, padding='same', activation="relu")(x)

对于这一层,形状

input = (batch_size, 196, 512)
weight = (3, 512, 256)
bias = (256,)
output = (batch_size, 196, 256)

为了理解,我正在手动测试计算。

我正在创建两个形状为inputand的 numpy 数组weight

如果batch_size = 32,

x = np.ones((32, 196, 512)) # Created an array with shape of input which is feed into the Conv1D layer(x)
weight = np.ones((3, 512, 256)) # Weight of the Conv1D layer(x)
y = np.dot(x, weight) # In every neural network, the y = input*weight+bias

输出的形状y(1, 196, 3, 256)。但是,例外的形状是(32, 196, 256)

如何手动理解,谢谢

标签: pythontensorflowkerasdeep-learningneural-network

解决方案


推荐阅读