| 437 | } |
| 438 | |
| 439 | void InferenceContext::Relax(DimensionHandle d_old, DimensionHandle d_new, |
| 440 | DimensionHandle* out) { |
| 441 | if (d_old.SameHandle(d_new)) { |
| 442 | *out = d_old; |
| 443 | } else if (!ValueKnown(d_old) && !ValueKnown(d_new)) { |
| 444 | // The node will be fed by the dimension d_new instead of d_old: any |
| 445 | // equality assertion between d_old and other input dimension on this node |
| 446 | // may not be true anymore, so forget them all. |
| 447 | ForgetMerges(); |
| 448 | // Return the new shape handle to force the relaxation to propagate to the |
| 449 | // fanout of the context. |
| 450 | *out = d_new; |
| 451 | } else if (!ValueKnown(d_new)) { |
| 452 | ForgetMerges(); |
| 453 | *out = d_new; |
| 454 | } else if (Value(d_old) == Value(d_new)) { |
| 455 | // Return the old shape handle. This will stop the relaxation in the fanout |
| 456 | // of the context. |
| 457 | *out = d_old; |
| 458 | } else { |
| 459 | // Return a new handle that encodes a different unknown dim. |
| 460 | ForgetMerges(); |
| 461 | *out = UnknownDim(); |
| 462 | } |
| 463 | } |
| 464 | |
| 465 | Status InferenceContext::Merge(DimensionHandle d0, DimensionHandle d1, |
| 466 | DimensionHandle* out) { |
nothing calls this directly
no test coverage detected