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

Method make_arrays

mlx/array.cpp:42–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42std::vector<array> array::make_arrays(
43 std::vector<Shape> shapes,
44 const std::vector<Dtype>& dtypes,
45 const std::shared_ptr<Primitive>& primitive,
46 const std::vector<array>& inputs) {
47 std::vector<array> outputs;
48 for (size_t i = 0; i < shapes.size(); ++i) {
49 outputs.emplace_back(std::move(shapes[i]), dtypes[i], primitive, inputs);
50 }
51 // For each node in |outputs|, its siblings are the other nodes.
52 for (size_t i = 0; i < outputs.size(); ++i) {
53 auto siblings = outputs;
54 siblings.erase(siblings.begin() + i);
55 outputs[i].set_siblings(std::move(siblings), i);
56 }
57 return outputs;
58}
59
60array array::unsafe_weak_copy(const array& other) {
61 auto cpy = array(other.shape(), other.dtype(), nullptr, {});

Callers

nothing calls this directly

Calls 4

emplace_backMethod · 0.80
sizeMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected