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

Function tensor_shape_from_vector

src/framework/audio/zipenhancer.cpp:67–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67core::TensorShape tensor_shape_from_vector(const std::vector<int64_t> & shape) {
68 if (shape.empty()) {
69 return core::TensorShape::from_dims({1});
70 }
71 if (shape.size() == 1) {
72 return core::TensorShape::from_dims({shape[0]});
73 }
74 if (shape.size() == 2) {
75 return core::TensorShape::from_dims({shape[0], shape[1]});
76 }
77 if (shape.size() == 3) {
78 return core::TensorShape::from_dims({shape[0], shape[1], shape[2]});
79 }
80 if (shape.size() == 4) {
81 return core::TensorShape::from_dims({shape[0], shape[1], shape[2], shape[3]});
82 }
83 throw std::runtime_error("ZipEnhancer tensor rank exceeds GGML wrapper rank");
84}
85
86struct Param {
87 std::vector<int64_t> shape;

Callers 2

load_from_directoryMethod · 0.70

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected