Test video data with variable frames number by using multiple GPUs

I would like to do the task of testing videos with different frames. Currently I create the test_loader with batch_size = 1, and split the temporal frames into multiple chunks with the same tensor size, just using single GPU now.

How to make this code work with multiple GPUs? Thanks.

for i, (input, target) in enumerate(test_loader):
	target = target.cuda(async=True)
	input_var = torch.autograd.Variable(input, volatile=False)

	# split input 
	# [Batch_sizeL, 3L, framesL, 224L, 224L]
	# to
	# [Batch_sizeL, 3L, durationL, 224L, 224L] * n, (framesL = durationL * n)

	chunk_num = input.size()[2]/duration
	input_var = torch.chunk(input_var, chunk_num, 2)

	scores = torch.zeros(1, args.num_classes).cuda()
	for in_chunk in input_var:
		# in_chunk is in size of [1L, 3L, durationL, 224L, 224L]
		out_chunk = model(in_chunk)
		scores.add_(F.softmax(out_chunk).data) # [1L, num_classL]