本文整理匯總了Python中nervanagpu.NervanaGPU.finite方法的典型用法代碼示例。如果您正苦於以下問題:Python NervanaGPU.finite方法的具體用法?Python NervanaGPU.finite怎麽用?Python NervanaGPU.finite使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nervanagpu.NervanaGPU
的用法示例。
在下文中一共展示了NervanaGPU.finite方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: in
# 需要導入模塊: from nervanagpu import NervanaGPU [as 別名]
# 或者: from nervanagpu.NervanaGPU import finite [as 別名]
if op[1] == 't': devB1, devB2 = devB1.T, devB2.T
for tile in (32,64,128):
if op == 'nt' and tile != 128:
continue
try:
ng.dot(devA1, devB1, devC1, alpha=alpha, beta=beta, size=tile)
context.synchronize()
cublas_dot(devA2, devB2, devC2, alpha=alpha, beta=beta)
partial1 = ng.empty((devC1.shape[0],1), dtype=np.float32)
partial2 = partial1[0:1,0:1]
if ng.min(ng.finite(devC1), partial=partial1, out=partial2).get()[0,0] == 0.0:
print("Error: NaN KCN: (%d,%d,%d) ab: (%f,%f) dtype: %d" %
(K,C,N, alpha,beta, itemsize))
exit()
diff = ng.max(abs(devC2 - devC1), partial=partial1, out=partial2).get()[0,0]
mean = ng.mean(abs(devC2), partial=partial1, out=partial2).get()[0,0]
pctErr = 100 * diff / mean
if pctErr > maxerr:
print("Error: %.3f%% diff: %.5f mean %.5f op: %s tile: %d KCN: (%d,%d,%d) ab: (%f,%f) dtype: %d" %
(pctErr, diff, mean, op, tile, K,C,N, alpha,beta, itemsize))
exit()
except drv.Error as e:
print("op: %s tile: %d KCN: (%d,%d,%d) ab: (%f,%f) dtype: %d" %