| 649 | /// clang-format on |
| 650 | |
| 651 | af::dim4 broadcastOut(dim4 lhs, dim4 rhs) { |
| 652 | dim4 out(1); |
| 653 | for (int i = 0; i < AF_MAX_DIMS; i++) { |
| 654 | if (lhs[i] == rhs[i]) |
| 655 | out[i] = lhs[i]; |
| 656 | else if (lhs[i] == 1 && rhs[i] > 1) |
| 657 | out[i] = rhs[i]; |
| 658 | else if (lhs[i] > 1 && rhs[i] == 1) |
| 659 | out[i] = lhs[i]; |
| 660 | else { |
| 661 | std::cout << "incorrect dimension" << lhs << " op " << rhs; |
| 662 | return dim4(0); |
| 663 | } |
| 664 | } |
| 665 | return out; |
| 666 | } |
| 667 | |
| 668 | af::dim4 tileRepeations(dim4 in, dim4 other) { |
| 669 | af::dim4 out; |