assert engine in (‘caffe’, ‘pytorch’), f’CNNScorer for engine {engine} is not currently supported’
^
SyntaxError: invalid syntax
错误代码位置:
assert engine in ('caffe', 'pytorch'), f'CNNScorer for engine {engine} is not currently supported'
错误原因:
python版本问题,python 3.6之后的版本可以用f’ ‘或f" "进行字符串格式化,而之前的版本可以用’{ }’.format( )进行字符串格式化。
问题解决:
将报错位置的代码改为如下形式:
assert engine in ('caffe', 'pytorch'), 'CNNScorer for {} is not currently supported'.format(engine)
便不再报错。