小编Leo*_*den的帖子

TensorFlow:不兼容的形状:[100,155] 与 [128,155] 结合 CNN 和 LSTM 时

问题

尝试为音频回归任务堆叠 Conv -> Lstm -> 完全连接层时出现不兼容的形状错误。我不知道为什么我会收到我收到的错误 - 图表构建良好然后抛出错误 - 任何人都可以帮忙吗?

代码

lstm_num_hidden = 128
lstm_number_layers = 3
x = tf.placeholder(tf.float32, [None, 1024])
y = tf.placeholder(tf.float32, [None, 155])
keep_probability = tf.placeholder(tf.float32)

def conv2d(x, weights):
    return tf.nn.conv2d(x, weights, strides=[1, 1, 1, 1], padding='SAME')

x_spectrogram = tf.reshape(x, [-1, 32, 32, 1])

conv1_weights = tf.Variable(tf.truncated_normal([5, 5, 1, 32], stddev=0.1))
conv1_bias = tf.Variable(tf.constant(0.1, shape=[32]))
conv1_hidden = tf.nn.relu(conv2d(x_spectrogram, conv1_weights) + conv1_bias)
conv1_pooling = tf.nn.max_pool(conv1_hidden, ksize=[1, 2, 2, 1],strides=[1, 2, 2, 1], padding='SAME')

conv2_weights = tf.Variable(tf.truncated_normal([5, …
Run Code Online (Sandbox Code Playgroud)

python neural-network deep-learning tensorflow

6
推荐指数
1
解决办法
3万
查看次数

TensorFlow:"没有为任何变量提供渐变"和partial_run

问题

使用Tensorflow的partial_run()方法不能像我预期的那样工作.我在提供的代码的底部使用它,我相信它给了我附加的错误.

数据的一般流程是我需要从模型中获得预测,在一些非张量流代码(编程软件合成器)中使用该预测,然后在播放midi音符后获得音频特征(MFCCS,RMS,FFT)最后可以将其传递给成本函数,以检查预测补丁与重新创建当前示例所提供的所需声音的接近程度.

代码 - 省略预处理

# Create the tensorflow graph.
dimension_data_example = generate_examples(1,
                                           midi_note,
                                           midi_velocity,
                                           note_length,
                                           render_length,
                                           engine,
                                           generator,
                                           mfcc_normaliser,
                                           rms_normaliser)

features, parameters = dimension_data_example[0]
# https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/recurrent_network.ipynb
# Parameters for the tensorflow graph.
learning_rate = 0.001
training_iters = 256
batch_size = 128
display_step = 10
number_hidden_1 = 128
number_hidden_2 = 128

# Network parameters:
# 14 * 181 - (amount of mfccs + rms value) * sample size
number_input = int(features.shape[0])

# 155 - amount of parameters
number_outputs = …
Run Code Online (Sandbox Code Playgroud)

python tensorflow

4
推荐指数
1
解决办法
5359
查看次数