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

input fixes and docs #72

Merged
merged 3 commits into from
Oct 21, 2018
Merged

input fixes and docs #72

merged 3 commits into from
Oct 21, 2018

Conversation

jcmgray
Copy link
Collaborator

@jcmgray jcmgray commented Oct 20, 2018

Description

Makes contract_expression accept interleaved-style input (fixes #71) and adds general documentation on the input formats (resolves #70) following on from #67.

Questions

  • I've moved the input section into the main doc sections as this seemed quite natural?

Status

  • Ready to go

@codecov-io
Copy link

Codecov Report

Merging #72 into master will increase coverage by 0.18%.
The diff coverage is 100%.

@dgasmith
Copy link
Owner

This pull request introduces 1 alert when merging aa47e5b into 7daf290 - view on LGTM.com

new alerts:

  • 1 for Syntax error

Comment posted by LGTM.com

>>> z.shape
(5, 2)

The main difference is that thousands of symbols in the form of unicode
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe explicitly say "In addition to standard characters, opt_einsum also supports unicode..." or the like?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes good idea.

@@ -805,6 +805,9 @@ def contract_expression(subscripts, *shapes, **kwargs):
raise ValueError("'{}' should only be specified when calling a "
"`ContractExpression`, not when building it.".format(arg))

if not isinstance(subscripts, compat.strings):
Copy link
Owner

Choose a reason for hiding this comment

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

Any reason why we just do not call parse_einsum_input here? It would be good, if possible to always parse the input at a single location. I think current parse_einsum_input does not yet support non-array like inputs such as tuples, but this should easy to correct I believe.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So, it's just because contract_expression routes through contract and all its machinery once the shapes and constants are processed and thus parse_einsum_input will be called again anyway. The only reason convert_interleaved_input is needed here (which will then not be called again), is to simplify the constants processing.

One option might be have contract accept a tuple of the parsed inputs, or a is_parsed option or something, so that contract_expression could do the parsing and call contract with the guarantee that it is already parsed.

Copy link
Owner

Choose a reason for hiding this comment

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

It might be good to break out the inner contract loops at some point to make the actual iterations more flexible.

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.

Looks good, thanks!

@dgasmith dgasmith merged commit dbf284b into dgasmith:master Oct 21, 2018
@dgasmith dgasmith added this to the v2.3 milestone Oct 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

let contract_expression use interleaved input Finish out input documentation
3 participants