添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

so there is this piece of code I am trying to understand:

rois, target_class_ids, target_bbox, target_mask =\
                DetectionTargetLayer(config, name="proposal_targets")([
                    target_rois, input_gt_class_ids, gt_boxes, input_gt_masks])

DetectionTargetLayer is a Keras subclass layer. So what does the operator =\ mean? Is it just the same as '='?

That's not an operator. That's an equals sign with a line continuation. The next line is appended to the end. – Tim Roberts Nov 12, 2021 at 0:21 This code is a bit misleading because the slash in =\ is actually not related to equal sign at all (and could be any distance from it). It's the line continuation character. – 0x263A Nov 12, 2021 at 0:22

\ is not used as an operator, instead, it is used as an equals sign with a line continuation.

I see where you are confused, the code isn't really clear.

=\ is actually not related to equal sign at all.

This code:

rois, target_class_ids, target_bbox, target_mask =\
                DetectionTargetLayer(config, name="proposal_targets")([
                    target_rois, input_gt_class_ids, gt_boxes, input_gt_masks])

is IDENTICAL to this code:

rois, target_class_ids, target_bbox, target_mask = DetectionTargetLayer(config, name="proposal_targets")([target_rois, input_gt_class_ids, gt_boxes, input_gt_masks])

Because, as others have said, like in C, Bash, and many other languages, \ at the end of a line tells the Python interpreter to treat the next line as the same line, and ignore the \.

This question talks in detail about the usage of the line-continuation token in Python.