def test_peepholelstm_temporal_connection(node, use_gpu): node = Variable(node) assert_cuda_active(use_gpu) layer1 = rm.PeepholeLstm(output_size=4) def func(node): loss = 0 for _ in range(3): loss = sum(layer1(node)) layer1.truncate() return loss compare(func, node, node) for k in layer1.params.keys(): compare(func, layer1.params[k], node)
def test_peepholelstm(node, use_gpu, ignore_bias): node = Variable(node) assert_cuda_active(use_gpu) layer1 = rm.PeepholeLstm(output_size=4, ignore_bias=ignore_bias) def func(node): loss = 0 for _ in range(3): loss += sum(layer1(node)) layer1.truncate() return loss compare(func, node, node) for k in layer1.params.keys(): try: compare(func, layer1.params[k], node) except Exception: assert ignore_bias