'nonetype' Object Has No Attribute '_inbound_nodes' Error
I have to take the output of last conv layer of EfficientNet and then calculate H = wT*x+b. My w is [49,49]. After that I have to apply softmax on H and then do elementwise multipl
Solution 1:
I have replaced the operations with a Lambda
layer in the following code. Please excuse my shabby naming. Give this code a try.
W = tf.Variable(tf.random_normal([49,49], seed=0), name='weight')
b = tf.Variable(tf.random_normal([49], seed=0), name='bias')
def all_operations(args):
x = args[0]
H = args[1]
x = tf.reshape(x, [-1, 7*7,1280])
H = tf.matmul(W, x, transpose_a=True)
H = tf.nn.softmax(H)
x = tf.multiply(H, x)
x = tf.reshape(x, [-1, 49*1280])
return x
common_input = layers.Input(shape=(224, 224, 3))
x=model0(common_input) #model0 terminate with last conv layer of EfficientNet (7,7,1280)
x = layers.BatchNormalization()(x)
x = Lambda(all_operations)([x, H])
p=layers.Dense(768, activation="relu")(x)
p=layers.Dense(8, activation="softmax", name="fc_out")(p)
model = Model(inputs=common_input, outputs=p)
Post a Comment for "'nonetype' Object Has No Attribute '_inbound_nodes' Error"