Repository: incubator-singa Updated Branches: refs/heads/master b6591d11f -> 4ebf0bcd6
Add license for python files to pass 'make rat' Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/4ebf0bcd Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/4ebf0bcd Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/4ebf0bcd Branch: refs/heads/master Commit: 4ebf0bcd6165935079407564368e901b429326b5 Parents: b6591d1 Author: Wei Wang <[email protected]> Authored: Wed Jan 6 02:37:17 2016 +0800 Committer: Wei Wang <[email protected]> Committed: Wed Jan 6 02:37:17 2016 +0800 ---------------------------------------------------------------------- examples/char-rnn/data.py | 24 +++++++++++++ tool/python/examples/__init__.py | 22 ++++++++++++ tool/python/examples/cifar10_cnn.py | 23 +++++++++++++ tool/python/examples/cifar10_cnn_cudnn.py | 23 +++++++++++++ tool/python/examples/cifar10_cnn_parameter.py | 22 ++++++++++++ tool/python/examples/datasets/__init__.py | 22 ++++++++++++ tool/python/examples/datasets/cifar10.py | 29 ++++++++++++++-- tool/python/examples/datasets/mnist.py | 33 +++++++++++++++--- tool/python/examples/mnist_ae.py | 24 ++++++++++++- tool/python/examples/mnist_mlp.py | 28 +++++++++++++-- tool/python/examples/mnist_mlp_parameter.py | 40 +++++++++++++++++----- tool/python/examples/mnist_mlp_test.py | 28 +++++++++++++-- tool/python/examples/mnist_rbm1.py | 26 ++++++++++++-- tool/python/examples/mnist_rbm2.py | 26 ++++++++++++-- tool/python/examples/mnist_rbm3.py | 28 +++++++++++++-- tool/python/examples/mnist_rbm4.py | 28 +++++++++++++-- 16 files changed, 392 insertions(+), 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/4ebf0bcd/examples/char-rnn/data.py ---------------------------------------------------------------------- diff --git a/examples/char-rnn/data.py b/examples/char-rnn/data.py index 4b1c28c..20e7262 100644 --- a/examples/char-rnn/data.py +++ b/examples/char-rnn/data.py @@ -1,3 +1,27 @@ +#!/usr/bin/env python + +#/************************************************************ +#* +#* Licensed to the Apache Software Foundation (ASF) under one +#* or more contributor license agreements. See the NOTICE file +#* distributed with this work for additional information +#* regarding copyright ownership. The ASF licenses this file +#* to you under the Apache License, Version 2.0 (the +#* "License"); you may not use this file except in compliance +#* with the License. You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* Unless required by applicable law or agreed to in writing, +#* software distributed under the License is distributed on an +#* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#* KIND, either express or implied. See the License for the +#* specific language governing permissions and limitations +#* under the License. +#* +#*************************************************************/ + + # pls get linux_input.txt from http://cs.stanford.edu/people/karpathy/char-rnn/ data = open('linux_input.txt', 'r').read() # should be simple plain text file chars = list(set(data)) http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/4ebf0bcd/tool/python/examples/__init__.py ---------------------------------------------------------------------- diff --git a/tool/python/examples/__init__.py b/tool/python/examples/__init__.py index e69de29..a796a7a 100644 --- a/tool/python/examples/__init__.py +++ b/tool/python/examples/__init__.py @@ -0,0 +1,22 @@ +#/************************************************************ +#* +#* Licensed to the Apache Software Foundation (ASF) under one +#* or more contributor license agreements. See the NOTICE file +#* distributed with this work for additional information +#* regarding copyright ownership. The ASF licenses this file +#* to you under the Apache License, Version 2.0 (the +#* "License"); you may not use this file except in compliance +#* with the License. You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* Unless required by applicable law or agreed to in writing, +#* software distributed under the License is distributed on an +#* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#* KIND, either express or implied. See the License for the +#* specific language governing permissions and limitations +#* under the License. +#* +#*************************************************************/ + + http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/4ebf0bcd/tool/python/examples/cifar10_cnn.py ---------------------------------------------------------------------- diff --git a/tool/python/examples/cifar10_cnn.py b/tool/python/examples/cifar10_cnn.py index 9e8e588..f03b611 100755 --- a/tool/python/examples/cifar10_cnn.py +++ b/tool/python/examples/cifar10_cnn.py @@ -1,4 +1,27 @@ #!/usr/bin/env python +#/************************************************************ +#* +#* Licensed to the Apache Software Foundation (ASF) under one +#* or more contributor license agreements. See the NOTICE file +#* distributed with this work for additional information +#* regarding copyright ownership. The ASF licenses this file +#* to you under the Apache License, Version 2.0 (the +#* "License"); you may not use this file except in compliance +#* with the License. You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* Unless required by applicable law or agreed to in writing, +#* software distributed under the License is distributed on an +#* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#* KIND, either express or implied. See the License for the +#* specific language governing permissions and limitations +#* under the License. +#* +#*************************************************************/ + + + import sys, os sys.path.append(os.path.join(os.path.dirname(__file__),'..')) from singa.model import * http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/4ebf0bcd/tool/python/examples/cifar10_cnn_cudnn.py ---------------------------------------------------------------------- diff --git a/tool/python/examples/cifar10_cnn_cudnn.py b/tool/python/examples/cifar10_cnn_cudnn.py index 4269f37..e87b5c4 100755 --- a/tool/python/examples/cifar10_cnn_cudnn.py +++ b/tool/python/examples/cifar10_cnn_cudnn.py @@ -1,4 +1,27 @@ #!/usr/bin/env python + +#/************************************************************ +#* +#* Licensed to the Apache Software Foundation (ASF) under one +#* or more contributor license agreements. See the NOTICE file +#* distributed with this work for additional information +#* regarding copyright ownership. The ASF licenses this file +#* to you under the Apache License, Version 2.0 (the +#* "License"); you may not use this file except in compliance +#* with the License. You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* Unless required by applicable law or agreed to in writing, +#* software distributed under the License is distributed on an +#* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#* KIND, either express or implied. See the License for the +#* specific language governing permissions and limitations +#* under the License. +#* +#*************************************************************/ + + import sys, os sys.path.append(os.path.join(os.path.dirname(__file__),'..')) from singa.model import * http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/4ebf0bcd/tool/python/examples/cifar10_cnn_parameter.py ---------------------------------------------------------------------- diff --git a/tool/python/examples/cifar10_cnn_parameter.py b/tool/python/examples/cifar10_cnn_parameter.py index 39bdb43..c5470b6 100755 --- a/tool/python/examples/cifar10_cnn_parameter.py +++ b/tool/python/examples/cifar10_cnn_parameter.py @@ -1,4 +1,26 @@ #!/usr/bin/env python +#/************************************************************ +#* +#* Licensed to the Apache Software Foundation (ASF) under one +#* or more contributor license agreements. See the NOTICE file +#* distributed with this work for additional information +#* regarding copyright ownership. The ASF licenses this file +#* to you under the Apache License, Version 2.0 (the +#* "License"); you may not use this file except in compliance +#* with the License. You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* Unless required by applicable law or agreed to in writing, +#* software distributed under the License is distributed on an +#* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#* KIND, either express or implied. See the License for the +#* specific language governing permissions and limitations +#* under the License. +#* +#*************************************************************/ + + import sys, os sys.path.append(os.path.join(os.path.dirname(__file__),'..')) from singa.model import * http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/4ebf0bcd/tool/python/examples/datasets/__init__.py ---------------------------------------------------------------------- diff --git a/tool/python/examples/datasets/__init__.py b/tool/python/examples/datasets/__init__.py index e69de29..a796a7a 100644 --- a/tool/python/examples/datasets/__init__.py +++ b/tool/python/examples/datasets/__init__.py @@ -0,0 +1,22 @@ +#/************************************************************ +#* +#* Licensed to the Apache Software Foundation (ASF) under one +#* or more contributor license agreements. See the NOTICE file +#* distributed with this work for additional information +#* regarding copyright ownership. The ASF licenses this file +#* to you under the Apache License, Version 2.0 (the +#* "License"); you may not use this file except in compliance +#* with the License. You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* Unless required by applicable law or agreed to in writing, +#* software distributed under the License is distributed on an +#* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#* KIND, either express or implied. See the License for the +#* specific language governing permissions and limitations +#* under the License. +#* +#*************************************************************/ + + http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/4ebf0bcd/tool/python/examples/datasets/cifar10.py ---------------------------------------------------------------------- diff --git a/tool/python/examples/datasets/cifar10.py b/tool/python/examples/datasets/cifar10.py index 65bcd60..ef5136f 100644 --- a/tool/python/examples/datasets/cifar10.py +++ b/tool/python/examples/datasets/cifar10.py @@ -1,8 +1,31 @@ #!/usr/bin/env python + +#/************************************************************ +#* +#* Licensed to the Apache Software Foundation (ASF) under one +#* or more contributor license agreements. See the NOTICE file +#* distributed with this work for additional information +#* regarding copyright ownership. The ASF licenses this file +#* to you under the Apache License, Version 2.0 (the +#* "License"); you may not use this file except in compliance +#* with the License. You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* Unless required by applicable law or agreed to in writing, +#* software distributed under the License is distributed on an +#* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#* KIND, either express or implied. See the License for the +#* specific language governing permissions and limitations +#* under the License. +#* +#*************************************************************/ + + from singa.model import * def load_data( - workspace = None, + workspace = None, backend = 'kvfile', batchsize = 64, random = 5000, @@ -20,13 +43,13 @@ def load_data( store = Store(path=path_train, mean_file=path_mean, backend=backend, random_skip=random, batchsize=batchsize, - shape=shape) + shape=shape) data_train = Data(load='recordinput', phase='train', conf=store) store = Store(path=path_test, mean_file=path_mean, backend=backend, batchsize=batchsize, - shape=shape) + shape=shape) data_test = Data(load='recordinput', phase='test', conf=store) http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/4ebf0bcd/tool/python/examples/datasets/mnist.py ---------------------------------------------------------------------- diff --git a/tool/python/examples/datasets/mnist.py b/tool/python/examples/datasets/mnist.py index c8695ec..0f75393 100644 --- a/tool/python/examples/datasets/mnist.py +++ b/tool/python/examples/datasets/mnist.py @@ -1,11 +1,34 @@ #!/usr/bin/env python -from singa.model import * + +#/************************************************************ +#* +#* Licensed to the Apache Software Foundation (ASF) under one +#* or more contributor license agreements. See the NOTICE file +#* distributed with this work for additional information +#* regarding copyright ownership. The ASF licenses this file +#* to you under the Apache License, Version 2.0 (the +#* "License"); you may not use this file except in compliance +#* with the License. You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* Unless required by applicable law or agreed to in writing, +#* software distributed under the License is distributed on an +#* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#* KIND, either express or implied. See the License for the +#* specific language governing permissions and limitations +#* under the License. +#* +#*************************************************************/ + + +from singa.model import * def load_data( workspace = None, backend = 'kvfile', - nb_rbm = 0, # the number of layers for RBM and Autoencoder - checkpoint_steps = 0, + nb_rbm = 0, # the number of layers for RBM and Autoencoder + checkpoint_steps = 0, **pvalues ): @@ -16,10 +39,10 @@ def load_data( if workspace == None: workspace = data_dir # checkpoint path to load - checkpoint_list = None + checkpoint_list = None if checkpoint_steps > 0: workerid = 0 - checkpoint_list = [] + checkpoint_list = [] for i in range(nb_rbm-1, 0, -1): checkpoint_list.append('examples/rbm/rbm{0}/checkpoint/step{1}-worker{2}'.format(str(i),checkpoint_steps,workerid)) http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/4ebf0bcd/tool/python/examples/mnist_ae.py ---------------------------------------------------------------------- diff --git a/tool/python/examples/mnist_ae.py b/tool/python/examples/mnist_ae.py index 4528d9c..888f288 100755 --- a/tool/python/examples/mnist_ae.py +++ b/tool/python/examples/mnist_ae.py @@ -1,6 +1,28 @@ #!/usr/bin/env python +#/************************************************************ +#* +#* Licensed to the Apache Software Foundation (ASF) under one +#* or more contributor license agreements. See the NOTICE file +#* distributed with this work for additional information +#* regarding copyright ownership. The ASF licenses this file +#* to you under the Apache License, Version 2.0 (the +#* "License"); you may not use this file except in compliance +#* with the License. You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* Unless required by applicable law or agreed to in writing, +#* software distributed under the License is distributed on an +#* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#* KIND, either express or implied. See the License for the +#* specific language governing permissions and limitations +#* under the License. +#* +#*************************************************************/ + + import sys, os -sys.path.append(os.path.join(os.path.dirname(__file__),'..')) +sys.path.append(os.path.join(os.path.dirname(__file__),'..')) from singa.model import * from examples.datasets import mnist http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/4ebf0bcd/tool/python/examples/mnist_mlp.py ---------------------------------------------------------------------- diff --git a/tool/python/examples/mnist_mlp.py b/tool/python/examples/mnist_mlp.py index 1bd5bc5..10cd15e 100755 --- a/tool/python/examples/mnist_mlp.py +++ b/tool/python/examples/mnist_mlp.py @@ -1,7 +1,29 @@ #!/usr/bin/env python +#/************************************************************ +#* +#* Licensed to the Apache Software Foundation (ASF) under one +#* or more contributor license agreements. See the NOTICE file +#* distributed with this work for additional information +#* regarding copyright ownership. The ASF licenses this file +#* to you under the Apache License, Version 2.0 (the +#* "License"); you may not use this file except in compliance +#* with the License. You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* Unless required by applicable law or agreed to in writing, +#* software distributed under the License is distributed on an +#* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#* KIND, either express or implied. See the License for the +#* specific language governing permissions and limitations +#* under the License. +#* +#*************************************************************/ + + import sys, os -sys.path.append(os.path.join(os.path.dirname(__file__),'..')) -from singa.model import * +sys.path.append(os.path.join(os.path.dirname(__file__),'..')) +from singa.model import * from examples.datasets import mnist # Sample parameter values for Mnist MLP example @@ -19,7 +41,7 @@ m.add(Dense(2000, init='uniform', activation='tanh')) m.add(Dense(1500, init='uniform', activation='tanh')) m.add(Dense(1000, init='uniform', activation='tanh')) m.add(Dense(500, init='uniform', activation='tanh')) -m.add(Dense(10, init='uniform', activation='softmax')) +m.add(Dense(10, init='uniform', activation='softmax')) sgd = SGD(lr=0.001, lr_type='step') topo = Cluster(workspace) http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/4ebf0bcd/tool/python/examples/mnist_mlp_parameter.py ---------------------------------------------------------------------- diff --git a/tool/python/examples/mnist_mlp_parameter.py b/tool/python/examples/mnist_mlp_parameter.py index 24fc960..9080451 100755 --- a/tool/python/examples/mnist_mlp_parameter.py +++ b/tool/python/examples/mnist_mlp_parameter.py @@ -1,8 +1,30 @@ #!/usr/bin/env python +#/************************************************************ +#* +#* Licensed to the Apache Software Foundation (ASF) under one +#* or more contributor license agreements. See the NOTICE file +#* distributed with this work for additional information +#* regarding copyright ownership. The ASF licenses this file +#* to you under the Apache License, Version 2.0 (the +#* "License"); you may not use this file except in compliance +#* with the License. You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* Unless required by applicable law or agreed to in writing, +#* software distributed under the License is distributed on an +#* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#* KIND, either express or implied. See the License for the +#* specific language governing permissions and limitations +#* under the License. +#* +#*************************************************************/ + + import sys, os -sys.path.append(os.path.join(os.path.dirname(__file__),'..')) -from singa.model import * -from singa.datasets import mnist +sys.path.append(os.path.join(os.path.dirname(__file__),'..')) +from singa.model import * +from singa.datasets import mnist # Sample parameter values for Mnist MLP example pvalues = {'batchsize' : 64, 'shape' : 784, @@ -13,12 +35,12 @@ X_train, X_test, workspace = mnist.load_data(**pvalues) m = Sequential('mlp', argv=sys.argv) par = Parameter(init='uniform', scale=0.05) -m.add(Dense(2500, w_param=par, b_param=par, activation='tanh')) -m.add(Dense(2000, w_param=par, b_param=par, activation='tanh')) -m.add(Dense(1500, w_param=par, b_param=par, activation='tanh')) -m.add(Dense(1000, w_param=par, b_param=par, activation='tanh')) -m.add(Dense(500, w_param=par, b_param=par, activation='tanh')) -m.add(Dense(10, w_param=par, b_param=par, activation='softmax')) +m.add(Dense(2500, w_param=par, b_param=par, activation='tanh')) +m.add(Dense(2000, w_param=par, b_param=par, activation='tanh')) +m.add(Dense(1500, w_param=par, b_param=par, activation='tanh')) +m.add(Dense(1000, w_param=par, b_param=par, activation='tanh')) +m.add(Dense(500, w_param=par, b_param=par, activation='tanh')) +m.add(Dense(10, w_param=par, b_param=par, activation='softmax')) sgd = SGD(lr=0.001, lr_type='step') topo = Cluster(workspace) http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/4ebf0bcd/tool/python/examples/mnist_mlp_test.py ---------------------------------------------------------------------- diff --git a/tool/python/examples/mnist_mlp_test.py b/tool/python/examples/mnist_mlp_test.py index de5b9c0..ee4e4aa 100755 --- a/tool/python/examples/mnist_mlp_test.py +++ b/tool/python/examples/mnist_mlp_test.py @@ -1,7 +1,29 @@ #!/usr/bin/env python +#/************************************************************ +#* +#* Licensed to the Apache Software Foundation (ASF) under one +#* or more contributor license agreements. See the NOTICE file +#* distributed with this work for additional information +#* regarding copyright ownership. The ASF licenses this file +#* to you under the Apache License, Version 2.0 (the +#* "License"); you may not use this file except in compliance +#* with the License. You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* Unless required by applicable law or agreed to in writing, +#* software distributed under the License is distributed on an +#* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#* KIND, either express or implied. See the License for the +#* specific language governing permissions and limitations +#* under the License. +#* +#*************************************************************/ + + import sys, os -sys.path.append(os.path.join(os.path.dirname(__file__),'..')) -from singa.model import * +sys.path.append(os.path.join(os.path.dirname(__file__),'..')) +from singa.model import * from examples.datasets import mnist # Sample parameter values for Mnist MLP example @@ -16,7 +38,7 @@ m.add(Dense(2000, init='uniform', activation='tanh')) m.add(Dense(1500, init='uniform', activation='tanh')) m.add(Dense(1000, init='uniform', activation='tanh')) m.add(Dense(500, init='uniform', activation='tanh')) -m.add(Dense(10, init='uniform', activation='softmax')) +m.add(Dense(10, init='uniform', activation='softmax')) sgd = SGD(lr=0.001, lr_type='step') topo = Cluster(workspace) http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/4ebf0bcd/tool/python/examples/mnist_rbm1.py ---------------------------------------------------------------------- diff --git a/tool/python/examples/mnist_rbm1.py b/tool/python/examples/mnist_rbm1.py index 6cf249c..5f22d52 100755 --- a/tool/python/examples/mnist_rbm1.py +++ b/tool/python/examples/mnist_rbm1.py @@ -1,6 +1,28 @@ #!/usr/bin/env python +#/************************************************************ +#* +#* Licensed to the Apache Software Foundation (ASF) under one +#* or more contributor license agreements. See the NOTICE file +#* distributed with this work for additional information +#* regarding copyright ownership. The ASF licenses this file +#* to you under the Apache License, Version 2.0 (the +#* "License"); you may not use this file except in compliance +#* with the License. You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* Unless required by applicable law or agreed to in writing, +#* software distributed under the License is distributed on an +#* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#* KIND, either express or implied. See the License for the +#* specific language governing permissions and limitations +#* under the License. +#* +#*************************************************************/ + + import sys, os -sys.path.append(os.path.join(os.path.dirname(__file__),'..')) +sys.path.append(os.path.join(os.path.dirname(__file__),'..')) from singa.model import * from examples.datasets import mnist @@ -14,7 +36,7 @@ X_train, X_test, workspace = mnist.load_data( m = Energy('rbm'+str(rbmid), sys.argv) -m.add(RBM(1000, w_std=0.1, b_wd=0)) +m.add(RBM(1000, w_std=0.1, b_wd=0)) sgd = SGD(lr=0.1, decay=0.0002, momentum=0.8) topo = Cluster(workspace) http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/4ebf0bcd/tool/python/examples/mnist_rbm2.py ---------------------------------------------------------------------- diff --git a/tool/python/examples/mnist_rbm2.py b/tool/python/examples/mnist_rbm2.py index b5db36e..1544f14 100755 --- a/tool/python/examples/mnist_rbm2.py +++ b/tool/python/examples/mnist_rbm2.py @@ -1,6 +1,28 @@ #!/usr/bin/env python +#/************************************************************ +#* +#* Licensed to the Apache Software Foundation (ASF) under one +#* or more contributor license agreements. See the NOTICE file +#* distributed with this work for additional information +#* regarding copyright ownership. The ASF licenses this file +#* to you under the Apache License, Version 2.0 (the +#* "License"); you may not use this file except in compliance +#* with the License. You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* Unless required by applicable law or agreed to in writing, +#* software distributed under the License is distributed on an +#* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#* KIND, either express or implied. See the License for the +#* specific language governing permissions and limitations +#* under the License. +#* +#*************************************************************/ + + import sys, os -sys.path.append(os.path.join(os.path.dirname(__file__),'..')) +sys.path.append(os.path.join(os.path.dirname(__file__),'..')) from singa.model import * from examples.datasets import mnist @@ -15,7 +37,7 @@ X_train, X_test, workspace = mnist.load_data( m = Energy('rbm'+str(rbmid), sys.argv) out_dim = [1000, 500] -m.add(RBM(out_dim, w_std=0.1, b_wd=0)) +m.add(RBM(out_dim, w_std=0.1, b_wd=0)) sgd = SGD(lr=0.1, decay=0.0002, momentum=0.8) topo = Cluster(workspace) http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/4ebf0bcd/tool/python/examples/mnist_rbm3.py ---------------------------------------------------------------------- diff --git a/tool/python/examples/mnist_rbm3.py b/tool/python/examples/mnist_rbm3.py index be1b789..3a6348d 100755 --- a/tool/python/examples/mnist_rbm3.py +++ b/tool/python/examples/mnist_rbm3.py @@ -1,8 +1,30 @@ #!/usr/bin/env python +#/************************************************************ +#* +#* Licensed to the Apache Software Foundation (ASF) under one +#* or more contributor license agreements. See the NOTICE file +#* distributed with this work for additional information +#* regarding copyright ownership. The ASF licenses this file +#* to you under the Apache License, Version 2.0 (the +#* "License"); you may not use this file except in compliance +#* with the License. You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* Unless required by applicable law or agreed to in writing, +#* software distributed under the License is distributed on an +#* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#* KIND, either express or implied. See the License for the +#* specific language governing permissions and limitations +#* under the License. +#* +#*************************************************************/ + + import sys, os -sys.path.append(os.path.join(os.path.dirname(__file__),'..')) +sys.path.append(os.path.join(os.path.dirname(__file__),'..')) from singa.model import * -from examples.datasets import mnist +from examples.datasets import mnist rbmid = 3 pvalues = {'batchsize' : 100, 'shape' : 784, 'std_value' : 255} @@ -15,7 +37,7 @@ X_train, X_test, workspace = mnist.load_data( m = Energy('rbm'+str(rbmid), sys.argv) out_dim = [1000, 500, 250] -m.add(RBM(out_dim, w_std=0.1, b_wd=0)) +m.add(RBM(out_dim, w_std=0.1, b_wd=0)) sgd = SGD(lr=0.1, decay=0.0002, momentum=0.8) topo = Cluster(workspace) http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/4ebf0bcd/tool/python/examples/mnist_rbm4.py ---------------------------------------------------------------------- diff --git a/tool/python/examples/mnist_rbm4.py b/tool/python/examples/mnist_rbm4.py index a4ee995..8343b4f 100755 --- a/tool/python/examples/mnist_rbm4.py +++ b/tool/python/examples/mnist_rbm4.py @@ -1,8 +1,30 @@ #!/usr/bin/env python +#/************************************************************ +#* +#* Licensed to the Apache Software Foundation (ASF) under one +#* or more contributor license agreements. See the NOTICE file +#* distributed with this work for additional information +#* regarding copyright ownership. The ASF licenses this file +#* to you under the Apache License, Version 2.0 (the +#* "License"); you may not use this file except in compliance +#* with the License. You may obtain a copy of the License at +#* +#* http://www.apache.org/licenses/LICENSE-2.0 +#* +#* Unless required by applicable law or agreed to in writing, +#* software distributed under the License is distributed on an +#* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#* KIND, either express or implied. See the License for the +#* specific language governing permissions and limitations +#* under the License. +#* +#*************************************************************/ + + import sys, os -sys.path.append(os.path.join(os.path.dirname(__file__),'..')) +sys.path.append(os.path.join(os.path.dirname(__file__),'..')) from singa.model import * -from examples.datasets import mnist +from examples.datasets import mnist rbmid = 4 pvalues = {'batchsize' : 100, 'shape' : 784, 'std_value' : 255} @@ -15,7 +37,7 @@ X_train, X_test, workspace = mnist.load_data( m = Energy('rbm'+str(rbmid), sys.argv) out_dim = [1000, 500, 250, 30] -m.add(RBM(out_dim, sampling='gaussian', w_std=0.1, b_wd=0)) +m.add(RBM(out_dim, sampling='gaussian', w_std=0.1, b_wd=0)) sgd = SGD(lr=0.001, decay=0.0002, momentum=0.8) topo = Cluster(workspace)
