def version(raises=True):
"""
Return the current cuDNN version we link with.
This also does a check that the header version matches the runtime version.
:raises: If True, raise an exception if cuDNN is not present or badly installed.
Otherwise, return -1.
"""
if not dnn_present():
if raises:
raise Exception(
"We can't determine the cudnn version as it is not available",
dnn_available.msg)
else:
return -1
if version.v is None:
f = theano.function([], DnnVersion()(),
theano.Mode(optimizer=None),
profile=False)
v = f()
if v[0] != v[1]:
raise RuntimeError("Mixed dnn version. The header is version %s "
"while the library is version %s." % v)
version.v = v[1]
return version.v
评论列表
文章目录