from timeit import default_timer as timer
import os
print('import pytorch')
start = timer()
import torch
end = timer()
print('Elapsed time: ' + str(end - start))
print('import tensorflow')
start = timer()
import tensorflow
end = timer()
print('Elapsed time: ' + str(end - start))
输出
import pytorch
Elapsed time: 0.46338812075555325
import tensorflow
Elapsed time: 4.396180961281061
回想起HanLP1.x时代为了加速模型加载连毫秒都要优化,现在我觉得非常失望。