Quantum state preparation using tensor networks