MCPcopy Create free account
hub / github.com/apple/coremltools / intersect

Method intersect

mlmodel/src/LayerShapeConstraints.cpp:490–514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

488 }
489}
490ShapeRange ShapeRange::intersect(const ShapeRange& other) const {
491
492 // These routines will throw if it's invalid (i.e. max < min)
493 ShapeRange out;
494 if (_minimum <= other.minimum())
495 out.setLower(other.minimum());
496 else {
497 out.setLower(_minimum);
498 }
499
500 if (_maximum >= other.maximum())
501 out.setUpper(other.maximum());
502 else {
503 out.setUpper(_maximum);
504 }
505
506 if (_minimum > _maximum || _minimum.isUnbound()) {
507 std::stringstream ss;
508 ss << "Invalid intersection between " << *this << " and " << other;
509 throw std::runtime_error(ss.str());
510 }
511
512 return out;
513
514}
515
516ShapeRange ShapeRange::unify(const ShapeRange& other) const {
517 ShapeRange out;

Callers 15

updateSequenceRangeMethod · 0.80
updateBatchRangeMethod · 0.80
updateChannelRangeMethod · 0.80
updateHeightRangeMethod · 0.80
updateWidthRangeMethod · 0.80
copyFromMethod · 0.80
copyFromNoBatchSeqMethod · 0.80
upperBoundSequenceMethod · 0.80
upperBoundBatchMethod · 0.80
upperBoundChannelMethod · 0.80
upperBoundHeightMethod · 0.80
upperBoundWidthMethod · 0.80

Calls 6

minimumMethod · 0.80
setLowerMethod · 0.80
maximumMethod · 0.80
setUpperMethod · 0.80
isUnboundMethod · 0.80
strMethod · 0.45

Tested by 1

testShapeRangeFunction · 0.64