Skip to content
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

I want to know how the file named 'main_loop.tar"came about #1203

Open
DL15879104631 opened this issue Jun 23, 2020 · 0 comments
Open

I want to know how the file named 'main_loop.tar"came about #1203

DL15879104631 opened this issue Jun 23, 2020 · 0 comments

Comments

@DL15879104631
Copy link

from theano import tensor

from blocks.main_loop import MainLoop
from blocks.bricks import MLP, Tanh, Softmax
from blocks.model import Model
mlp = MLP([Tanh(), None], [784, 10, 10])
x = tensor.matrix('features')
y = tensor.lmatrix('targets')
cost = Softmax().categorical_cross_entropy(
... y.flatten(), mlp.apply(tensor.flatten(x, outdim=2)))
main_loop = MainLoop(None, None, model=Model(cost))
Let's see how the main loop is dumped by :func:dump
from blocks.serialization import dump, load
import tarfile
with open(' main_loop.tar', 'wb') as dst:
... dump(main_loop, dst)
tarball = tarfile.open('main_loop.tar', 'r')
tarball # doctest: +ELLIPSIS
<tarfile.TarFile object at ...>
tarball.getnames()
['_pkl']
tarball.close()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant