I want to use a two path CNN for image processing. I want to concatenate both models after a flatten layer. When I calculate the difference between the elements of the two flatten layer, I want to delete the elements that are equal. I am encountering this error:
TypeError: Tensor objects are only iterable when eager execution is enabled. To iterate over this tensor use tf.map_fn.
Code:
def concatentate_flatten_inputs(finput1, finput2):
flatten_diff = tf.subtract(finput1, finput2)
value = 0
wh = K.tf.where(K.tf.equal(flatten_diff, value))
for ele in wh:
finput1.remove(ele)
con_feats = Concatenate()([finput1, finput2])
print(tf.shape(con_feats))
dense = Dense(256, activation="relu")(con_feats)
dense = Dropout(0.5)(dense)
dense = Dense(256, activation="relu")(dense)
dense = Dropout(0.5)(dense)
dense = Dense(1)(dense)
output = Activation("sigmoid")(dense)
return output