'Execute the optree. Break optree into sub-optrees if necessary.
Arguments:
optree: (OpTreeNode): the OpTreeNode object that represents all
the operations'

def execute(self, optree, numpy_call_dict=numpy_call_dict_cpu):

    if ((len(optree) == 3) and isinstance(optree[2], OpTreeNode) and (optree[2][0]['op'] == 'onehot')):
        assert (optree[0]['op'] == 'assign')
        assert isinstance(optree[1], Tensor)
        array_output = optree[1]._tensor
        numpy_axis = optree[2][0]['axis']
        numpy_ind0 = optree[2][0]['idx']._tensor.squeeze()
        numpy_ind_len = numpy_ind0.size
        numpy_ind1 = list(range(numpy_ind_len))
        numpy_ind = np.zeros((2, numpy_ind_len), dtype=np.int32)
        numpy_ind[numpy_axis] = numpy_ind0
        numpy_ind[(1 - numpy_axis)] = numpy_ind1
        array_output[:] = 0
        array_output[numpy_ind.tolist()] = 1
        return array_output
    postfix_stack = optree.traverse(list())
    compute_stack = []
    for p in postfix_stack:
        if isinstance(p, dict):
            if (p['op'] in OpCollection.unary_ops):
                left = compute_stack.pop()
                compute_stack.append(numpy_call_dict[p['op']](left))
            elif (p['op'] in OpCollection.binary_ops):
                right = compute_stack.pop()
                left = compute_stack.pop()
                compute_stack.append(numpy_call_dict[p['op']](left, right))
            elif (p['op'] in OpCollection.reduction_ops):
                left = compute_stack.pop()
                compute_stack.append(numpy_call_dict[p['op']](p, left))
            elif (p['op'] in OpCollection.zero_operand_ops):
                compute_stack.append(numpy_call_dict[p['op']](None))
            else:
                raise NotImplementedError
        elif isinstance(p, CPUTensor):
            compute_stack.append(p._tensor)
        else:
            compute_stack.append(p)
    assert (len(compute_stack) == 1)
    return postfix_stack[0]
