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

Function compute_bilstm_sequence_node

cactus/graph/graph_ops_nn.cpp:2177–2202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2175}
2176
2177void compute_bilstm_sequence_node(GraphNode& node, const std::vector<std::unique_ptr<GraphNode>>& nodes,
2178 const std::unordered_map<size_t, size_t>& node_index_map) {
2179 const auto& input = get_input(node, 0, nodes, node_index_map);
2180 const auto& w_ih_fwd = get_input(node, 1, nodes, node_index_map);
2181 const auto& w_hh_fwd = get_input(node, 2, nodes, node_index_map);
2182 const auto& b_ih_fwd = get_input(node, 3, nodes, node_index_map);
2183 const auto& b_hh_fwd = get_input(node, 4, nodes, node_index_map);
2184 const auto& w_ih_bwd = get_input(node, 5, nodes, node_index_map);
2185 const auto& w_hh_bwd = get_input(node, 6, nodes, node_index_map);
2186 const auto& b_ih_bwd = get_input(node, 7, nodes, node_index_map);
2187 const auto& b_hh_bwd = get_input(node, 8, nodes, node_index_map);
2188
2189 size_t batch_size = input.shape[0];
2190 size_t seq_len = input.shape[1];
2191 size_t input_size = input.shape[2];
2192 size_t hidden_size = w_ih_fwd.shape[0] / 4;
2193
2194 cactus_bilstm_sequence_f16(
2195 input.data_as<__fp16>(),
2196 w_ih_fwd.data_as<__fp16>(), w_hh_fwd.data_as<__fp16>(),
2197 b_ih_fwd.data_as<__fp16>(), b_hh_fwd.data_as<__fp16>(),
2198 w_ih_bwd.data_as<__fp16>(), w_hh_bwd.data_as<__fp16>(),
2199 b_ih_bwd.data_as<__fp16>(), b_hh_bwd.data_as<__fp16>(),
2200 node.output_buffer.data_as<__fp16>(),
2201 batch_size, seq_len, input_size, hidden_size);
2202}
2203
2204void compute_maxpool1d_node(GraphNode& node, const std::vector<std::unique_ptr<GraphNode>>& nodes,
2205 const std::unordered_map<size_t, size_t>& node_index_map) {

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected