Fix bug in render_network - #2
Conversation
L121 makes it so that `index` is never 0
|
ahh good catch with the |
|
|
||
| weights = ','.join(map(str,lp.weight[i].data.tolist())) | ||
| bias =','.join(map(str,lp.bias[i].data.tolist())) | ||
| try: |
There was a problem hiding this comment.
I am guessing you have 1 feature in the input so this was causing an issue?
There was a problem hiding this comment.
I encountered this on the 2-alanine example, so there's 4 (2 sin and 2 cos).
There was a problem hiding this comment.
hmm, weird, i will investigate this further then.
There was a problem hiding this comment.
This code gives the correct behavior without in both instances if lp is a list but it is possible that pytorch has changed how it returns the bias when tolist() is called.
In [12]: lp=[1]
In [13]: ','.join(map(str,lp))
Out[13]: '1'
In [14]: lp=[1,2,3,4]
In [15]: ','.join(map(str,lp))
Out[15]: '1,2,3,4'There was a problem hiding this comment.
basically, we only need a str that can be streamed to text file for plumed
There was a problem hiding this comment.
Yes, the problem I was running in to was that tolist was returning a scalar, i.e .','.join(map(str, 1)), which results in a TypeError since 1 is not iterable
|
if you are done with the PR, i can merge the changes. Thanks for bringing these in, I really appreciate it. |
|
Sure go ahead and merge, I'll send more as I work. FYI I'm using the vde package under msmbuilder |
| try: | ||
| bias =','.join(map(str,lp.bias[i].data.tolist())) | ||
| except TypeError: | ||
| bias = str(lb.bias[i].data.tolist()) |
There was a problem hiding this comment.
this should be lp.bias[i] not lb.bias[i]
L121 makes it so that
indexis never 0This change is