testing GEMM
This commit is contained in:
@@ -9,7 +9,7 @@ library_dir = os.path.dirname(os.path.realpath(__file__))
|
|||||||
module = tf.load_op_library(os.path.join(library_dir, 'libtf_blocksparse.so'))
|
module = tf.load_op_library(os.path.join(library_dir, 'libtf_blocksparse.so'))
|
||||||
|
|
||||||
def run_dot():
|
def run_dot():
|
||||||
M, N, K = 8192, 8192, 8192
|
M, N, K = 128, 128, 128
|
||||||
a = tf.placeholder(tf.float16, shape=[M, K])
|
a = tf.placeholder(tf.float16, shape=[M, K])
|
||||||
b = tf.placeholder(tf.float16, shape=[N, K])
|
b = tf.placeholder(tf.float16, shape=[N, K])
|
||||||
# c = tf.matmul(a, b, transpose_a=True)
|
# c = tf.matmul(a, b, transpose_a=True)
|
||||||
@@ -23,9 +23,11 @@ def run_dot():
|
|||||||
result = sess.run([c], feed_dict = {a: ha,
|
result = sess.run([c], feed_dict = {a: ha,
|
||||||
b: hb})[0]
|
b: hb})[0]
|
||||||
# Test
|
# Test
|
||||||
#hresult = np.dot(ha.T, hb).T
|
hresult = np.dot(ha.T, hb).T
|
||||||
#dif = np.abs(result - hresult)
|
dif = np.abs(result - hresult)
|
||||||
#print("dif: %f" % np.max(dif))
|
print(hresult)
|
||||||
|
print(result)
|
||||||
|
print("dif: %f" % np.max(dif))
|
||||||
|
|
||||||
def run_conv():
|
def run_conv():
|
||||||
B, C, H, W = 16, 32, 32, 32
|
B, C, H, W = 16, 32, 32, 32
|
||||||
@@ -128,6 +130,6 @@ def run_batchnorm():
|
|||||||
print(np.max(np.abs(dg_t - dg_n)))
|
print(np.max(np.abs(dg_t - dg_n)))
|
||||||
print(np.max(np.abs(db_t - db_n)))
|
print(np.max(np.abs(db_t - db_n)))
|
||||||
|
|
||||||
#run_dot()
|
run_dot()
|
||||||
run_shift()
|
#run_shift()
|
||||||
#run_batchnorm()
|
#run_batchnorm()
|
||||||
|
Reference in New Issue
Block a user