MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / from_dims

Method from_dims

src/framework/core/module.cpp:37–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35} // namespace
36
37TensorShape TensorShape::from_dims(std::initializer_list<int64_t> dims_init) {
38 TensorShape shape;
39 shape.rank = dims_init.size();
40 if (shape.rank == 0 || shape.rank > kMaxTensorRank) {
41 throw std::runtime_error("Tensor rank must be between 1 and 4");
42 }
43
44 size_t index = 0;
45 for (const int64_t dim : dims_init) {
46 shape.dims[index++] = dim;
47 }
48
49 ensure_positive_dims(shape);
50 return shape;
51}
52
53int64_t TensorShape::at(size_t index) const {
54 if (index >= rank) {

Callers

nothing calls this directly

Calls 2

ensure_positive_dimsFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected