def _create_attack_loss(
        self,
        initial_input: "Tensor",
        current_value: "Tensor",
        custom_loss: "Tensor" | None = None,
    ) -> "Tensor":
        """
        Create the loss tensor of this attack.

        :param initial_input: Initial input.
        :param current_value: Current image/texture.
        :param custom_loss: Custom loss function from users.
        :return: Attack loss tensor.
        """
        import tensorflow as tf

        # Compute faster rcnn loss
        partial_faster_rcnn_loss = self._create_faster_rcnn_loss()

        # Compute box loss
        partial_box_loss = self._create_box_loss()

        # Compute RPN loss
        partial_rpn_loss = self._create_rpn_loss()

        # Compute similarity loss
        weight_similarity_loss = self._create_similarity_loss(initial_input=initial_input, current_value=current_value)

        # Compute total loss
        if custom_loss is not None:
            total_loss = tf.add_n(  # pragma: no cover
                [partial_faster_rcnn_loss, partial_box_loss, partial_rpn_loss, weight_similarity_loss, custom_loss],
                name="total_loss",
            )

        else:
            total_loss = tf.add_n(
                [partial_faster_rcnn_loss, partial_box_loss, partial_rpn_loss, weight_similarity_loss],
                name="total_loss",
            )

        return total_loss

        Create the loss tensor of this attack.

        :param initial_input: Initial input.
        :param current_value: Current image/texture.
        :param custom_loss: Custom loss function from users.
        :return: Attack loss tensor.
        
art/attacks/evasion/shapeshifter.py