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

allow sharing for tensorflow and theano as numpy backends #58

Merged
merged 2 commits into from
Aug 29, 2018

Conversation

jcmgray
Copy link
Collaborator

@jcmgray jcmgray commented Aug 28, 2018

Description

Allows sharing to be used with tensorflow and theano as numpy backends. Closes #50. The to_{backend} functions are all called internally within their respective {backend.py} submodules so I didn't try and factorize out a new to_backend function. I think it will be pretty easy (and rare) to add new conversion backends anyway. Also the tests are in test_backends.py rather than test_sharing.py just because the tensorflow tests require a session, and the theano tests can't use einsum itself.

Status

  • Ready to go


.. math::

M_{pqrs} = C_{pi} C_{qj} I_{ijkl} C_{rk} C_{sl}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah this has crept in as a small docs change. Can remove if necessary @dgasmith.

@jcmgray jcmgray mentioned this pull request Aug 28, 2018
3 tasks
@codecov-io
Copy link

Codecov Report

Merging #58 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Copy link
Owner

@dgasmith dgasmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I think the doc change is a good one and we have mathjax setup already.

@fritzo Any comments?

Copy link
Contributor

@fritzo fritzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good. Do you want to add tensorflow and theano to the sharing test?

@jcmgray
Copy link
Collaborator Author

jcmgray commented Aug 29, 2018

Yes that would have been nice but I've ended up adding them to test_backends.py tests for two reasons:

  1. tensorflow requires a Session object to be setup and torn down between runs (which is defined with a special config in test_backends.py.
  2. theano doesn't provide einsum and so can't actually perform many of the test contractions in the test_sharing.py

I didn't think too hard about unifying the tests but it is probably possible.

Copy link
Contributor

@fritzo fritzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable, I think the tests are fine separated. Mostly the test_sharing.py tests ensure that the cache mechanism actually works, so it sounds reasonable to combine (1) heavy tests for a few backends + (2) smoke tests for the rest.

@dgasmith dgasmith merged commit 1117f09 into dgasmith:master Aug 29, 2018
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

Successfully merging this pull request may close these issues.

4 participants