store_tensor_state Subroutine

subroutine store_tensor_state(state, tensors, num_tensors)

Copy the current tensor state into the parsed result collection.

Arguments

Type IntentOptional Attributes Name
type(json_tensor_state_type), intent(in) :: state

Completed tensor parser state

type(onnx_tensor_type), intent(inout) :: tensors(:)

Parsed tensor destination array

integer, intent(inout) :: num_tensors

Number of valid tensor entries in tensors


Source Code

  subroutine store_tensor_state(state, tensors, num_tensors)
    !! Copy the current tensor state into the parsed result collection.
    implicit none

    ! Arguments
    type(json_tensor_state_type), intent(in) :: state
    !! Completed tensor parser state
    type(onnx_tensor_type), intent(inout) :: tensors(:)
    !! Parsed tensor destination array
    integer, intent(inout) :: num_tensors
    !! Number of valid tensor entries in tensors

    num_tensors = num_tensors + 1
    tensors(num_tensors)%name = state%name
    tensors(num_tensors)%elem_type = state%elem_type
    allocate(tensors(num_tensors)%dims(size(state%dim_values)))
    tensors(num_tensors)%dims = state%dim_values

  end subroutine store_tensor_state