I was working on tf.matmul op with multidimensional input arguments. For example given in code below,
import tensorflow as tf
import numpy as np
nn_arch = [100,1200]
batch_size = 128
n_ = np.random.normal(size=[batch_size,nn_arch[1],nn_arch[0]])
w_ = np.random.normal(size=[nn_arch[1],nn_arch[0]])
x_ = np.random.normal(size=[batch_size,nn_arch[0],1])
n = tf.constant(n_)
w = tf.constant(w_)
x = tf.constant(x_)
nw = n + w
c = tf.matmul(nw,x)
sess = tf.InteractiveSession()
c_ = np.zeros(shape=[batch_size,nn_arch[1],1])
for i in range(batch_size):
c_[i,:] = (n_[i,:,:] + w_).dot(x_[i,:,:])
print(sess.run(c)-c_)
print(np.max(np.abs(sess.run(c)-c_)))
This function will print the last line with value of the order of 1e-15. Why is there a this small amount of difference between two ops, that are basically doing same calculations at same precision float64?