mirror of
https://github.com/ml-explore/mlx.git
synced 2025-10-19 08:38:09 +08:00
Add tile op (#438)
This commit is contained in:
@@ -3394,4 +3394,30 @@ void init_ops(py::module_& m) {
|
||||
Returns:
|
||||
result (array): The outer product.
|
||||
)pbdoc");
|
||||
m.def(
|
||||
"tile",
|
||||
[](const array& a, const IntOrVec& reps, StreamOrDevice s) {
|
||||
if (auto pv = std::get_if<int>(&reps); pv) {
|
||||
return tile(a, {*pv}, s);
|
||||
} else {
|
||||
return tile(a, std::get<std::vector<int>>(reps), s);
|
||||
}
|
||||
},
|
||||
"a"_a,
|
||||
"reps"_a,
|
||||
py::pos_only(),
|
||||
py::kw_only(),
|
||||
"stream"_a = none,
|
||||
R"pbdoc(
|
||||
tile(a: array, reps: Union[int, List[int]], /, *, stream: Union[None, Stream, Device] = None) -> array
|
||||
|
||||
Construct an array by repeating ``a`` the number of times given by ``reps``.
|
||||
|
||||
Args:
|
||||
a (array): Input array
|
||||
reps (int or list(int)): The number of times to repeat ``a`` along each axis.
|
||||
|
||||
Returns:
|
||||
result (array): The tiled array.
|
||||
)pbdoc");
|
||||
}
|
||||
|
Reference in New Issue
Block a user