def f(x): x = -x with exclude_from_trace(): if i % 2: x = -x x = -x return x
def f(boxes, scores): # with tracing, max_output must be specified results = F.nn.nms(boxes, scores=scores, iou_thresh=0.5, max_output=20) # without tracing, max output can be inferred inside nms with exclude_from_trace(): _ = F.nn.nms(boxes, scores=scores, iou_thresh=0.5) return results
def f(x): neg = ops.Elemwise(Elemwise.Mode.NEGATE) (x, ) = apply(neg, x) with exclude_from_trace(): if i % 2: (x, ) = apply(neg, x) (x, ) = apply(neg, x) return x
def f(x): neg = ops.Elemwise(mode="negate") (x, ) = apply(neg, x) with exclude_from_trace(): if i % 2: (x, ) = apply(neg, x) (x, ) = apply(neg, x) return x
def f(boxes, scores): results = F.nn.nms(boxes, scores=scores, iou_thresh=0.5, max_output=20) with exclude_from_trace(): _ = F.nn.nms(boxes, scores=scores, iou_thresh=0.5) return results