MCPcopy Create free account
hub / github.com/ml-explore/mlx / depends

Function depends

mlx/ops.cpp:6069–6092  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6067}
6068
6069std::vector<array> depends(
6070 const std::vector<array>& inputs,
6071 const std::vector<array>& dependencies) {
6072 std::vector<array> all_inputs = inputs;
6073 all_inputs.insert(all_inputs.end(), dependencies.begin(), dependencies.end());
6074
6075 // Compute the stream. Maybe do it in a smarter way at some point in the
6076 // future.
6077 Stream s = (inputs[0].has_primitive()) ? inputs[0].primitive().stream()
6078 : to_stream({});
6079 // Make the output info
6080 std::vector<Shape> shapes;
6081 std::vector<Dtype> dtypes;
6082 for (const auto& in : inputs) {
6083 shapes.emplace_back(in.shape());
6084 dtypes.emplace_back(in.dtype());
6085 }
6086
6087 return array::make_arrays(
6088 std::move(shapes),
6089 dtypes,
6090 std::make_shared<Depends>(to_stream(s)),
6091 all_inputs);
6092}
6093
6094array atleast_1d(const array& a, StreamOrDevice s /* = {} */) {
6095 if (a.ndim() == 0) {

Callers 2

init_opsFunction · 0.85
checkpointFunction · 0.85

Calls 5

to_streamFunction · 0.85
emplace_backMethod · 0.80
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected