-
Notifications
You must be signed in to change notification settings - Fork 13
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
Sketch out conj method #46
Open
dallonasnes
wants to merge
15
commits into
dev
Choose a base branch
from
conj-api
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+469
−0
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
eeba989
Sketch out conj method
dallonasnes 69d0341
add draft of tn api
danlkv 0d74462
Use np sliced buckets method from qtree
dallonasnes b0645a2
Update
dallonasnes d7e24c2
Address comments
dallonasnes 1aafd05
Cleanup
dallonasnes 3533289
progress
dallonasnes ea2a43c
Bugfixes
dallonasnes 0c91a8f
Progress
dallonasnes dbeee3d
Progress
dallonasnes 1d7271b
Notes
dallonasnes 0026283
Cleanup
dallonasnes b48ea18
Progress after meeting
dallonasnes efbab98
Fix copy so that it is not in place
dallonasnes 1631afb
Stuck
dallonasnes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM nvidia/cuda:11.0.3-runtime-ubuntu20.04 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt update -y && \ | ||
apt install -y python3 python3-pip git htop vim | ||
|
||
# Make sure you first recursively clone down the git repo before building | ||
WORKDIR /app | ||
RUN pip install quimb pyrofiler cartesian-explorer opt_einsum | ||
RUN pip install --no-binary pynauty pynauty | ||
# Run the below commands after the container opens - because volume hasn't mounted yet | ||
# RUN cd qtree && pip install . | ||
# RUN pip install . | ||
RUN pip install pdbpp | ||
RUN pip install tensornetwork | ||
|
||
ENTRYPOINT ["bash"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
docker build -f Dockerfile.dev -t dev . | ||
docker run -v $(pwd):/app -it dev |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import random | ||
import numpy as np | ||
from tn import TensorNetwork | ||
from functools import reduce | ||
|
||
def test_add_numpy_array(): | ||
a = TensorNetwork() | ||
t = np.random.randn(2, 2) | ||
a.add(t) | ||
b = TensorNetwork() | ||
b.add(a) | ||
assert b == a | ||
|
||
|
||
def test_composition(): | ||
""" | ||
tensor network adding is associative | ||
""" | ||
tns = [TensorNetwork.new_random_cpu(2, 3, 4) for _ in range(5)] | ||
stack = TensorNetwork() | ||
# (((0A)B)C)D | ||
for tn in tns: | ||
stack.add(tn) | ||
# A(B(CD)) | ||
for i in range(len(tns)): | ||
l = tns[len(tns)-2-i] | ||
r = tns[len(tns)-1-i] | ||
l.add(r) | ||
|
||
assert stack == tns[0] | ||
|
||
def test_edges_consistent_ports(): | ||
tns = [TensorNetwork.new_random_cpu(2, 3, 4) for _ in range(5)] | ||
tn = TensorNetwork() | ||
# (((0A)B)C)D | ||
for t in tns: | ||
tn.add(t) | ||
|
||
port_data = {} | ||
for e in tn._edges: | ||
for p in e: | ||
port_data[p.tensor_ref] = port_data.get(p.tensor_ref, []) | ||
port_data[p.tensor_ref].append(p.ix) | ||
for i, t in enumerate(tn._tensors): | ||
assert len(t.shape) == len(port_data[i]) | ||
|
||
|
||
|
||
if __name__=="__main__": | ||
test_edges_consistent_ports() | ||
test_composition() |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danlkv this is my TODO for next week