Advanced Computing Platform for Theoretical Physics
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Lei Wang
dTRG
Commits
a516ec01
Commit
a516ec01
authored
Dec 04, 2018
by
Lei Wang
Browse files
added timing
parent
26647790
Pipeline
#806
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
trg.py
View file @
a516ec01
...
...
@@ -45,6 +45,7 @@ def levin_nave_trg(T, D, Dcut, no_iter, device='cpu'):
if
__name__
==
'__main__'
:
import
time
import
argparse
parser
=
argparse
.
ArgumentParser
(
description
=
''
)
parser
.
add_argument
(
"-D"
,
type
=
int
,
default
=
2
,
help
=
"D"
)
...
...
@@ -82,11 +83,14 @@ if __name__=='__main__':
T1
=
torch
.
einsum
(
'xa,xby,yc'
,
(
A
,
T
,
A
)).
view
(
D
,
D
,
D
,
D
,
d
,
d
,
d
,
d
,
D
,
D
,
D
,
D
).
permute
(
0
,
4
,
8
,
1
,
5
,
9
,
2
,
6
,
10
,
3
,
7
,
11
).
contiguous
().
view
(
D
**
2
*
d
,
D
**
2
*
d
,
D
**
2
*
d
,
D
**
2
*
d
)
#double layer
T2
=
(
A
.
t
()
@
A
).
view
(
D
,
D
,
D
,
D
,
D
,
D
,
D
,
D
).
permute
(
0
,
4
,
1
,
5
,
2
,
6
,
3
,
7
).
contiguous
().
view
(
D
**
2
,
D
**
2
,
D
**
2
,
D
**
2
)
t0
=
time
.
time
()
loss
=
(
-
levin_nave_trg
(
T1
,
D
**
2
*
d
,
Dcut
,
Niter
)
+
levin_nave_trg
(
T2
,
D
**
2
,
Dcut
,
Niter
))
/
2
**
Niter
print
(
'contraction done {:.3f}s'
.
format
(
time
.
time
()
-
t0
))
print
(
-
loss
.
item
())
print
(
'residual entropy'
,
-
loss
.
item
())
t0
=
time
.
time
()
loss
.
backward
()
print
(
'backward done {:.3f}s'
.
format
(
time
.
time
()
-
t0
))
return
loss
optimizer
.
step
(
closure
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment