This repository was archived by the owner on Nov 7, 2024. It is now read-only.
Repository navigation
Add eigenvector=True to torch.symeig due to pytorch=1.4.0 release (#427) - #467
Merged
Merged
Conversation
BaseNode class - Add protection to name, axis_names *Protected in 3 place *Initialize stage - __init__ *Function use setting - set_name / add_axis_names *Property - Add @Property to name to protect direct adding node.name = 123 Edge class - Add protection to name *Protected in 3 place *Initialize stage - __init__ *Function use setting - set_name *Property
*if type(name) != str *if not isinstance(name, str) *change using type to isinstance to follow pylint
…ogle#427) Due to pytorch 1.4.0 version release the torch.symeig now return 0-element eigenvector tensor when eigenvectors=False(default) To fix this add the eigenvector=True parameter to where torch.symeig is used *1. pytorch_backend.py - pytorch_backend.eigsh_lanczos *2. pytorch_backend_test.py - test_eigsh_lanczos_1 - test_eigsh_lanczos_2 - test_eigsh_lanczos_reorthogonalize
Contributor
Author
|
@MichaelMarien Sorry for late bit busy :) I finally had time to investigate today |
chaserileyroberts
left a comment
Contributor
There was a problem hiding this comment.
Thank you Ducky!
Can you change the requirements_travis.txt to remove the version requirement for pytorch?
remove pytorch version requirement (==1.3.1) and replace it to (>=1.1)
Contributor
Author
|
@Thenerdstation Sure I changed torch version from (==1.3.1) to (>=1.1) what originally placed 😃 |
Contributor
|
Beautiful. Thanks! |
chaserileyroberts
approved these changes
Feb 13, 2020
mganahl
added a commit
that referenced
this pull request
Feb 18, 2020
* default value changed * fixed bug, old version is now faster again * cleaned up reshape * started adding tests * replace kron with broadcasting * column-major -> row-major * documentation * added function to compute unique charges and charge degeneracies Function avoids explicit full fusion of all legs, and instead only keeps track of the unique charges and their degeneracies upon fusion * improved block finding, fixed bug in reshape re-intorduced BlockSparseTensor.dense_shape new method for fusing charges and degeneracies (faster for very rectangular matrices) * fuse_charge_pair added fuse_charges added * use is_leave * new tests * removed TODO, BlockSparseTensor.shape returns ref instead of copy * added tests * added tests * column-major -> row-major forgot to fix fusing order of charges and degeneracies * fix broken tests * test added * mostly docstring * docstring * added map_to_integer * test for map_to_integer * added functions to find sparse positions when fusing two charges * renaming of routines * added unfuse * test unfuse * fixed bug in the new routine for finding diagonal blocks * test added * docstring * added tests * renaming * tests * transpose added, map_to_integer removed (used np.unravel_index and np.ravel_multi_index instead) * find_dense_positions made faster * working on transpose * transpose modified * Index.name -> property * added charge types * adding tests * fixing bugs * implementing more symmetries * typo + remove cython lookup * split charge.py from index.py * tests for charge.py * test added * added matmul * added test for matmul * tests + allow np.int8 * typo * undo typo * test\ * savety commit, starting to add multiple charges * Charge -> ChargeCollection * removed offsets from U1Charge (unnecessary), Charge -> ChargeCollection * new tests * tests for new index * new Index class * new block tensor * shorter code * add __eq__, remove nonzero, add unique * working on charges.py * fix small bug in BaseCharge.__init__ * fix tests after bugfix * tests for equals() and __eq__ * added equals() for comparing with unshifted target charges __eq__ now only compares shifted target charges * added typing * ChargeCollection.__repr__ modified * *** empty log message *** * this commit is not working * fix bug in __len__ fix various bugs in __eq__ and __getitem__ * working in implemetation of multiple charges * bugfix in ChargeCollection.__getitem__ * adding tests * sleep commit * added iterators * ChargeCollection.__init__: charges are now always stacked, self.charges contain views to the stacked charges __init__ can be called with optional shifts and stacked_charges to initialize the BaseCharges object with it * lunch commit * back from lunch * tests added * ported find_sparse_positions and find_diagonal_sparse_blocks to new charge interface * broken commit * fixed bug in find_dense_positions * fix bug in find_dense_positions * docstring * fix bug in Index initialization * fix bug in Index initialization * typo * remove __rmul__ calls of ChargeCollection and BaseCharge * removed __rmul__ * removed some bugs inb transpose * broken commit * broken commit * remove csr matrix, use search sorted * remove unfuse, use divmod * broken commit, working on tensordot * tensordot implemented, not tested * removed commented codex * fix tests * fix tests * added test for BlockSparseTensor back * renaming files * fix tutorial, fix import * faster find_dense_positions * added intersect to BaseCharge * broken commmit (Apple sucks big time) * broken commit * broken commit * broken commit * broken commit * broken * added `return_indices` to intersect * faster transpose + tensordot implementation * rewrote find_dense_positions to take multipe charges avoids a for loop in _find_diagonal_dense_blocks and speeds up the code * find_sparse_positions update to be a tiny bit faster * fix bug in _get_diagonal_dense_blocks * fix bug * fixed bug in transpose * fixed final_order passing for tensordot * improved performance, but only u1 currently supported in this commit * merging Glen's and my code * fix bug in unique * adding/removing tests * add benchmark file * adding files * deleted some files * fix bug * renaming and shortening * cleaning up code * cleaning up * removed _check_flows * remove a print * fix bug * nothing * fix big in flatten_meta_data * added bunch of tests * added inner and outer product * removed binary tree, switched to a list of charges * added copy() * bugfix * added __add__ __sub__ __mul__ __rmul__ * added __eq__ * change dosctring * added svd * better check * add proper compute_uv flag , remove artifact return values * added qr, eigh, eig * added tests * fix tests * fix index bugs * fixed bug in unique * renaming some variables mostly * renaming some variables mostly * added decompositions * svd now returns singvals in a vector * svd_decomposition returns s in a vector now * fix tests * fix tests * added ChargeArray, a 1d array storing a vector and charges * fix bug in decompositions.py * adding ChargeArray, and some other stuff * added test * added tests * change trunction to have same connvention as other backends * added sqrt * added bunch of linalg and initialization * more tests * fix return values of flat_flows * added tests * added test * added __len__ * added tests * adding tests * added bunch of tests * linting * linting * linting * typing * linting * fix typing * fix tutorial * added __init__ * added __init__ * rename module block_tensor -> block_sparse * fixed bug in tensordot * add symmetric backend * ChargeArray: index-> indices * fix rand and random of ChargeArray * add symmetric support to split_node * raise error in convert_to_tensor * formatting * add tests for symmetric backend * linting * added tests, typing, linting and other * tests added * fix trace issues * fix issue in todense() * add tests * fix tests * fix tests * fix benchmark * linting + tests * linting * fix test * fixed broken test * fix fix * fix bug in reshape * fix bugs * added `sparse_shape` to backends * add flag to BlockSparseTensor.__init__ to skip checks * Add eigenvector=True to torch.symeig due to pytorch=1.4.0 release (#427) (#467) * BaseNode / Edge class text input protection added (#423) BaseNode class - Add protection to name, axis_names *Protected in 3 place *Initialize stage - __init__ *Function use setting - set_name / add_axis_names *Property - Add @Property to name to protect direct adding node.name = 123 Edge class - Add protection to name *Protected in 3 place *Initialize stage - __init__ *Function use setting - set_name *Property * BaseNode / Edge class text input protection code revise (#423) *if type(name) != str *if not isinstance(name, str) *change using type to isinstance to follow pylint * Add eigenvector=True to torch.symeig due to pytorch=1.4.0 release (#427) Due to pytorch 1.4.0 version release the torch.symeig now return 0-element eigenvector tensor when eigenvectors=False(default) To fix this add the eigenvector=True parameter to where torch.symeig is used *1. pytorch_backend.py - pytorch_backend.eigsh_lanczos *2. pytorch_backend_test.py - test_eigsh_lanczos_1 - test_eigsh_lanczos_2 - test_eigsh_lanczos_reorthogonalize * Update requirements_travis.txt (#427) remove pytorch version requirement (==1.3.1) and replace it to (>=1.1) Co-authored-by: Chase Roberts <chaseriley@google.com> * indices are gone from BlockSparseTensor.__init__ transposes are now lazy * fixed tests to conform to new lazy transpose and tensor layout * fixed some issues in diag, change compute_sparse_lookup * remove commented code * fix pinv * fix * pinv fixed * fix return types of empty result in _find_transposed_diagonal_sparse_blocks * fix bug in trace * clean code * fix tests for backend * docstrings * docstrings * remove commented code * remove commented code * fix typing * docstrings * linting * linting * change requirements: np >= 1.17 Co-authored-by: Hyunbyung, Park <hyunbyung87@gmail.com> Co-authored-by: Chase Roberts <chaseriley@google.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #427
Due to pytorch 1.4.0 version release the torch.symeig now return 0-element eigenvector tensor when eigenvectors=False(default)
https://github.com/pytorch/pytorch/releases
TensorNetwork/tensornetwork/backends/pytorch/pytorch_backend.py
Lines 269 to 274 in 217329c
The upper code
A_tridiag.symeig()return the value at the following table.So it brakes at
state += vec * u[n1, n2]because there is nothing at uSo we have to add eigenvector=True to the
torch.symeigA_tridiag.symeig()->A_tridiag.symeig(eigenvector=True)To fix this add the eigenvector=True parameter to where torch.symeig is used