def chain_dot(*arrs):
 return reduce((lambda x, y: np.dot(y, x)), arrs[::(-1)])

def chain_dot ( * arrs ) : return reduce ( ( lambda x , y : np . dot ( y , x ) ) , arrs [ : : ( - 1 ) ] )
returns the dot product of the given matrices .