We propose an optimization procedure for Euclidean path-integrals that evaluate CFT wave functionals in arbitrary dimensions. The optimization is performed by minimizing certain functional, which can be interpreted as a measure of computational complexity, with respect to background metrics for the path-integrals. In two dimensional CFTs, this functional is given by the Liouville action. We also formulate the optimization for higher dimensional CFTs and, in various examples, find that the optimized hyperbolic metrics coincide with the time slices of expected gravity duals. Moreover, if we optimize a reduced density matrix, the geometry becomes two copies of the entanglement wedge and reproduces the holographic entanglement entropy. Our approach resembles a continuous tensor network renormalization and provides a concrete realization of the proposed interpretation of AdS/CFT as tensor networks. The present paper is an extended version of our earlier report arXiv:1703.00456 and includes many new results such as evaluations of complexity functionals, energy stress tensor, higher dimensional extensions and time evolutions of thermofield double states.