| 750 | } |
| 751 | |
| 752 | core::TensorValue graph_upsample_slice( |
| 753 | core::ModuleBuildContext & ctx, |
| 754 | const core::TensorValue & input, |
| 755 | int64_t factor, |
| 756 | int64_t target) { |
| 757 | std::vector<core::TensorValue> pieces; |
| 758 | pieces.reserve(static_cast<size_t>(input.shape.dims[0] * factor)); |
| 759 | for (int64_t s = 0; s < input.shape.dims[0]; ++s) { |
| 760 | auto slice = modules::SliceModule({0, s, 1}).build(ctx, input); |
| 761 | for (int64_t k = 0; k < factor; ++k) { |
| 762 | pieces.push_back(slice); |
| 763 | } |
| 764 | } |
| 765 | auto out = graph_concat_all(ctx, pieces, 0); |
| 766 | if (out.shape.dims[0] != target) { |
| 767 | out = modules::SliceModule({0, 0, target}).build(ctx, out); |
| 768 | } |
| 769 | return out; |
| 770 | } |
| 771 | |
| 772 | core::TensorValue graph_run_dual_encoder( |
| 773 | core::ModuleBuildContext & ctx, |
no test coverage detected