(t1: Type, t2: Type)
| 27 | } |
| 28 | |
| 29 | fn broadcast_pair(t1: Type, t2: Type) -> Result<Type> { |
| 30 | if t1.get_scalar_type() != t2.get_scalar_type() { |
| 31 | return Err(runtime_error!("Scalar types mismatch: {t1:?} and {t2:?}")); |
| 32 | } |
| 33 | if t1.is_scalar() { |
| 34 | return Ok(t2); |
| 35 | } |
| 36 | if t2.is_scalar() { |
| 37 | return Ok(t1); |
| 38 | } |
| 39 | let scalar_type = t1.get_scalar_type(); |
| 40 | Ok(array_type( |
| 41 | broadcast_shapes(t1.get_shape(), t2.get_shape())?, |
| 42 | scalar_type, |
| 43 | )) |
| 44 | } |
| 45 | |
| 46 | pub(super) fn broadcast_arrays(element_types: Vec<Type>) -> Result<Type> { |
| 47 | if element_types.is_empty() { |
no test coverage detected