How to resolved indentationError: unexpected indent?
How to resolved indentationError: unexpected indent?
如何纠正 python 中的这个错误 "unexpected indent"?
from fast_rcnn.config import cfg
from nms.cpu_nms import cpu_nms
def nms(dets, thresh, force_cpu=False):
"""Dispatch to either CPU or GPU NMS implementations."""
if (dets.shape[0]) == 0:
return []
return cpu_nms(dets, thresh)
假设这不是复制到 SE 时的复制和粘贴错误,您需要更改第一个缩进 return:
from fast_rcnn.config import cfg
from nms.cpu_nms import cpu_nms
def nms(dets, thresh, force_cpu=False):
"""Dispatch to either CPU or GPU NMS implementations."""
if (dets.shape[0]) == 0:
# Note the changed indentation here
return []
return cpu_nms(dets, thresh)
如何纠正 python 中的这个错误 "unexpected indent"?
from fast_rcnn.config import cfg
from nms.cpu_nms import cpu_nms
def nms(dets, thresh, force_cpu=False):
"""Dispatch to either CPU or GPU NMS implementations."""
if (dets.shape[0]) == 0:
return []
return cpu_nms(dets, thresh)
假设这不是复制到 SE 时的复制和粘贴错误,您需要更改第一个缩进 return:
from fast_rcnn.config import cfg
from nms.cpu_nms import cpu_nms
def nms(dets, thresh, force_cpu=False):
"""Dispatch to either CPU or GPU NMS implementations."""
if (dets.shape[0]) == 0:
# Note the changed indentation here
return []
return cpu_nms(dets, thresh)