| 377 | } |
| 378 | |
| 379 | core::TensorValue graph_linear( |
| 380 | core::ModuleBuildContext & ctx, |
| 381 | const core::TensorValue & input, |
| 382 | const std::unordered_map<std::string, Param> & params, |
| 383 | const std::string & prefix, |
| 384 | int64_t out_features) { |
| 385 | const std::string weight_name = prefix + ".weight"; |
| 386 | const std::string bias_name = prefix + ".bias"; |
| 387 | const auto & weight = require_param(params, weight_name); |
| 388 | const auto & bias = require_param(params, bias_name); |
| 389 | return modules::LinearModule({input.shape.last_dim(), out_features, true}).build( |
| 390 | ctx, |
| 391 | input, |
| 392 | modules::LinearWeights{graph_param(weight), graph_param(bias)}); |
| 393 | } |
| 394 | |
| 395 | core::TensorValue graph_add(core::ModuleBuildContext & ctx, const core::TensorValue & lhs, const core::TensorValue & rhs) { |
| 396 | return modules::AddModule().build(ctx, lhs, rhs); |
no test coverage detected