我收到错误std::getline
并显示以下代码:
std::string line_of_code;
std::getline(std::cin, line_of_code);
X_train的尺寸为int number1;
int number2;
char op;
std::istringstream input_stream(line_of_code);
// Read in first number;
input_stream >> number1;
// Read in operator
input_stream >> op;
// Read in second number;
input_stream >> number2;
// Decide how to process the operator:
int answer;
switch (op)
{
case '*': answer = number1 * number2; break;
case '/': answer = number1 / number2; break;
case '+': answer = number1 + number2; break;
case '-': answer = number1 - number1; break;
}
std::cout << "Result: " << answer << "\n";
(在我计算机Input 0 is incompatible with layer lstm_16: expected ndim=3, found ndim=2
时产生)。为什么会出现此错误?
答案 0 :(得分:0)
这里您要在第一个LSTM层的input_shape
中传递两个值。
Keras LSTM
的输入形状为(samples, time_steps, nfeatures)
,您的图层输入必须具有此形状。