MCPcopy Create free account
hub / github.com/cactus-compute/cactus / compute_transpose_node

Function compute_transpose_node

cactus/graph/graph_ops_tensor.cpp:8–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include <stdexcept>
7
8void 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
26void 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);

Callers

nothing calls this directly

Calls 3

cactus_transpose_f16Function · 0.85
dataMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected