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

Default object is null. in functions.dropout() #42

Open
vbkaisetsu opened this issue Jul 25, 2018 · 0 comments
Open

Default object is null. in functions.dropout() #42

vbkaisetsu opened this issue Jul 25, 2018 · 0 comments

Comments

@vbkaisetsu
Copy link
Contributor

Example code:

In [1]: from primitiv import Device, Graph, functions, devices, Shape

In [2]: dev = devices.Naive()

In [3]: Device.set_default(dev)

In [4]: g = Graph()

In [5]: Graph.set_default(g)

In [6]: node = functions.ones([2,2])

In [7]: node2 = functions.dropout(node, 0.5, True)
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-7-a7a723262cfe> in <module>()
----> 1 node2 = functions.dropout(node, 0.5, True)

/home/koichi/developments/primitiv/primitiv-python/primitiv/_function.pyx in primitiv._function.functions.dropout()

RuntimeError: /home/koichi/developments/primitiv/primitiv-python/primitiv-core/primitiv/mixins.h: 121: Default object is null.

dropout internally calls random::bernoulli, which can take a Graph object, without setting a graph, so random::bernoulli tries to use the default graph. However, primitiv-python no longer use C++'s set_default (#41).

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

No branches or pull requests

1 participant