Skip to content

Add UML diagrams #71

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

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
*.mod
*.smod
*.dat
*.h5
/build
/doc
build
doc/html
*.h5
33 changes: 33 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 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 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:
![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), generate the HTML documentation using
[FORD](https://github.com/modern-fortran/neural-fortran#api-documentation).

### User API

This diagram depicts the functionality intended to be accessed directly by
neural-fortran users:

TBD
19 changes: 19 additions & 0 deletions doc/class-hierarchy.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@startuml

title Class Hierarchy

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
75 changes: 75 additions & 0 deletions doc/developer-api.puml
Original file line number Diff line number Diff line change
@@ -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(pool_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