| 82 | } |
| 83 | const std::string weight_v_name = source.has_tensor(prefix + ".weight_v") |
| 84 | ? prefix + ".weight_v" |
| 85 | : prefix + ".parametrizations.weight.original1"; |
| 86 | const std::string weight_g_name = source.has_tensor(prefix + ".weight_g") |
| 87 | ? prefix + ".weight_g" |
| 88 | : prefix + ".parametrizations.weight.original0"; |
| 89 | |
| 90 | std::vector<int64_t> weight_shape; |
| 91 | weight_shape.reserve(shape.rank); |
| 92 | int64_t inner_size = 1; |
| 93 | for (size_t dim = 0; dim < shape.rank; ++dim) { |
| 94 | if (shape.dims[dim] <= 0) { |
| 95 | throw std::runtime_error(prefix + " weight-norm tensor shape contains non-positive dimension"); |
| 96 | } |