def multi_meshgrid(*args):
	"""
	Creates a meshgrid from possibly many
	elements (instead of only 2).
	Returns a nd tensor with as many dimensions
	as there are arguments
	"""
	args = list(args)
	template = [1 for _ in args]
	for i in range(len(args)):
		n = args[i].shape[0]
		template_copy = template.copy()
		template_copy[i] = n
		args[i] = args[i].view(*template_copy)
		# there will be some broadcast magic going on
	return tuple(args)