KEMBAR78
[Numpy] einsum by hzfan · Pull Request #15911 · apache/mxnet · GitHub
Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Conversation

@hzfan
Copy link
Contributor

@hzfan hzfan commented Aug 15, 2019

Description

numpy compatible einsum

Changes

  • add einsum
  • add einsum doc
  • add path optimization
  • add benchmark
  • add forward and backward test

Comments

  • support both explicit and implicit mode
  • support multiple operands
  • support broadcast
  • support 0-dim NDArray and 0-size NDArray
  • cannot work until multiple tempspace is enabled
    • einsum make use of multiple temspace, but set MXNET_GPU_TEMP_COPY to 4 triggers a bug
    • simply to set MXNET_GPU_TEMP_COPY to 4 (without the presence of einsum) triggers the bug. So this might be a bug of mxnet itself.
    • solution 1: fix the bug (may be difficult)
    • solution 2: implement einsum in another way and sidestep this feature.

TODO

  • translate einsum_path into c, so that optimization can work in symbol mode
  • take advantage of tensordot when it is merged
  • support "greedy" optimization
  • support "optimal" optimization

Thank @reminisce and @haojin2 for guidance and review.

@hzfan hzfan requested a review from szha as a code owner August 15, 2019 14:35
@roywei roywei added the Numpy label Aug 19, 2019
@hzfan hzfan force-pushed the einsum_pr branch 8 times, most recently from 3f09f54 to 1cf94c0 Compare October 15, 2019 07:31
@hzfan hzfan force-pushed the einsum_pr branch 5 times, most recently from 7e8b2b5 to 4ee2332 Compare October 18, 2019 19:18
@reminisce reminisce merged commit a75ec06 into apache:master Oct 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants