Created
December 22, 2015 10:28
-
-
Save delta2323/a2973cf142c8a1e24212 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from chainer import links | |
from chainer import serializers | |
import numpy | |
cls = links.Classifier(links.Linear(10, 10)) | |
cls.add_persistent('k', numpy.random.uniform(-1, 1, (1, 3))) | |
print cls._persistent # => ['k'] | |
print cls.k # => [[-0.76103399 0.09844306 -0.25231615]] | |
serializers.save_hdf5('test.hd5', cls) | |
cls2 = links.Classifier(links.Linear(10, 10)) | |
cls2.add_persistent('k', numpy.empty((1, 3))) | |
serializers.load_hdf5('test.hd5', cls2) | |
print cls2._persistent # => ['k'] | |
print cls2.k # => [[-0.76103399 0.09844306 -0.25231615]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment