Dieses Problem scheint für eine lange Zeit zu bestehen und viele Benutzer sind mit dem Problem konfrontiert.Tensorflow-GPU stürzt bei Losgröße 0 ab CUDNN_STATUS_BAD_PARAM
stream_executor/cuda/cuda_dnn.cc: 444] konnte nicht BatchDescriptor konvertieren {count: 0 feature_map_count: 64 Raum: 7 264 value_min: 0.000000 value_max: 0.000000 Layout: BatchDepthYX} t o cudnn tensor Deskriptors: CUDNN_STATUS_BAD_PARAM
Die Nachricht ist so mysteriös, dass ich nicht weiß, was in meinem Code passiert ist, aber mein Code funktioniert gut auf CPU Tensorflow.
Ich habe gehört, dass wir tf.cond verwenden können, um dies zu umgehen, aber ich bin neu in Tensorflow-gpu, also kann mir bitte jemand helfen? Mein Code verwendet Keras und nimmt Generator wie Eingabe, dies ist zu vermeiden, dass nicht genügend Arbeitsspeicher vorhanden ist. Der Generator ist eine echte True-Loop, die Daten durch einige Batch-Größe ausspuckt.
def resnet_model(bin_multiple):
#input and reshape
inputs = Input(shape=input_shape)
reshape = Reshape(input_shape_channels)(inputs)
#normal convnet layer (have to do one initially to get 64 channels)
conv = Conv2D(64,(1,bin_multiple*note_range),padding="same",activation='relu')(reshape)
pool = MaxPooling2D(pool_size=(1,2))(conv)
for i in range(int(np.log2(bin_multiple))-1):
print(i)
#residual block
bn = BatchNormalization()(pool)
re = Activation('relu')(bn)
freq_range = int((bin_multiple/(2**(i+1)))*note_range)
print(freq_range)
conv = Conv2D(64,(1,freq_range),padding="same",activation='relu')(re)
#add and downsample
ad = add([pool,conv])
pool = MaxPooling2D(pool_size=(1,2))(ad)
flattened = Flatten()(pool)
fc = Dense(1024, activation='relu')(flattened)
do = Dropout(0.5)(fc)
fc = Dense(512, activation='relu')(do)
do = Dropout(0.5)(fc)
outputs = Dense(note_range, activation='sigmoid')(do)
model = Model(inputs=inputs, outputs=outputs)
return model
model = resnet_model(bin_multiple)
init_lr = float(args['init_lr'])
model.compile(loss='binary_crossentropy',
optimizer=SGD(lr=init_lr,momentum=0.9), metrics=['accuracy', 'mae', 'categorical_accuracy'])
model.summary()
history = model.fit_generator(trainGen.next(),trainGen.steps(), epochs=epochs,
verbose=1,validation_data=valGen.next(),validation_steps=valGen.steps(),callbacks=callbacks, workers=8, use_multiprocessing=True)
Sie können es lösen, indem Sie entweder den letzten Stapel auf die gewünschte Größe auffüllen oder die Beispiele im letzten Stapel löschen. Für mich habe ich die Polsterung gemacht –