Skip to content

Linear2d layer #197

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

Merged
merged 44 commits into from
Feb 17, 2025
Merged
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
1fb279a
linear2d_layer forward implementation
OneAdder Feb 2, 2025
d997b6b
implement backward
OneAdder Feb 2, 2025
9919c01
introduce concurrency, outtroduce stupidity
OneAdder Feb 2, 2025
43d1a1f
fix style
OneAdder Feb 2, 2025
906f21b
add parameters api to linear2d_layer
OneAdder Feb 3, 2025
e1b4695
add constructor for linear2d_layer
OneAdder Feb 3, 2025
0fe2ef0
add integration for linear2d layer
OneAdder Feb 3, 2025
957095d
set usage rules for linear2d_layer
OneAdder Feb 3, 2025
eff36fe
add linear2d_layer to public api
OneAdder Feb 3, 2025
b6f3c97
update tests for linear2d layer
OneAdder Feb 3, 2025
541d943
remove extra comment
OneAdder Feb 3, 2025
a27ec09
remove rubbish
OneAdder Feb 3, 2025
79abce3
move linear2d layer logic into submodule
OneAdder Feb 4, 2025
2168ec9
update cmake for linear2d_layer
OneAdder Feb 4, 2025
9a13af3
update tests for linear2d_layer
OneAdder Feb 5, 2025
0db76db
update linear2d_layer tests
OneAdder Feb 5, 2025
f28ecc0
update linear2d_layer tests for batch last
OneAdder Feb 5, 2025
9386aa3
make linear2d_layer with batch as last dimension (performance)
OneAdder Feb 5, 2025
07750db
linear2d_layer: fix gradient updates
OneAdder Feb 12, 2025
b5a600a
linear2d_layer: make it 2d
OneAdder Feb 14, 2025
dd1297e
linear2d_layer: forgot a file
OneAdder Feb 14, 2025
e4cb526
linear2d_layer: temporarily remove api
OneAdder Feb 14, 2025
86ec628
Don't expose the concrete layer type via nf
milancurcic Feb 16, 2025
d40aebb
Report success to stdout
milancurcic Feb 16, 2025
b803553
Include linear2d test in cmake
milancurcic Feb 16, 2025
f1a01a6
Add Linear2d to README
milancurcic Feb 16, 2025
b39e6da
Plumbing of linear2d with input2d and linear2d
milancurcic Feb 16, 2025
1bec531
linear2d_layer: add flatten2d layer
OneAdder Feb 16, 2025
d01a174
linear2d_layer: make linear2d layer work with input2d and flatten2d
OneAdder Feb 16, 2025
141fe57
update cmake
OneAdder Feb 16, 2025
c4b8fc7
linear2d_layer: use flatten layer instead of flatten2d
OneAdder Feb 16, 2025
54d1bb0
linear2d_layer: remove flatten2d layer
OneAdder Feb 16, 2025
9a4422f
linear2d_layer: remove public api
OneAdder Feb 16, 2025
7606d2c
linear2d_layer: update cmakelists
OneAdder Feb 16, 2025
7d271fe
linear2d_layer: workaround cpu imprecision to make ci happy
OneAdder Feb 16, 2025
539fde8
Add linear2d example
milancurcic Feb 17, 2025
a97f141
linear2d_layer: remove redundant constructor args
OneAdder Feb 17, 2025
bbfaf3c
linear2d_layer: make example converge
OneAdder Feb 17, 2025
4d28a0a
linear2d_layer: make weighs init with normal distribution
OneAdder Feb 17, 2025
bfc69d5
linear2d_layer: add loss stopping and more iterations
OneAdder Feb 17, 2025
119a6c8
linear2d_layer: update tests
OneAdder Feb 17, 2025
6f33ebe
Tidy up
milancurcic Feb 17, 2025
678b2c0
Require passing only out_features to linear2d(); tidy up
milancurcic Feb 17, 2025
e78ef62
Remove linear2d example
milancurcic Feb 17, 2025
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
Prev Previous commit
Next Next commit
linear2d_layer: workaround cpu imprecision to make ci happy
  • Loading branch information
OneAdder committed Feb 16, 2025
commit 7d271fe5d54d3c2b73f47f0fa2bac13db7f9e9cc
6 changes: 3 additions & 3 deletions test/test_linear2d_layer.f90
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ subroutine test_linear2d_layer_backward(linear, ok, input, gradient)
real :: dw_shape(2)
real :: db_shape(1)
real :: gradient_flat(12)
real :: dw_flat(4)
integer :: dw_flat(4) ! cpu imprecision workaround
real :: expected_gradient_shape(2) = [3, 4]
real :: expected_dw_shape(2) = [4, 1]
real :: expected_db_shape(1) = [1]
Expand All @@ -67,7 +67,7 @@ subroutine test_linear2d_layer_backward(linear, ok, input, gradient)
0.2, 0.3, 0.2, 0.2,&
0.3, 0.2, 0.2, 0.3&
]
real :: expected_dw_flat(4) = [0.7, 0.7, 1.4, 1.4]
integer :: expected_dw_flat(4) = [7, 7, 14, 14] ! cpu imprecision workaround
real :: expected_db(1) = [7]

call linear % backward(input, gradient)
Expand All @@ -93,7 +93,7 @@ subroutine test_linear2d_layer_backward(linear, ok, input, gradient)
ok = .false.
write(stderr, '(a)') 'backward returned incorrect gradient values.. failed'
end if
dw_flat = reshape(linear % dw, shape(dw_flat))
dw_flat = nint(reshape(linear % dw, shape(dw_flat)) * 10)
if (.not. all(dw_flat.eq.expected_dw_flat)) then
ok = .false.
write(stderr, '(a)') 'backward returned incorrect dw values.. failed'
Expand Down