| 6067 | } |
| 6068 | |
| 6069 | std::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 | |
| 6094 | array atleast_1d(const array& a, StreamOrDevice s /* = {} */) { |
| 6095 | if (a.ndim() == 0) { |
no test coverage detected