Keras value error: Operands could not be broadcast with with shapes(100,100) - GRU
$begingroup$
I am trying to use Hierarchical Attention Networks for classification of news articles using 20 newsgroup dataset that i downloaded from the internet. I came across this code of the implementation and tried using it on 20 newsgroup dataset as i was curious to see the results and couldn't hold back. Like he showed in the example i followed same steps and got the error
"ValueError: Operands could not be broadcast together with shapes (100, 200) (None, Elemwise{mul,no_inplace}.0)". I have never used keras,can anyone help me with what is wrong with the dimensions of the word encoding and sentence encoding.
import re
import numpy as np
import pandas as pd
import sys
import os
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.callbacks import ModelCheckpoint
from keras.utils import to_categorical
from nltk.tokenize import sent_tokenize
from sklearn.model_selection import train_test_split
from keras_han.model import HAN
MAX_WORDS_PER_SENT = 100
MAX_SENT = 15
MAX_VOC_SIZE = 20000
GLOVE_DIM = 100
TEST_SPLIT = 0.2
def remove_quotations(text):
text = re.sub(r"\", "", text)
text = re.sub(r"'", "", text)
text = re.sub(r""", "", text)
text = re.sub(r"[^A-Za-z0-9]+", " ", text)
return text
def remove_html(text):
tags_regex = re.compile(r'<.*?>')
return tags_regex.sub('', text)
print('Processing text dataset')
TEXT_DATA_DIR = "E:/Thesis/20news-bydate-test"
df = pd.DataFrame(columns=['Text','Labels'])
texts = # list of text samples
labels_index = {} # dictionary mapping label name to numeric id
labels = # list of label ids
for name in sorted(os.listdir(TEXT_DATA_DIR)):
path = os.path.join(TEXT_DATA_DIR, name)
if os.path.isdir(path):
label_id = len(labels_index)
labels_index[name] = label_id
for fname in sorted(os.listdir(path)):
if fname.isdigit():
fpath = os.path.join(path, fname)
if sys.version_info < (3,):
f = open(fpath)
else:
f = open(fpath, encoding='latin-1')
t = f.read()
i = t.find('nn') # skip header
if 0 < i:
t = t[i:]
texts.append(t)
f.close()
labels.append(label_id)
print('Found %s texts.' % len(texts))
df=pd.DataFrame({'Text':texts,'Label':labels})
df['Text'] = df['Text'].apply(remove_quotations)
df['Text'] = df['Text'].apply(remove_html)
df = df.replace('n','', regex=True)
news = df['Text'].values
labels = df['Label'].values
#print(news)
#print(labels)
print("Tokenization.")
# Build a Keras Tokenizer that can encode every token
word_tokenizer = Tokenizer(num_words=MAX_VOC_SIZE)
word_tokenizer.fit_on_texts(news)
# Construct the input matrix. This should be a nd-array of
# shape (n_samples, MAX_SENT, MAX_WORDS_PER_SENT).
# We zero-pad this matrix (this does not influence
# any predictions due to the attention mechanism.
X = np.zeros((len(news), MAX_SENT, MAX_WORDS_PER_SENT), dtype='int32')
for i, review in enumerate(news):
sentences = sent_tokenize(review)
tokenized_sentences = word_tokenizer.texts_to_sequences(
sentences
)
tokenized_sentences = pad_sequences(
tokenized_sentences, maxlen=MAX_WORDS_PER_SENT
)
pad_size = MAX_SENT - tokenized_sentences.shape[0]
if pad_size < 0:
tokenized_sentences = tokenized_sentences[0:MAX_SENT]
else:
tokenized_sentences = np.pad(
tokenized_sentences, ((0,pad_size),(0,0)),
mode='constant', constant_values=0
)
# Store this observation as the i-th observation in
# the data matrix
X[i] = tokenized_sentences[None, ...]
# Transform the labels into a format Keras can handle
y = to_categorical(labels)
# We make a train/test split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=TEST_SPLIT)
embeddings = {}
with open('./embeddings(100).txt',encoding='utf-8') as file:
for line in file:
values = line.split()
word = values[0]
coefs = np.asarray(values[1:], dtype='float32')
embeddings[word] = coefs
# Initialize a matrix to hold the word embeddings
embedding_matrix = np.random.random(
(len(word_tokenizer.word_index) + 1, GLOVE_DIM)
)
embedding_matrix[0] = 0
for word, index in word_tokenizer.word_index.items():
embedding_vector = embeddings.get(word)
if embedding_vector is not None:
embedding_matrix[index] = embedding_vector
print("Training the model")
han_model = HAN(
MAX_WORDS_PER_SENT, MAX_SENT, 20, embedding_matrix,
word_encoding_dim=100, sentence_encoding_dim=100
)
han_model.summary()
checkpoint_saver = ModelCheckpoint(
filepath='./tmp/model.{epoch:02d}-{val_loss:.2f}.hdf5',
verbose=1, save_best_only=True
)
han_model.compile(
optimizer='adagrad', loss='categorical_crossentropy',
metrics=['acc']
)
han_model.fit(
X_train, y_train, batch_size=20, epochs=10,
validation_data=(X_test, y_test),
callbacks=[checkpoint_saver]
)
Here is the Stack trace:

keras nlp word-embeddings attention-mechanism
$endgroup$
add a comment |
$begingroup$
I am trying to use Hierarchical Attention Networks for classification of news articles using 20 newsgroup dataset that i downloaded from the internet. I came across this code of the implementation and tried using it on 20 newsgroup dataset as i was curious to see the results and couldn't hold back. Like he showed in the example i followed same steps and got the error
"ValueError: Operands could not be broadcast together with shapes (100, 200) (None, Elemwise{mul,no_inplace}.0)". I have never used keras,can anyone help me with what is wrong with the dimensions of the word encoding and sentence encoding.
import re
import numpy as np
import pandas as pd
import sys
import os
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.callbacks import ModelCheckpoint
from keras.utils import to_categorical
from nltk.tokenize import sent_tokenize
from sklearn.model_selection import train_test_split
from keras_han.model import HAN
MAX_WORDS_PER_SENT = 100
MAX_SENT = 15
MAX_VOC_SIZE = 20000
GLOVE_DIM = 100
TEST_SPLIT = 0.2
def remove_quotations(text):
text = re.sub(r"\", "", text)
text = re.sub(r"'", "", text)
text = re.sub(r""", "", text)
text = re.sub(r"[^A-Za-z0-9]+", " ", text)
return text
def remove_html(text):
tags_regex = re.compile(r'<.*?>')
return tags_regex.sub('', text)
print('Processing text dataset')
TEXT_DATA_DIR = "E:/Thesis/20news-bydate-test"
df = pd.DataFrame(columns=['Text','Labels'])
texts = # list of text samples
labels_index = {} # dictionary mapping label name to numeric id
labels = # list of label ids
for name in sorted(os.listdir(TEXT_DATA_DIR)):
path = os.path.join(TEXT_DATA_DIR, name)
if os.path.isdir(path):
label_id = len(labels_index)
labels_index[name] = label_id
for fname in sorted(os.listdir(path)):
if fname.isdigit():
fpath = os.path.join(path, fname)
if sys.version_info < (3,):
f = open(fpath)
else:
f = open(fpath, encoding='latin-1')
t = f.read()
i = t.find('nn') # skip header
if 0 < i:
t = t[i:]
texts.append(t)
f.close()
labels.append(label_id)
print('Found %s texts.' % len(texts))
df=pd.DataFrame({'Text':texts,'Label':labels})
df['Text'] = df['Text'].apply(remove_quotations)
df['Text'] = df['Text'].apply(remove_html)
df = df.replace('n','', regex=True)
news = df['Text'].values
labels = df['Label'].values
#print(news)
#print(labels)
print("Tokenization.")
# Build a Keras Tokenizer that can encode every token
word_tokenizer = Tokenizer(num_words=MAX_VOC_SIZE)
word_tokenizer.fit_on_texts(news)
# Construct the input matrix. This should be a nd-array of
# shape (n_samples, MAX_SENT, MAX_WORDS_PER_SENT).
# We zero-pad this matrix (this does not influence
# any predictions due to the attention mechanism.
X = np.zeros((len(news), MAX_SENT, MAX_WORDS_PER_SENT), dtype='int32')
for i, review in enumerate(news):
sentences = sent_tokenize(review)
tokenized_sentences = word_tokenizer.texts_to_sequences(
sentences
)
tokenized_sentences = pad_sequences(
tokenized_sentences, maxlen=MAX_WORDS_PER_SENT
)
pad_size = MAX_SENT - tokenized_sentences.shape[0]
if pad_size < 0:
tokenized_sentences = tokenized_sentences[0:MAX_SENT]
else:
tokenized_sentences = np.pad(
tokenized_sentences, ((0,pad_size),(0,0)),
mode='constant', constant_values=0
)
# Store this observation as the i-th observation in
# the data matrix
X[i] = tokenized_sentences[None, ...]
# Transform the labels into a format Keras can handle
y = to_categorical(labels)
# We make a train/test split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=TEST_SPLIT)
embeddings = {}
with open('./embeddings(100).txt',encoding='utf-8') as file:
for line in file:
values = line.split()
word = values[0]
coefs = np.asarray(values[1:], dtype='float32')
embeddings[word] = coefs
# Initialize a matrix to hold the word embeddings
embedding_matrix = np.random.random(
(len(word_tokenizer.word_index) + 1, GLOVE_DIM)
)
embedding_matrix[0] = 0
for word, index in word_tokenizer.word_index.items():
embedding_vector = embeddings.get(word)
if embedding_vector is not None:
embedding_matrix[index] = embedding_vector
print("Training the model")
han_model = HAN(
MAX_WORDS_PER_SENT, MAX_SENT, 20, embedding_matrix,
word_encoding_dim=100, sentence_encoding_dim=100
)
han_model.summary()
checkpoint_saver = ModelCheckpoint(
filepath='./tmp/model.{epoch:02d}-{val_loss:.2f}.hdf5',
verbose=1, save_best_only=True
)
han_model.compile(
optimizer='adagrad', loss='categorical_crossentropy',
metrics=['acc']
)
han_model.fit(
X_train, y_train, batch_size=20, epochs=10,
validation_data=(X_test, y_test),
callbacks=[checkpoint_saver]
)
Here is the Stack trace:

keras nlp word-embeddings attention-mechanism
$endgroup$
$begingroup$
Provide your full error trace ...
$endgroup$
– Antonio Jurić
9 hours ago
$begingroup$
added stack trace
$endgroup$
– Shivam Singh
5 hours ago
add a comment |
$begingroup$
I am trying to use Hierarchical Attention Networks for classification of news articles using 20 newsgroup dataset that i downloaded from the internet. I came across this code of the implementation and tried using it on 20 newsgroup dataset as i was curious to see the results and couldn't hold back. Like he showed in the example i followed same steps and got the error
"ValueError: Operands could not be broadcast together with shapes (100, 200) (None, Elemwise{mul,no_inplace}.0)". I have never used keras,can anyone help me with what is wrong with the dimensions of the word encoding and sentence encoding.
import re
import numpy as np
import pandas as pd
import sys
import os
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.callbacks import ModelCheckpoint
from keras.utils import to_categorical
from nltk.tokenize import sent_tokenize
from sklearn.model_selection import train_test_split
from keras_han.model import HAN
MAX_WORDS_PER_SENT = 100
MAX_SENT = 15
MAX_VOC_SIZE = 20000
GLOVE_DIM = 100
TEST_SPLIT = 0.2
def remove_quotations(text):
text = re.sub(r"\", "", text)
text = re.sub(r"'", "", text)
text = re.sub(r""", "", text)
text = re.sub(r"[^A-Za-z0-9]+", " ", text)
return text
def remove_html(text):
tags_regex = re.compile(r'<.*?>')
return tags_regex.sub('', text)
print('Processing text dataset')
TEXT_DATA_DIR = "E:/Thesis/20news-bydate-test"
df = pd.DataFrame(columns=['Text','Labels'])
texts = # list of text samples
labels_index = {} # dictionary mapping label name to numeric id
labels = # list of label ids
for name in sorted(os.listdir(TEXT_DATA_DIR)):
path = os.path.join(TEXT_DATA_DIR, name)
if os.path.isdir(path):
label_id = len(labels_index)
labels_index[name] = label_id
for fname in sorted(os.listdir(path)):
if fname.isdigit():
fpath = os.path.join(path, fname)
if sys.version_info < (3,):
f = open(fpath)
else:
f = open(fpath, encoding='latin-1')
t = f.read()
i = t.find('nn') # skip header
if 0 < i:
t = t[i:]
texts.append(t)
f.close()
labels.append(label_id)
print('Found %s texts.' % len(texts))
df=pd.DataFrame({'Text':texts,'Label':labels})
df['Text'] = df['Text'].apply(remove_quotations)
df['Text'] = df['Text'].apply(remove_html)
df = df.replace('n','', regex=True)
news = df['Text'].values
labels = df['Label'].values
#print(news)
#print(labels)
print("Tokenization.")
# Build a Keras Tokenizer that can encode every token
word_tokenizer = Tokenizer(num_words=MAX_VOC_SIZE)
word_tokenizer.fit_on_texts(news)
# Construct the input matrix. This should be a nd-array of
# shape (n_samples, MAX_SENT, MAX_WORDS_PER_SENT).
# We zero-pad this matrix (this does not influence
# any predictions due to the attention mechanism.
X = np.zeros((len(news), MAX_SENT, MAX_WORDS_PER_SENT), dtype='int32')
for i, review in enumerate(news):
sentences = sent_tokenize(review)
tokenized_sentences = word_tokenizer.texts_to_sequences(
sentences
)
tokenized_sentences = pad_sequences(
tokenized_sentences, maxlen=MAX_WORDS_PER_SENT
)
pad_size = MAX_SENT - tokenized_sentences.shape[0]
if pad_size < 0:
tokenized_sentences = tokenized_sentences[0:MAX_SENT]
else:
tokenized_sentences = np.pad(
tokenized_sentences, ((0,pad_size),(0,0)),
mode='constant', constant_values=0
)
# Store this observation as the i-th observation in
# the data matrix
X[i] = tokenized_sentences[None, ...]
# Transform the labels into a format Keras can handle
y = to_categorical(labels)
# We make a train/test split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=TEST_SPLIT)
embeddings = {}
with open('./embeddings(100).txt',encoding='utf-8') as file:
for line in file:
values = line.split()
word = values[0]
coefs = np.asarray(values[1:], dtype='float32')
embeddings[word] = coefs
# Initialize a matrix to hold the word embeddings
embedding_matrix = np.random.random(
(len(word_tokenizer.word_index) + 1, GLOVE_DIM)
)
embedding_matrix[0] = 0
for word, index in word_tokenizer.word_index.items():
embedding_vector = embeddings.get(word)
if embedding_vector is not None:
embedding_matrix[index] = embedding_vector
print("Training the model")
han_model = HAN(
MAX_WORDS_PER_SENT, MAX_SENT, 20, embedding_matrix,
word_encoding_dim=100, sentence_encoding_dim=100
)
han_model.summary()
checkpoint_saver = ModelCheckpoint(
filepath='./tmp/model.{epoch:02d}-{val_loss:.2f}.hdf5',
verbose=1, save_best_only=True
)
han_model.compile(
optimizer='adagrad', loss='categorical_crossentropy',
metrics=['acc']
)
han_model.fit(
X_train, y_train, batch_size=20, epochs=10,
validation_data=(X_test, y_test),
callbacks=[checkpoint_saver]
)
Here is the Stack trace:

keras nlp word-embeddings attention-mechanism
$endgroup$
I am trying to use Hierarchical Attention Networks for classification of news articles using 20 newsgroup dataset that i downloaded from the internet. I came across this code of the implementation and tried using it on 20 newsgroup dataset as i was curious to see the results and couldn't hold back. Like he showed in the example i followed same steps and got the error
"ValueError: Operands could not be broadcast together with shapes (100, 200) (None, Elemwise{mul,no_inplace}.0)". I have never used keras,can anyone help me with what is wrong with the dimensions of the word encoding and sentence encoding.
import re
import numpy as np
import pandas as pd
import sys
import os
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.callbacks import ModelCheckpoint
from keras.utils import to_categorical
from nltk.tokenize import sent_tokenize
from sklearn.model_selection import train_test_split
from keras_han.model import HAN
MAX_WORDS_PER_SENT = 100
MAX_SENT = 15
MAX_VOC_SIZE = 20000
GLOVE_DIM = 100
TEST_SPLIT = 0.2
def remove_quotations(text):
text = re.sub(r"\", "", text)
text = re.sub(r"'", "", text)
text = re.sub(r""", "", text)
text = re.sub(r"[^A-Za-z0-9]+", " ", text)
return text
def remove_html(text):
tags_regex = re.compile(r'<.*?>')
return tags_regex.sub('', text)
print('Processing text dataset')
TEXT_DATA_DIR = "E:/Thesis/20news-bydate-test"
df = pd.DataFrame(columns=['Text','Labels'])
texts = # list of text samples
labels_index = {} # dictionary mapping label name to numeric id
labels = # list of label ids
for name in sorted(os.listdir(TEXT_DATA_DIR)):
path = os.path.join(TEXT_DATA_DIR, name)
if os.path.isdir(path):
label_id = len(labels_index)
labels_index[name] = label_id
for fname in sorted(os.listdir(path)):
if fname.isdigit():
fpath = os.path.join(path, fname)
if sys.version_info < (3,):
f = open(fpath)
else:
f = open(fpath, encoding='latin-1')
t = f.read()
i = t.find('nn') # skip header
if 0 < i:
t = t[i:]
texts.append(t)
f.close()
labels.append(label_id)
print('Found %s texts.' % len(texts))
df=pd.DataFrame({'Text':texts,'Label':labels})
df['Text'] = df['Text'].apply(remove_quotations)
df['Text'] = df['Text'].apply(remove_html)
df = df.replace('n','', regex=True)
news = df['Text'].values
labels = df['Label'].values
#print(news)
#print(labels)
print("Tokenization.")
# Build a Keras Tokenizer that can encode every token
word_tokenizer = Tokenizer(num_words=MAX_VOC_SIZE)
word_tokenizer.fit_on_texts(news)
# Construct the input matrix. This should be a nd-array of
# shape (n_samples, MAX_SENT, MAX_WORDS_PER_SENT).
# We zero-pad this matrix (this does not influence
# any predictions due to the attention mechanism.
X = np.zeros((len(news), MAX_SENT, MAX_WORDS_PER_SENT), dtype='int32')
for i, review in enumerate(news):
sentences = sent_tokenize(review)
tokenized_sentences = word_tokenizer.texts_to_sequences(
sentences
)
tokenized_sentences = pad_sequences(
tokenized_sentences, maxlen=MAX_WORDS_PER_SENT
)
pad_size = MAX_SENT - tokenized_sentences.shape[0]
if pad_size < 0:
tokenized_sentences = tokenized_sentences[0:MAX_SENT]
else:
tokenized_sentences = np.pad(
tokenized_sentences, ((0,pad_size),(0,0)),
mode='constant', constant_values=0
)
# Store this observation as the i-th observation in
# the data matrix
X[i] = tokenized_sentences[None, ...]
# Transform the labels into a format Keras can handle
y = to_categorical(labels)
# We make a train/test split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=TEST_SPLIT)
embeddings = {}
with open('./embeddings(100).txt',encoding='utf-8') as file:
for line in file:
values = line.split()
word = values[0]
coefs = np.asarray(values[1:], dtype='float32')
embeddings[word] = coefs
# Initialize a matrix to hold the word embeddings
embedding_matrix = np.random.random(
(len(word_tokenizer.word_index) + 1, GLOVE_DIM)
)
embedding_matrix[0] = 0
for word, index in word_tokenizer.word_index.items():
embedding_vector = embeddings.get(word)
if embedding_vector is not None:
embedding_matrix[index] = embedding_vector
print("Training the model")
han_model = HAN(
MAX_WORDS_PER_SENT, MAX_SENT, 20, embedding_matrix,
word_encoding_dim=100, sentence_encoding_dim=100
)
han_model.summary()
checkpoint_saver = ModelCheckpoint(
filepath='./tmp/model.{epoch:02d}-{val_loss:.2f}.hdf5',
verbose=1, save_best_only=True
)
han_model.compile(
optimizer='adagrad', loss='categorical_crossentropy',
metrics=['acc']
)
han_model.fit(
X_train, y_train, batch_size=20, epochs=10,
validation_data=(X_test, y_test),
callbacks=[checkpoint_saver]
)
Here is the Stack trace:

keras nlp word-embeddings attention-mechanism
keras nlp word-embeddings attention-mechanism
edited 5 hours ago
Shivam Singh
asked yesterday
Shivam SinghShivam Singh
133
133
$begingroup$
Provide your full error trace ...
$endgroup$
– Antonio Jurić
9 hours ago
$begingroup$
added stack trace
$endgroup$
– Shivam Singh
5 hours ago
add a comment |
$begingroup$
Provide your full error trace ...
$endgroup$
– Antonio Jurić
9 hours ago
$begingroup$
added stack trace
$endgroup$
– Shivam Singh
5 hours ago
$begingroup$
Provide your full error trace ...
$endgroup$
– Antonio Jurić
9 hours ago
$begingroup$
Provide your full error trace ...
$endgroup$
– Antonio Jurić
9 hours ago
$begingroup$
added stack trace
$endgroup$
– Shivam Singh
5 hours ago
$begingroup$
added stack trace
$endgroup$
– Shivam Singh
5 hours ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "557"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f45941%2fkeras-value-error-operands-could-not-be-broadcast-with-with-shapes100-100-g%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Data Science Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f45941%2fkeras-value-error-operands-could-not-be-broadcast-with-with-shapes100-100-g%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
Provide your full error trace ...
$endgroup$
– Antonio Jurić
9 hours ago
$begingroup$
added stack trace
$endgroup$
– Shivam Singh
5 hours ago