0

Hi so im learning about k fold cross validation, this first snippet of code is the building of a simple ANN:

def buildModel():
    # Fitting classifier to the Training set
    # Create your classifier here
    model = Sequential()

    model.add(Dense(units = 6, input_dim = X.shape[1], activation = 'relu'))
    model.add(Dense(units = 6, activation = 'relu'))
    model.add(Dense(units = 1, activation = 'sigmoid'))
    model.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])
    return model

I then used cross_val_score validation in sklearn to run the ANN. Keras is also runing on my gpu.

from keras.wrappers.scikit_learn import KerasClassifier
from sklearn.model_selection import cross_val_score

model = KerasClassifier(build_fn = buildModel, batch_size = 10, epochs =100)
accuracies = cross_val_score(estimator = model, X = X_train, y = y_train, cv = 10, n_jobs = -1)

But if i put n_jobs = -1 to try and use all cores i get an error (ps i have 11 features):

Blas GEMM launch failed : a.shape=(10, 11), b.shape=(11, 6), m=10, n=6, k=11
 [[node dense_1/MatMul (defined at C:\Users\Brandon Cardillo\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\python\framework\ops.py:1751) ]] 
 [Op:__inference_keras_scratch_graph_1030]

Function call stack:
keras_scratch_graph

Ps. I am also running on jupyter notebook

Any help is very much appriciated. Thank you.

v.tralala
  • 1,444
  • 3
  • 18
  • 39
Z-BRA
  • 1
  • does this help you? https://stackoverflow.com/questions/43990046/tensorflow-blas-gemm-launch-failed – v.tralala Nov 27 '19 at 21:12
  • @v.tralala Thanks for the reply but I have seen these older posts and they are for tensorflow v1 and in tensorflow v2 config.gpu_options.allow_growth=True is depriciared. So that fix doesnt work for me – Z-BRA Nov 27 '19 at 23:02

0 Answers0