File tree 4 files changed +54
-0
lines changed
4 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 516
516
517
517
# include implementations
518
518
include (" symbol_module.jl" )
519
+ include (" pipeline.jl" )
520
+ include (" native_module.jl" )
519
521
520
522
end
Original file line number Diff line number Diff line change
1
+ """
2
+ NativeModule
3
+
4
+ Allows the implementation of a MXNet module in native Julia. NDArrays
5
+ will be translated into native Julia arrays.
6
+ """
7
+ type NativeModule{F<: Function ,B<: Function } <: AbstractModule
8
+ forward :: F
9
+ backward :: B
10
+ end
Original file line number Diff line number Diff line change
1
+ abstract PipelineModule <: AbstractModule
2
+
3
+ """
4
+ SimplePipelineModule
5
+
6
+ Allows the pipelining of several modules.
7
+
8
+ # Arguments:
9
+ * `pipeline :: Vector{Module}`
10
+ The elements that are called sequentially
11
+
12
+ # Functionality
13
+ *
14
+ """
15
+ type SimplePipelineModule <: PipelineModule
16
+ pipeline :: Vector{Module}
17
+ end
18
+
19
+ type ModuleDataProvider <: mx.AbstractDataProvider
20
+ mod :: Module
21
+ end
22
+
23
+
24
+ function forward (self :: SimplePipelineModule )
25
+ for mod in self. pipeline
26
+ forward (mod)
27
+ end
28
+ end
29
+
30
+ function backward (self :: SimplePipelineModule )
31
+ for i in length (self. pipeline): - 1 : 1
32
+ mod = self. pipeline[i]
33
+ backward (mod)
34
+ end
35
+ end
36
+
37
+ function get_outputs (self :: SimplePipelineModule )
38
+ return get_outputs (last (self. pipeline))
39
+ end
Original file line number Diff line number Diff line change @@ -133,6 +133,9 @@ function test_linear_regression(n_epoch::Int = 10)
133
133
@test sum (abs (ha_pred- y_pred)) < 1e-1
134
134
end
135
135
136
+ function test_simplepipeline ()
137
+ end
138
+
136
139
# ###############################################################################
137
140
# Run tests
138
141
# ###############################################################################
You can’t perform that action at this time.
0 commit comments