def compute_mul(tree):
 (neg, inputs) = tree
 if (inputs is None):
  raise AssertionError('Function `compute_mul` found a missing leaf, did you forget to call `simplify_mul` on the tree first?')
 elif isinstance(inputs, list):
  rval = tensor.mul(*list(map(compute_mul, inputs)))
 else:
  rval = inputs
 if neg:
  rval = (- rval)
 return rval

def compute_mul ( tree ) : ( neg , inputs ) = tree if ( inputs is None ) : raise AssertionError ( 'Function `compute_mul` found a missing leaf, did you forget to call `simplify_mul` on the tree first?' ) elif isinstance ( inputs , list ) : rval = tensor . mul ( * list ( map ( compute_mul , inputs ) ) ) else : rval = inputs if neg : rval = ( - rval ) return rval
compute the variable that is the output of a multiplication tree .