本文整理匯總了Python中mxnet.__file__方法的典型用法代碼示例。如果您正苦於以下問題:Python mxnet.__file__方法的具體用法?Python mxnet.__file__怎麽用?Python mxnet.__file__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mxnet
的用法示例。
在下文中一共展示了mxnet.__file__方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: check_mxnet
# 需要導入模塊: import mxnet [as 別名]
# 或者: from mxnet import __file__ [as 別名]
def check_mxnet():
print('----------MXNet Info-----------')
try:
import mxnet
print('Version :', mxnet.__version__)
mx_dir = os.path.dirname(mxnet.__file__)
print('Directory :', mx_dir)
commit_hash = os.path.join(mx_dir, 'COMMIT_HASH')
with open(commit_hash, 'r') as f:
ch = f.read().strip()
print('Commit Hash :', ch)
except ImportError:
print('No MXNet installed.')
except IOError:
print('Hashtag not found. Not installed from pre-built package.')
except Exception as e:
import traceback
if not isinstance(e, IOError):
print("An error occured trying to import mxnet.")
print("This is very likely due to missing missing or incompatible library files.")
print(traceback.format_exc())
示例2: get_im2rec_path
# 需要導入模塊: import mxnet [as 別名]
# 或者: from mxnet import __file__ [as 別名]
def get_im2rec_path(home_env="MXNET_HOME"):
"""Get path to the im2rec.py tool
Parameters
----------
home_env : str
Env variable that holds the path to the MXNET folder
Returns
-------
str
The path to im2rec.py
"""
# Check first if the path to MXNET is passed as an env variable
if home_env in os.environ:
mxnet_path = os.environ[home_env]
else:
# Else use currently imported mxnet as reference
mxnet_path = os.path.dirname(mx.__file__)
# If MXNet was installed through pip, the location of im2rec.py
im2rec_path = os.path.join(mxnet_path, 'tools', 'im2rec.py')
if os.path.isfile(im2rec_path):
return im2rec_path
# If MXNet has been built locally
im2rec_path = os.path.join(mxnet_path, '..', '..', 'tools', 'im2rec.py')
if os.path.isfile(im2rec_path):
return im2rec_path
raise IOError('Could not find path to tools/im2rec.py')
示例3: check_pip
# 需要導入模塊: import mxnet [as 別名]
# 或者: from mxnet import __file__ [as 別名]
def check_pip():
print('------------Pip Info-----------')
try:
import pip
print('Version :', pip.__version__)
print('Directory :', os.path.dirname(pip.__file__))
except ImportError:
print('No corresponding pip install for current python.')
示例4: log_sockeye_version
# 需要導入模塊: import mxnet [as 別名]
# 或者: from mxnet import __file__ [as 別名]
def log_sockeye_version(logger):
from sockeye import __version__, __file__
try:
from sockeye.git_version import git_hash
except ImportError:
git_hash = "unknown"
logger.info("Sockeye version %s, commit %s, path %s", __version__, git_hash, __file__)
示例5: log_mxnet_version
# 需要導入模塊: import mxnet [as 別名]
# 或者: from mxnet import __file__ [as 別名]
def log_mxnet_version(logger):
from mxnet import __version__, __file__
logger.info("MXNet version %s, path %s", __version__, __file__)