Skip to content

Random number generation and modules (and simplification again) #58

Description

@sbos

It seems that there are still problems with simplification of random number generation operation if they are encapsulated into modules.

The following code prints two last lines equal when simplification is turned on:

import cgt
import cgt.nn as nn

z1 = cgt.randn()
z2 = cgt.randn()

m = nn.Module([cgt.scalar()], [z1, z2])
f = cgt.function([], m([0.]))

print 'A', f()
print 'A', f()

z = cgt.randn(2)
m = nn.Module([cgt.scalar()], [z])

f = cgt.function([], m([0.]) + m([0.]))

print 'B', f()
print 'B', f()

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions