in method 'input_variable', argument 3 of type '::CNTK::DataType'

时间:2018-02-26 17:43:42

标签: python keras cntk

I am using keras with cntk as backend for Convolutional neural network. Shape of train data is (12459,49). There is some problem with input_shape. Input is numpy array.

model= Sequential()
model.add(Conv1D(nb_filter=32,filter_length=3, strides=1,input_shape=
(None,x_train.shape),padding='same', dilation_rate=1, activation='relu', 
use_bias=True, kernel_initializer='glorot_uniform', 
bias_initializer='zeros',kernel_regularizer=None, bias_regularizer=None, 
activity_regularizer=None, kernel_constraint=None, bias_constraint=None))

model.add(Conv1D(nb_filter=16, filter_length=1, strides=1,padding='same', 
dilation_rate=1, activation='relu', use_bias=True, 
kernel_initializer='glorot_uniform', bias_initializer='zeros', 
kernel_regularizer=None, bias_regularizer=None, activity_regularizer=None, 
kernel_constraint=None, bias_constraint=None))

model.add(MaxPooling1D(pool_size=2, strides=None, padding='valid'))
model.add(Dropout(dropout_rate))
model.add(Flatten())

Error:

input_variable(shape, dtype, needs_gradient, is_sparse, dynamic_axes, name)
  3504     # TODO sparse for numpy arrays
 3505 
-> 3506     return input_variable(shape, is_sparse, dtype, needs_gradient, 
name, dynamic_axes)
   3507 
   3508 @typemap

OverflowError: in method 'input_variable', argument 3 of type '::CNTK::DataType'

It shows error: in method 'input_variable', argument 3 of type '::CNTK::DataType' at first convlayer. I read the document of cntk input_variable and keras document for conv1D layer. I cannot specify the dtype in keras layer but as per my understanding cntk does require dtype in input_variable function. What can be the solution?

0 个答案:

没有答案