Why tf.tensordot() is slow

Hi all, I am a newbie to TensorFlow and have a quite naive question. It seems that tf.tensordot is much slower than np.dot. For example

a = tf.Variable( tf.random.uniform( (8, 1) ) )
b = tf.Variable( tf.random.uniform( (8, 1) ) )
for i in range(10000):
   c = tf.tensordot( a, b, axes=1 )

takes 2.2 seconds to finish, but

a = np.random.randn( (8,1) )
b =  np.random.randn( (8,1) )
for i in range(10000):
   c = np.dot(a, b)

takes only 0.01 seconds. I think the reason is that TensorFlow is constructing the computation graph in each iteration when tf.Variable is used. Is there any documentation where I can learn what is being done with the tf.Variable and understand what kind of operations create the overhead?

Hi @fangh, Generally Numpy is highly optimized for numerical operations so that dot operation using numpy is faster compared to tensorflow. Please refer to this document to know more about variables in tensorflow. Thank You.