def bilinear(e1, e2, W, V1=None, V2=None, b=None):
 flags = [(V1 is None), (V2 is None), (b is None)]
 if any(flags):
  if (not all(flags)):
   raise ValueError('All coefficients and bias for bilinear() must be None, if at least one of them is None.')
  return BilinearFunction()(e1, e2, W)
 else:
  return BilinearFunction()(e1, e2, W, V1, V2, b)

def bilinear ( e1 , e2 , W , V1 = None , V2 = None , b = None ) : flags = [ ( V1 is None ) , ( V2 is None ) , ( b is None ) ] if any ( flags ) : if ( not all ( flags ) ) : raise ValueError ( 'All coefficients and bias for bilinear() must be None, if at least one of them is None.' ) return BilinearFunction ( ) ( e1 , e2 , W ) else : return BilinearFunction ( ) ( e1 , e2 , W , V1 , V2 , b )
applies a bilinear function based on given parameters .