'Returns a key for identifying the optree. The key is depended on the ops
and the id of the tensors. Since __eq__ is overloaded, need to manage
the hashing of the OpTreeNode manually.
Returns:
tuple: optree key'

def key(self):

    stack = self.traverse(list())
    for i in range(len(stack)):
        if (type(stack[i]) is dict):
            if ('axis' in stack[i]):
                stack[i] = (stack[i]['op'], stack[i]['axis'])
            else:
                stack[i] = stack[i]['op']
    return tuple(stack)
