Skip to content

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

@DL15879104631

Description

@DL15879104631

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions