def create(
        cls,
        *,
        initial_state: np.ndarray | cirq.STATE_VECTOR_LIKE = 0,
        qid_shape: tuple[int, ...] | None = None,
        dtype: type[np.complexfloating] | None = None,
        buffer: np.ndarray | None = None,
    ):
        """Initializes the object with the inputs.

        This initializer creates the buffer if necessary.

        Args:
            initial_state: The state vector, must be correctly formatted. The data is not
                checked for validity here due to performance concerns.
            qid_shape: The shape of the state vector, if the initial state is provided as an int.
            dtype: The dtype of the state vector, if the initial state is provided as an int.
            buffer: Optional, must be length 3 and same shape as the state vector. If not
                provided, a buffer will be created automatically.
        Raises:
            ValueError: If initial state is provided as integer, but qid_shape is not provided.
        """
        if not isinstance(initial_state, np.ndarray):
            if qid_shape is None:
                raise ValueError('qid_shape must be provided if initial_state is not ndarray')
            state_vector = qis.to_valid_state_vector(
                initial_state, len(qid_shape), qid_shape=qid_shape, dtype=dtype
            ).reshape(qid_shape)
        else:
            if qid_shape is not None:
                state_vector = initial_state.reshape(qid_shape)
            else:
                state_vector = initial_state
            if np.may_share_memory(state_vector, initial_state):
                state_vector = state_vector.copy()
        state_vector = state_vector.astype(dtype, copy=False)
        return cls(state_vector, buffer)
Initializes the object with the inputs.

        This initializer creates the buffer if necessary.

        Args:
            initial_state: The state vector, must be correctly formatted. The data is not
                checked for validity here due to performance concerns.
            qid_shape: The shape of the state vector, if the initial state is provided as an int.
            dtype: The dtype of the state vector, if the initial state is provided as an int.
            buffer: Optional, must be length 3 and same shape as the state vector. If not
                provided, a buffer will be created automatically.
        Raises:
            ValueError: If initial state is provided as integer, but qid_shape is not provided.
        
cirq-core/cirq/sim/state_vector_simulation_state.py