本文整理汇总了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__)