简体   繁体   English

给我的batch_size值是多少?

[英]what is the value to give to my batch_size?

I want to predict the value of my x_test after compiling a CNN model: 我想在编译CNN模型后预测x_test的值:

y_test_predict= model.predict(x_test[3])

My x_test[3] has a shape about (8000, 1) 我的x_test[3]的形状约为(8000, 1) x_test[3] (8000, 1)

But this line of code gives me this erros that I don't understand really: 但是这行代码给了我我不太了解的错误:

Traceback (most recent call last):
  File "CNN_Learning_Side_Channel_Attack.py", line 155, in <module>
    test_One_Trace= model.predict(x_test[3])
  File "/home/user/.local/lib/python3.4/site-packages/keras/models.py", line 899, in predict
    return self.model.predict(x, batch_size=batch_size, verbose=verbose)
  File "/home/user/.local/lib/python3.4/site-packages/keras/engine/training.py", line 1555, in predict
    check_batch_axis=False)
  File "/home/user/.local/lib/python3.4/site-packages/keras/engine/training.py", line 121, in _standardize_input_data
    str(array.shape))
ValueError: Error when checking : expected conv1d_1_input to have 3 dimensions, but got array with shape (8000, 1)

I would be very grateful if you could help me please. 如果您能帮助我,我将不胜感激。

For convolution operation to make sense you need to give 3 dimensions. 为了使卷积运算有意义,您需要给出3维。 In your case you are giving (8000, 1) which is clearly not having 3 dimensions( it has 2 ). 在您的情况下,您给出的(8000, 1)显然没有3维(有2维)。

With information provided in question it is very difficult to exactly give you the dimensions, but your problem is mostly with dimensions. 根据所提供的信息,很难准确地给您提供尺寸,但是您的问题主要是尺寸。 You should check your input dimensions while training. 训练时应检查输入尺寸。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM