Emit a simple ONNX node (individual string interface) Avoids gfortran array constructor issues
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | op_type |
ONNX operation type, node name, output name, and attribute JSON |
||
| character(len=*), | intent(in) | :: | name |
ONNX operation type, node name, output name, and attribute JSON |
||
| character(len=*), | intent(in) | :: | out1 |
ONNX operation type, node name, output name, and attribute JSON |
||
| character(len=*), | intent(in) | :: | attr_json |
ONNX operation type, node name, output name, and attribute JSON |
||
| type(onnx_node_type), | intent(inout), | dimension(:) | :: | nodes |
Node accumulator array |
|
| integer, | intent(inout) | :: | num_nodes |
Current number of populated nodes |
||
| character(len=*), | intent(in), | optional | :: | in1 |
Optional input tensor names |
|
| character(len=*), | intent(in), | optional | :: | in2 |
Optional input tensor names |
|
| character(len=*), | intent(in), | optional | :: | in3 |
Optional input tensor names |
subroutine emit_node(op_type, name, out1, attr_json, nodes, num_nodes, & in1, in2, in3) !! Emit a simple ONNX node (individual string interface) !! Avoids gfortran array constructor issues implicit none ! Arguments character(*), intent(in) :: op_type, name, out1, attr_json !! ONNX operation type, node name, output name, and attribute JSON type(onnx_node_type), intent(inout), dimension(:) :: nodes !! Node accumulator array integer, intent(inout) :: num_nodes !! Current number of populated nodes character(*), intent(in), optional :: in1, in2, in3 !! Optional input tensor names ! Local variables integer :: n_in !! Number of connected inputs for the emitted node n_in = 0 if(present(in1)) n_in = 1 if(present(in2)) n_in = 2 if(present(in3)) n_in = 3 num_nodes = num_nodes + 1 nodes(num_nodes)%name = trim(name) nodes(num_nodes)%op_type = trim(op_type) allocate(nodes(num_nodes)%inputs(n_in)) if(present(in1)) nodes(num_nodes)%inputs(1) = trim(in1) if(present(in2)) nodes(num_nodes)%inputs(2) = trim(in2) if(present(in3)) nodes(num_nodes)%inputs(3) = trim(in3) allocate(nodes(num_nodes)%outputs(1)) nodes(num_nodes)%outputs(1) = trim(out1) nodes(num_nodes)%attributes_json = attr_json end subroutine emit_node