| 6 | #include <stdexcept> |
| 7 | |
| 8 | void compute_transpose_node(GraphNode& node, const std::vector<std::unique_ptr<GraphNode>>& nodes, const std::unordered_map<size_t, size_t>& node_index_map) { |
| 9 | if (node.params.backend == ComputeBackend::NPU) { |
| 10 | throw std::runtime_error("NPU transpose operation not yet implemented"); |
| 11 | } |
| 12 | |
| 13 | const auto& input_buffer = get_input(node, 0, nodes, node_index_map); |
| 14 | |
| 15 | if (input_buffer.precision != Precision::FP16) { |
| 16 | throw std::runtime_error("Transpose only supports FP16 precision"); |
| 17 | } |
| 18 | |
| 19 | const auto& permutation = node.params.permutation; |
| 20 | |
| 21 | const __fp16* input = input_buffer.data_as<__fp16>(); |
| 22 | __fp16* output = node.output_buffer.data_as<__fp16>(); |
| 23 | cactus_transpose_f16(input, output, input_buffer.shape.data(), permutation.data(), permutation.size(), 0, input_buffer.total_size); |
| 24 | } |
| 25 | |
| 26 | void compute_gather_node(GraphNode& node, const std::vector<std::unique_ptr<GraphNode>>& nodes, const std::unordered_map<size_t, size_t>& node_index_map) { |
| 27 | const auto& tensor_buffer = get_input(node, 0, nodes, node_index_map); |
nothing calls this directly
no test coverage detected