caffe
1name: 'LinearRegressionExample'
2# define a simple network for linear regression on dummy data
3# that computes the loss by a PythonLayer.
4layer {
5type: 'DummyData'
6name: 'x'
7top: 'x'
8dummy_data_param {
9shape: { dim: 10 dim: 3 dim: 2 }
10data_filler: { type: 'gaussian' }
11}
12}
13layer {
14type: 'DummyData'
15name: 'y'
16top: 'y'
17dummy_data_param {
18shape: { dim: 10 dim: 3 dim: 2 }
19data_filler: { type: 'gaussian' }
20}
21}
22# include InnerProduct layers for parameters
23# so the net will need backward
24layer {
25type: 'InnerProduct'
26name: 'ipx'
27top: 'ipx'
28bottom: 'x'
29inner_product_param {
30num_output: 10
31weight_filler { type: 'xavier' }
32}
33}
34layer {
35type: 'InnerProduct'
36name: 'ipy'
37top: 'ipy'
38bottom: 'y'
39inner_product_param {
40num_output: 10
41weight_filler { type: 'xavier' }
42}
43}
44layer {
45type: 'Python'
46name: 'loss'
47top: 'loss'
48bottom: 'ipx'
49bottom: 'ipy'
50python_param {
51# the module name -- usually the filename -- that needs to be in $PYTHONPATH
52module: 'pyloss'
53# the layer name -- the class name in the module
54layer: 'EuclideanLossLayer'
55}
56# set loss weight so Caffe knows this is a loss layer.
57# since PythonLayer inherits directly from Layer, this isn't automatically
58# known to Caffe
59loss_weight: 1
60}
61