测试GPU计算能力+TensorFlow

# -*- coding: utf-8 -*-
"""

测试NVIDIA cuda。
"""

import tensorflow as tf
import numpy as np
import time

value = np.random.randn(5000,1000)
a = tf.constant(value)

b = a*a

tic = time.time()
with tf.Session() as sess:
    for i in range(1000):
        sess.run(b)
toc = time.time()
t_cost = toc - tic

print(t_cost)

猜你喜欢

转载自blog.csdn.net/aaa_aaa1sdf/article/details/81294408
今日推荐