From ccfff1d19497b1bb80d6fa70b7895a7457945138 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Tue, 17 May 2022 15:19:35 -0700 Subject: [PATCH 1/6] chor: .gitignore html dir but not doc itself This commit replaces "doc" with "html" in the .gitignore file so the ford-generated doc/html/ directory will be ignored, but other doc/* files will not be ignored. This prepares for committing other forms of documentation such as PlantUML scripts for generating UML diagrams. --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8bbb6f47..cb3e412e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,4 @@ *.mod *.dat build -doc +html From 363fba2005764548eba42bd0d5c169377c9160f9 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Tue, 17 May 2022 16:33:11 -0700 Subject: [PATCH 2/6] doc(UML): add PlantUML script and doc/README.md This commit provides a high-level, graphical depiction of the class relationships in neural-fortran. --- doc/README.md | 22 ++++++++++++++++++++++ doc/class-hierarchy.puml | 17 +++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 doc/README.md create mode 100644 doc/class-hierarchy.puml diff --git a/doc/README.md b/doc/README.md new file mode 100644 index 00000000..65b5d657 --- /dev/null +++ b/doc/README.md @@ -0,0 +1,22 @@ +Documentation +============= + +UML Diagrams +------------ +Use a PlantUML previewer to generate Unified Modeling Language (UML) diagrams from the PlantUML scripts (`*.puml`) in this subdirectory. The generated versions below were created by in the renderer on the landing page at [PlantUML.com] + +### Class Hierarchy +![class-hierarchy](https://user-images.githubusercontent.com/13108868/168928394-9fbf7880-0b11-4eb5-9106-baeb3ae3482d.png) + + +HTML Pages +---------- + +With [FORD] installed, running the following command produces a doc/html folder containing additional nerual-fortran documentation: +``` +ford ford.md +``` + +[FORD]: https://github.com/Fortran-FOSS-Programmers/ford/ +[PlantUML]: https://plantuml.com +[Atom]: https://atom.io diff --git a/doc/class-hierarchy.puml b/doc/class-hierarchy.puml new file mode 100644 index 00000000..5376c698 --- /dev/null +++ b/doc/class-hierarchy.puml @@ -0,0 +1,17 @@ +@startuml + +hide empty members + +class sgd + +abstract class base_layer + +network *-left- layer + +base_layer <|-- maxpool2d_layer +base_layer <|-- input3d_layer +base_layer <|-- dense_layer +base_layer <|-- conv2d_layer +base_layer <|-- input1d_layer + +@enduml From d4857598d54cc54bb4571344b0be39d75aab5fc6 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Tue, 17 May 2022 22:16:16 -0700 Subject: [PATCH 3/6] doc: add developer API and doc/README.md --- doc/README.md | 10 ++++++ doc/class-hierarchy.puml | 2 ++ doc/developer-api.puml | 75 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 doc/developer-api.puml diff --git a/doc/README.md b/doc/README.md index 65b5d657..8fd3d3a2 100644 --- a/doc/README.md +++ b/doc/README.md @@ -6,8 +6,18 @@ UML Diagrams Use a PlantUML previewer to generate Unified Modeling Language (UML) diagrams from the PlantUML scripts (`*.puml`) in this subdirectory. The generated versions below were created by in the renderer on the landing page at [PlantUML.com] ### Class Hierarchy +This diagram provides a high-level picture of the neural-fortran classes and their interrelatioships: ![class-hierarchy](https://user-images.githubusercontent.com/13108868/168928394-9fbf7880-0b11-4eb5-9106-baeb3ae3482d.png) +### Developer API +This diagram enhances the above class hierarchy depiction to include a richer summation of thepublic interface of each class, including the public derived types, type-bound procecures, and user-defined structure constructors: +![developer-api](https://user-images.githubusercontent.com/13108868/168961635-1f43641f-8144-4c4c-aa61-9f7140650e42.png) +For a depection of the derived type components (but without the richness of information on interrelationships), see the HTML documentation. + +### User API +This diagram depicts the functionality intended to be accessed directly by neural-fortran users: + +TBD HTML Pages ---------- diff --git a/doc/class-hierarchy.puml b/doc/class-hierarchy.puml index 5376c698..01a004dc 100644 --- a/doc/class-hierarchy.puml +++ b/doc/class-hierarchy.puml @@ -1,5 +1,7 @@ @startuml +title Class Hierarchy + hide empty members class sgd diff --git a/doc/developer-api.puml b/doc/developer-api.puml new file mode 100644 index 00000000..b5fddd74 --- /dev/null +++ b/doc/developer-api.puml @@ -0,0 +1,75 @@ +@startuml + +title Developer API: Public Classes, Type-Bound Procedures, and Constructors +hide empty members + +class sgd + +abstract class base_layer { + {abstract} init_interface(input_shape : integer) + set_activation(activation : character(len=*)) +} + +class maxpool2d_layer{ + maxpool2d_layer(ipool_size: integer, stride : integer) : maxpool2d_layer + init(input_shape : integer) + forward(input : real[][][]) + backward(input : real[][][], gradient : real[][][]) +} + +class input3d_layer{ + input3d_layer(output_shape : real[]) : input3d_layer + init(input_shape : real[]) + set(values : real[][][]) +} + +class dense_layer{ + dense_layer(output_size : integer, activation : character(len=*)) : dense_layer + backward(input : rea[], gradient : real[]) + forward(input : real[]) +} + +class conv2d_layer{ + conv2d_layer(filters : integer, kernel_size : integer, activation : character(len=*)) + init(input_shape : integer[]) + forward(input : real[][][]) + backward(input : real[][][], gradient : real[][][]) +} + +class input1d_layer{ + input1d_layer(output_size : integer) + init(input_shape:integer) + set(values : real[]) +} + + +class network { + network(layers[] : layer) : network + backward(output : real[]) + output(input : real[]) : real[] + print_info() + train(input_data:real[][], output_data:real[][], batch_size:integer, epochs:integer, optimizer:sgd) + update(learning_rate:real) + forward(input : real[]) + forward(input : real[][][]) +} + +class layer{ + backward(previous : layer, gradient : real[]) + forward(input : layer) + init(input : layer) + print_info() + update(learning_rate : real) + get_output(output : real[]) + get_output(output : real[][]) +} + +network *-left- layer + +base_layer <|-- maxpool2d_layer +base_layer <|-- input3d_layer +base_layer <|-- dense_layer +base_layer <|-- conv2d_layer +base_layer <|-- input1d_layer + +@enduml From c83ce2e2f69a8e688d72e4a45e558355cf5537e0 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Tue, 17 May 2022 22:19:15 -0700 Subject: [PATCH 4/6] doc: fix typos in doc/README.md --- doc/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/README.md b/doc/README.md index 8fd3d3a2..065ea7bb 100644 --- a/doc/README.md +++ b/doc/README.md @@ -6,13 +6,13 @@ UML Diagrams Use a PlantUML previewer to generate Unified Modeling Language (UML) diagrams from the PlantUML scripts (`*.puml`) in this subdirectory. The generated versions below were created by in the renderer on the landing page at [PlantUML.com] ### Class Hierarchy -This diagram provides a high-level picture of the neural-fortran classes and their interrelatioships: +This diagram provides a high-level picture of the neural-fortran classes and their interrelationships: ![class-hierarchy](https://user-images.githubusercontent.com/13108868/168928394-9fbf7880-0b11-4eb5-9106-baeb3ae3482d.png) ### Developer API -This diagram enhances the above class hierarchy depiction to include a richer summation of thepublic interface of each class, including the public derived types, type-bound procecures, and user-defined structure constructors: +This diagram enhances the above class hierarchy depiction to include a richer summation of the public interface of each class, including the public derived types, type-bound procedures, and user-defined structure constructors: ![developer-api](https://user-images.githubusercontent.com/13108868/168961635-1f43641f-8144-4c4c-aa61-9f7140650e42.png) -For a depection of the derived type components (but without the richness of information on interrelationships), see the HTML documentation. +For a depiction of the derived type components (but without the richness of information on interrelationships), see the HTML documentation. ### User API This diagram depicts the functionality intended to be accessed directly by neural-fortran users: @@ -22,7 +22,7 @@ TBD HTML Pages ---------- -With [FORD] installed, running the following command produces a doc/html folder containing additional nerual-fortran documentation: +With [FORD] installed, running the following command produces a doc/html folder containing additional neural-fortran documentation: ``` ford ford.md ``` From 502047cbccce973f0e594ca714818a0f054cc1fc Mon Sep 17 00:00:00 2001 From: Milan Curcic Date: Fri, 20 May 2022 13:08:26 -0400 Subject: [PATCH 5/6] Fix typos --- doc/developer-api.puml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/developer-api.puml b/doc/developer-api.puml index b5fddd74..8b9a9abd 100644 --- a/doc/developer-api.puml +++ b/doc/developer-api.puml @@ -11,7 +11,7 @@ abstract class base_layer { } class maxpool2d_layer{ - maxpool2d_layer(ipool_size: integer, stride : integer) : maxpool2d_layer + maxpool2d_layer(pool_size: integer, stride : integer) : maxpool2d_layer init(input_shape : integer) forward(input : real[][][]) backward(input : real[][][], gradient : real[][][]) @@ -61,7 +61,7 @@ class layer{ print_info() update(learning_rate : real) get_output(output : real[]) - get_output(output : real[][]) + get_output(output : real[][][]) } network *-left- layer From 28493eb7b4818a172c1d1d1bdeaadb190a4cebb7 Mon Sep 17 00:00:00 2001 From: Milan Curcic Date: Fri, 20 May 2022 13:13:22 -0400 Subject: [PATCH 6/6] Fix typos and clean up --- doc/README.md | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/doc/README.md b/doc/README.md index 065ea7bb..d8efea2f 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,32 +1,33 @@ -Documentation -============= +# Developer documentation -UML Diagrams ------------- -Use a PlantUML previewer to generate Unified Modeling Language (UML) diagrams from the PlantUML scripts (`*.puml`) in this subdirectory. The generated versions below were created by in the renderer on the landing page at [PlantUML.com] +## UML Diagrams + +Use a PlantUML previewer to generate Unified Modeling Language (UML) diagrams +from the PlantUML scripts (`*.puml`) in this subdirectory. +The generated versions below were created by the renderer on the +[PlantUML landing page](https://plantuml.com) ### Class Hierarchy -This diagram provides a high-level picture of the neural-fortran classes and their interrelationships: + +This diagram provides a high-level picture of the neural-fortran classes and +their interrelationships: ![class-hierarchy](https://user-images.githubusercontent.com/13108868/168928394-9fbf7880-0b11-4eb5-9106-baeb3ae3482d.png) ### Developer API -This diagram enhances the above class hierarchy depiction to include a richer summation of the public interface of each class, including the public derived types, type-bound procedures, and user-defined structure constructors: -![developer-api](https://user-images.githubusercontent.com/13108868/168961635-1f43641f-8144-4c4c-aa61-9f7140650e42.png) -For a depiction of the derived type components (but without the richness of information on interrelationships), see the HTML documentation. -### User API -This diagram depicts the functionality intended to be accessed directly by neural-fortran users: +This diagram enhances the above class hierarchy depiction to include a richer +summation of the public interface of each class, including the public derived +types, type-bound procedures, and user-defined structure constructors: -TBD +![developer-api](https://user-images.githubusercontent.com/13108868/168961635-1f43641f-8144-4c4c-aa61-9f7140650e42.png) + +For a depiction of the derived type components (but without the richness of +information on interrelationships), generate the HTML documentation using +[FORD](https://github.com/modern-fortran/neural-fortran#api-documentation). -HTML Pages ----------- +### User API -With [FORD] installed, running the following command produces a doc/html folder containing additional neural-fortran documentation: -``` -ford ford.md -``` +This diagram depicts the functionality intended to be accessed directly by +neural-fortran users: -[FORD]: https://github.com/Fortran-FOSS-Programmers/ford/ -[PlantUML]: https://plantuml.com -[Atom]: https://atom.io +TBD