Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read & perform inference on networks for which the hidden-layer width varies across layers #166

Merged
merged 14 commits into from
Jul 2, 2024

Conversation

rouson
Copy link
Contributor

@rouson rouson commented Jul 1, 2024

With this pull request, executing

fpm run --example read-query-infer -- --input-file uneven.json

gives the desired result of producing outputs identically equal to the corresponding inputs on a network with varying hidden-layer widths such as the attached file uneven.json.gz when uncompressed. The new example/read-and-query.f90 program generates random inputs. An example execution of the above line produces the output

Project is up to date
 Reading an inference_engine_t object from the same JSON file 'uneven.json'.
 Querying the new inference_engine_t object for several properties:
 Activation function: relu
 Number of outputs:           2
 Number of inputs:           2
 Nodes per layer:           2           2           3           2
 Performing inference:
 Inputs                 |       Outputs  
  6.7125     0.12062    |    6.7125      1.0000    
  4.4105      5.5553    |    4.4105      5.5553    
  2.8614      8.4003    |    2.8614      8.4003   

rouson added 14 commits June 27, 2024 19:54
This commit switches the metadata_ component of the
trainable_engine_t type from being an array of string_t objects
to being an instance of the new metadata_t type.
This commit switches the metadata component of the
exchange_t type from being an array of string_t objects
to being an instance of the new metadata_t type.
This commit switches the metadata component of the
inference_engine_t type from being an array of string_t objects
to being an instance of the new metadata_t type.
This commit edits the JSON file readers and writers to
1. Switch keys "tensor_range" -> {inputs_range|outputs_range}
2. Allow flexible line-position of tensor ranges and hidden layers.
This commit edits the inference_engine_t from_json constructor to
allow flexible line-position of the metadata object.
This commit switches from specifying compile-time constants for the
number of lines occupied by metadata and tensor_range JSON objects
to computing the number of lines at runtime in inference_engine_t's
to_json type-bound procedure. This will make to_json adaptable in
case the size of these objects changes in the future.
This commit switches from specifying a compile-time constant for
the number of lines occupied by neuron JSON objects now the number
of lines per neuron is computed at runtime using by checking the
array size of the result of invoking the to_json type-bound
procedure on a neuron_t prototype.
This commit adds example/read-query-infer.f90, which works with
neural nets for which the hidden-layer width varies from one layer
to the next.
@rouson rouson requested a review from davytorres July 1, 2024 22:53
Copy link
Collaborator

@davytorres davytorres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed

Copy link
Collaborator

@davytorres davytorres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed

@davytorres davytorres merged commit df2dce1 into main Jul 2, 2024
4 checks passed
rouson added a commit that referenced this pull request Jul 4, 2024
With this commit, example/read-query-infer.f90 returns outputs
identital to the inputs for the full range of inputs using the
uneven.json file attached topull request #166 on
https://github.com/berkeleylab/inference-engine.
@rouson rouson deleted the variable-hidden-layer-width branch July 21, 2024 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants