def _broadcast(x, dims): etype = ir.RankedTensorType(x.type).element_type return mhlo.BroadcastOp(ir.RankedTensorType(dims, etype), x, mlir.dense_int_elements(dims))
def full_like_aval(value, aval: core.ShapedArray) -> ir.Value: """Returns an IR constant shaped full of `value` shaped like `aval`.""" zero = ir_constant(np.array(value, aval.dtype)) return mhlo.BroadcastOp(aval_to_ir_type(aval), zero, dense_int_elements(aval.shape)).result
def _broadcast(x, dims): return mhlo.BroadcastOp(x, mlir.dense_int_elements(dims))