7053e01281232b62746e7e607c2bda520f8e58ab,misc/calc_speed.py,,test_conv,#Any#Any#Any#Any#Any#,49
Before Change
def test_conv(L, B, N, k=2, train=False):
reset_seed()
a = Variable(torch.randn(B, 1, L, N).float().cuda() )
conv = nn.Conv2d(1, N, (k, N)).cuda()
if train: conv.train()
torch.cuda.synchronize()
start = time.time()
for i in range(T):
out = conv(a)
out.sum().backward()
torch.cuda.synchronize()
print (("test_conv: {:.6f}").format(
(time.time()-start)/T
))
After Change
def test_conv(L, B, N, k=2, train=False):
reset_seed()
a = Variable(torch.randn(B, 1, L, N).float().cuda()*0.1 )
conv = nn.Conv2d(1, N, (k, N)).cuda()
if train: conv.train()
torch.cuda.synchronize()
start = time.time()
tot = 0
for i in range(T):
out = conv(a)
tot += out.data[-1,-1,-1,-1]
if train:
conv.zero_grad()
out.mean().backward()
torch.cuda.synchronize()
print (("test_conv: {:.6f}").format(
(time.time()-start)/T
))
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 15
Instances Project Name: asappresearch/sru
Commit Name: 7053e01281232b62746e7e607c2bda520f8e58ab
Time: 2018-07-25
Author: tao@asapp.com
File Name: misc/calc_speed.py
Class Name:
Method Name: test_conv
Project Name: asappresearch/sru
Commit Name: 7053e01281232b62746e7e607c2bda520f8e58ab
Time: 2018-07-25
Author: tao@asapp.com
File Name: misc/calc_speed.py
Class Name:
Method Name: test_fast
Project Name: asappresearch/sru
Commit Name: 7053e01281232b62746e7e607c2bda520f8e58ab
Time: 2018-07-25
Author: tao@asapp.com
File Name: misc/calc_speed.py
Class Name:
Method Name: test_lstm