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

Variable number of arguments, or partially modified variables on Tape. #7

Open
rainwoodman opened this issue Jan 17, 2017 · 1 comment

Comments

@rainwoodman
Copy link
Member

How do we write the Force operator as separate operations?

code.Paint()
for d in range(3):
    code.MeshForce(d)
    code.ReadOut(d, acc='acc')

The problem is acc is modified in place, and we need to save three copies on the tape, each of which 2/3 is not useful.

code.Paint()
for d in range(3):
    code.MeshForce(d)
    code.ReadOut(d, acc='acc-%d' % d)
code.Concatenate(src=['acc-%d' for d in range(3)], out='acc')

This is cleaner on the tape, but require us to be able to handle list of arguments, and require us to be aware of types of arguments.

@rainwoodman
Copy link
Member Author

The first approach may work, if we do not need acc in gradients.

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