@ ExperimentalCoroutinesApi <EOL> public fun < T > ObservableValue < T > . asFlow ( ) : Flow < T >

= callbackFlow < T > { <EOL> val listener = ChangeListener < T > { _ , _ , newValue -> <EOL> trySend ( newValue ) <EOL> } <EOL> addListener ( listener ) <EOL> send ( value ) <EOL> awaitClose { <EOL> removeListener ( listener ) <EOL> } <EOL> } . flowOn ( Dispatchers . JavaFx ) . conflate ( )

/**
 * Creates an instance of a cold [Flow] that subscribes to the given [ObservableValue] and emits
 * its values as they change. The resulting flow is conflated, meaning that if several values arrive in quick
 * succession, only the last one will be emitted.
 * Since this implementation uses [ObservableValue.addListener], even if this [ObservableValue]
 * supports lazy evaluation, eager computation will be enforced while the flow is being collected.
 * All the calls to JavaFX API are performed in [Dispatchers.JavaFx].
 * This flow emits at least the initial value.
 *
 * ### Operator fusion
 *
 * Adjacent applications of [flowOn], [buffer], [conflate], and [produceIn] to the result of `asFlow` are fused.
 * [conflate] has no effect, as this flow is already conflated; one can use [buffer] to change that instead.
 */


fun reportMetric ( name : String , value : String , subprojectName : String ? = null )

/**
 * Reports a metric by its name and optionally subproject.
 *
 * @param name the metric name
 * @param value the metric value.
 * @param subprojectName the subproject name for which the metric is being reported.
 */


fun reportMetric ( name : String , value : Number , subprojectName : String ? = null )

/**
 * @see org.jetbrains.kotlin.gradle.fus.GradleBuildFusStatisticsService.reportMetric(java.lang.String, java.lang.String, java.lang.String)
 */


fun reportMetric ( name : String , value : Boolean , subprojectName : String ? = null )


private inline fun solveLowerTriangleSystem ( sizeA : Int , sizeX : Int , action : ( Int , Int , Int ) -> Unit )

{ <EOL> for ( i in <NUM_LIT:0> until sizeA ) { <EOL> for ( k in i + <NUM_LIT:1> until sizeA ) { <EOL> for ( j in <NUM_LIT:0> until sizeX ) { <EOL> action ( i , k , j ) <EOL> } <EOL> } <EOL> } <EOL> }

/**
 * Solve inplace lower triangle system
 * Solves ax=b equation where a lower triangular matrix with units on diagonal,
 * rewrite b with solution
 *
 * notice: intentionally there is no checks that a[i, i] == 1.0 and a[i, >i] == 0.0,
 * it is a contract of this method having no such checks
 *
 * lapack: dtrsm can do it (and have some extra options)
 */


public fun < T > explode ( column : ColumnReference < T > ) : PositionalMapping < T >

{ <EOL> return addPositionalMapping < T > ( EXPLODE , column . name ( ) , null ) <EOL> }

/**
 * Maps the `explode` aesthetic to a data column by [ColumnReference].
 *
 * @param column the data column to be mapped.
 * @return a [PositionalMapping] object representing the mapping.
 */


public fun < T > explode ( column : KProperty < T > ) : PositionalMapping < T >

{ <EOL> return addPositionalMapping < T > ( EXPLODE , column . name , null ) <EOL> }

/**
 * Maps the `explode` aesthetic to a data column by [KProperty].
 *
 * @param column the data column to be mapped.
 * @return a [PositionalMapping] object representing the mapping.
 */


public fun explode ( column : String ) : PositionalMapping < Any ? >

{ <EOL> return addPositionalMapping < Any ? > ( EXPLODE , column , null ) <EOL> }

/**
 * Maps the `explode` aesthetic to a data column by [String].
 *
 * @param column the data column to be mapped.
 * @return a [PositionalMapping] object representing the mapping.
 */


public fun < T > explode ( values : Iterable < T > ) : PositionalMapping < T >

{ <EOL> return addPositionalMapping < T > ( EXPLODE , values . toList ( ) , null , null ) <EOL> }

/**
 * Maps the `explode` aesthetic to iterable of values.
 *
 * @param values The iterable of values to be mapped.
 * @return A [PositionalMapping] object representing the mapping.
 */


public fun < T > explode ( values : DataColumn < T > ) : PositionalMapping < T >

{ <EOL> return addPositionalMapping < T > ( EXPLODE , values , null ) <EOL> }

/**
 * Maps the `explode` aesthetic to a data column.
 *
 * @param values the data column to be mapped.
 * @return a [PositionalMapping] object representing the mapping.
 */


public infix fun UByte . until ( to : UByte ) : UIntRange

{ <EOL> if ( to <= UByte . MIN_VALUE ) return UIntRange . EMPTY <EOL> return this . toUInt ( ) .. ( to - <NUM_LIT:1u> ) . toUInt ( ) <EOL> }

/**
 * Returns a range from this value up to but excluding the specified [to] value.
 *
 * If the [to] value is less than or equal to `this` value, then the returned range is empty.
 */


public infix fun UInt . until ( to : UInt ) : UIntRange

{ <EOL> if ( to <= UInt . MIN_VALUE ) return UIntRange . EMPTY <EOL> return this .. ( to - <NUM_LIT:1u> ) . toUInt ( ) <EOL> }


public infix fun ULong . until ( to : ULong ) : ULongRange

{ <EOL> if ( to <= ULong . MIN_VALUE ) return ULongRange . EMPTY <EOL> return this .. ( to - <NUM_LIT:1u> ) . toULong ( ) <EOL> }


public infix fun UShort . until ( to : UShort ) : UIntRange

{ <EOL> if ( to <= UShort . MIN_VALUE ) return UIntRange . EMPTY <EOL> return this . toUInt ( ) .. ( to - <NUM_LIT:1u> ) . toUInt ( ) <EOL> }


private fun PsiInlineDocTag . toHtml ( javadocTag : JavadocTag ? ) : String ?

= <EOL> when ( this . name ) { <EOL> "<STR_LIT>" , "<STR_LIT>" -> this . referenceElement ( ) <EOL> ? . toDocumentationLinkString ( this . dataElements . filterIsInstance < PsiDocToken > ( ) . joinToString ( "<STR_LIT:U+0020>" ) { <EOL> it . stringifyElementAsText ( keepFormatting = false ) . orEmpty ( ) <EOL> } ) <EOL> "<STR_LIT>" -> "<STR_LIT>" <EOL> "<STR_LIT>" -> "<STR_LIT>" <EOL> "<STR_LIT>" -> "<STR_LIT>" <EOL> "<STR_LIT>" -> { <EOL> val inheritDocContent = inheritDocTagResolver . resolveContent ( commentResolutionContext ) <EOL> val html = inheritDocContent ? . fold ( HtmlParsingResult ( javadocTag ) ) { result , content -> <EOL> result + content . toInheritDocHtml ( result . newState , docTagParserContext ) <EOL> } ? . parsedLine . orEmpty ( ) <EOL> html <EOL> } <EOL> else -> this . text <EOL> }

/**
 * Inline tags can be met in the middle of some text. Example of an inline tag usage:
 *
 * ```java
 * Use the {@link #getComponentAt(int, int) getComponentAt} method.
 * ```
 */


private fun PsiElement . shouldHaveSpaceAtTheEnd ( ) : Boolean

{ <EOL> val siblings = siblings ( withItself = false ) . toList ( ) . filterNot { it . text . trim ( ) == "<STR_LIT>" } <EOL> val nextNotEmptySibling = ( siblings . firstOrNull ( ) as? PsiDocToken ) <EOL> val furtherNotEmptySibling = <EOL> ( siblings . drop ( <NUM_LIT:1> ) . firstOrNull { it is PsiDocToken && ! it . isLeadingAsterisk ( ) } as? PsiDocToken ) <EOL> val lastHtmlTag = text . trim ( ) . substringAfterLast ( "<STR_LIT:<>" ) <EOL> val endsWithAnUnclosedTag = lastHtmlTag . endsWith ( "<STR_LIT:>>" ) && ! lastHtmlTag . startsWith ( "<STR_LIT>" ) <EOL> return ( nextSibling as? PsiWhiteSpace ) ? . text ? . startsWith ( "<STR_LIT>" ) == true && <EOL> ( getNextSiblingIgnoringWhitespace ( ) as? PsiDocToken ) ? . tokenType != JavaDocTokenTypes . INSTANCE . commentEnd ( ) && <EOL> nextNotEmptySibling ? . isLeadingAsterisk ( ) == true && <EOL> furtherNotEmptySibling ? . tokenType == JavaDocTokenTypes . INSTANCE . commentData ( ) && <EOL> ! endsWithAnUnclosedTag <EOL> }

/**
 * We would like to know if we need to have a space after a this tag
 *
 * The space is required when:
 * - tag spans multiple lines, between every line we would need a space
 *
 * We wouldn't like to render a space if:
 * - tag is followed by an end of comment
 * - after a tag there is another tag (eg. multiple @author tags)
 * - they end with an html tag like: Something since then the space will be displayed in the following text
 * - next line starts with a
 or
 token
 */


internal fun Char . isWhitespaceImpl ( ) : Boolean

{ <EOL> val ch = this . code <EOL> return ch in <NUM_LIT> .. <NUM_LIT> <EOL> || ch in <NUM_LIT> .. <NUM_LIT> <EOL> || ch == <NUM_LIT> <EOL> || ch > <NUM_LIT> && ( ch == <NUM_LIT> || ch in <NUM_LIT> .. <NUM_LIT> || ch == <NUM_LIT> || ch == <NUM_LIT> || ch == <NUM_LIT> || ch == <NUM_LIT> || ch == <NUM_LIT> ) <EOL> }

/**
 * Returns `true` if this character is a whitespace.
 */


fun api ( sourceSetName : String , name : String , version : String ) : Unit

= project <EOL> . kotlinExtension <EOL> . sourceSets <EOL> . getByName ( sourceSetName ) <EOL> . dependencies { api ( mockedDependency ( name , version ) ) }

/**
 * Declares an API dependency to test:[name]:[version] for [sourceSetName] source set
 */


fun assertSourceSetDependenciesResolution ( expectedFilePath : String , withProject : ProjectInternal ? = null , configure : SourceSetDependenciesDsl . ( Project ) -> Unit )

{ <EOL> val repoRoot = tempFolder . newFolder ( ) <EOL> val project = withProject ? : buildProject { <EOL> applyMultiplatformPlugin ( ) <EOL> } <EOL> project . allprojects { <EOL> it . enableDefaultStdlibDependency ( false ) <EOL> it . enableDependencyVerification ( false ) <EOL> it . repositories . maven ( repoRoot ) <EOL> } <EOL> val dsl = SourceSetDependenciesDsl ( project ) <EOL> dsl . configure ( project ) <EOL> dsl . declaredDependencies . forEach { project . multiplatformExtension . publishAsMockedLibrary ( repoRoot , it . first , it . second ) } <EOL> project . evaluate ( ) <EOL> val actualResult = project . resolveAllSourceSetDependencies ( ) <EOL> val expectedFile = resourcesRoot . resolve ( "<STR_LIT>" ) . resolve ( expectedFilePath ) <EOL> KotlinTestUtils . assertEqualsToFile ( expectedFile , actualResult ) <EOL> }

/**
 * If [withProject] is not null then dependencies of source sets in this projects will be verified against [expectedFilePath]
 *
 */


internal actual fun < K , V > createMapForCache ( initialCapacity : Int ) : MutableMap < K , V >

= HashMap ( initialCapacity )

/**
 * Creates a ConcurrentHashMap on JVM and regular HashMap on other platforms.
 * To make actual use of cache in Kotlin/Native, mark a top-level object with this map
 * as a @[ThreadLocal].
 */


fun columnPlot ( plots : Iterable < Plot > , columns : Int , imageSize : Int ) : Figure

= <EOL> gggrid ( plots , columns )

/**
 * Column plot arranges the given iterable of plots in a specified number of columns and
 * creates a single figure from all given plots
 *
 * @param plots these are arranged into a single figure
 * @param columns specifies the number of columns in which the plots are arranged
 * @param imageSize is a height and width of the single plot in a returned plots figure
 * @return a [Figure] with all given plots
 */


fun xyPlot ( xSize : Int , ySize : Int , plotFeature : PlotFeature , f : ( Int , Int ) -> Float ) : Plot

{ <EOL> val gridX = List ( xSize ) { List ( ySize ) { it } } . flatten ( ) <EOL> val gridY = List ( ySize ) { y -> List ( xSize ) { y } } . flatten ( ) <EOL> val gridZ = gridX . zip ( gridY . reversed ( ) ) . map { f ( it . first , it . second ) } <EOL> return letsPlot { <EOL> x = gridX <EOL> y = gridY <EOL> fill = gridZ <EOL> } + FEATURE_MAP_THEME + plotFeature . scale <EOL> }

/**
 * Create a tile plot with weights from specified function `f(x, y)` that specifies the
 * intensity of the single tile on the plot `(x, y)` position.
 *
 * @param xSize size of X domain of `f` function as a range [0, xSize)
 * @param ySize size of Y domain of `f` function as a range [0, ySize)
 * @param plotFeature filling colors of the created plot
 * @param f function that is plotted
 * @return [Plot] for specified function on defined domain
 */


fun xyPlot ( imageSize : Int , plotFeature : PlotFeature , f : ( Int , Int ) -> Float ) : Plot

= <EOL> xyPlot ( imageSize , imageSize , plotFeature , f )

/**
 * Create a tile plot with weights from specified function `f(x, y)` that specifies the
 * intensity of the single tile on the plot `(x, y)` position.
 *
 * @param imageSize size of X and Y domains of `f` function as a range [0, imageSize)
 * @param plotFeature filling colors of the created plot
 * @param f function that is plotted
 * @return [Plot] for specified function on defined domain
 */


fun flattenImagePlot ( sampleNumber : Int , dataset : Dataset , predict : ( FloatData ) -> Int ? = { null } , labelEncoding : ( Int ) -> Any ? = { it } , plotFeature : PlotFeature = PlotFeature . GRAY ) : Plot

{ <EOL> val imageSize = <NUM_LIT> <EOL> val imageData = dataset . getX ( sampleNumber ) <EOL> val imageLabel = dataset . getY ( sampleNumber ) . toInt ( ) . run ( labelEncoding ) <EOL> val predictedLabel = predict ( imageData ) ? . run ( labelEncoding ) <EOL> val title = if ( predictedLabel == null ) { <EOL> "<STR_LIT>" <EOL> } else { <EOL> "<STR_LIT>" <EOL> } <EOL> return xyPlot ( imageSize , plotFeature ) { x , y -> imageData . floats [ y * imageSize + x ] } + ggtitle ( title ) <EOL> }

/**
 * Create a [xyPlot] for image data given as an array of the following intensities of the
 * plot tiles.
 *
 * Function intended to use it with the input images from some [Dataset] for
 * model as it offers to plot extra label that the specified image is labeled by (and
 * additionally supports plotting some predicted label when model prediction is given)
 *
 * @param sampleNumber index of sample in [dataset] to be plotted
 * @param dataset that contains the input data to be plotted as model input image and base label
 * @param predict function that can define the label based on model input
 * Defaults to no predict function so no model predict label is plotted.
 * @param labelEncoding mapping from output label number to some human-readable label that is plotted.
 * Defaults to identity function.
 * @param plotFeature filling colors of the created plot
 * @return [Plot] representing model sample with prediction label if available
 */


fun soundPlot ( wavFile : WavFile , beginDrop : Double = <NUM_LIT:0.0> , endDrop : Double = <NUM_LIT:0.0> ) : Plot

= wavFile . use { it -> <EOL> val soundData = it . readRemainingFrames ( ) <EOL> val sampleRate = it . format . sampleRate <EOL> val frames = it . frames <EOL> val channels = it . format . numChannels <EOL> val secondsPerFrame = <NUM_LIT:1.0> / sampleRate . toDouble ( ) <EOL> val dropBeginFrames = ( frames * beginDrop ) . roundToInt ( ) <EOL> val dropEndFrames = ( frames * endDrop ) . roundToInt ( ) <EOL> val takeFrames = max ( <NUM_LIT:0> , frames - dropBeginFrames - dropEndFrames ) . toInt ( ) <EOL> val singleTimeData = List ( takeFrames ) { ( it + dropBeginFrames ) * secondsPerFrame } <EOL> val channelName = List ( channels ) { idx -> List ( takeFrames ) { "<STR_LIT>" } } . flatten ( ) <EOL> val xData = List ( channels ) { singleTimeData } . flatten ( ) <EOL> val yData = soundData . flatMap { it . drop ( dropBeginFrames ) . take ( takeFrames ) } <EOL> val data = mapOf ( "<STR_LIT>" to channelName , "<STR_LIT>" to xData , "<STR_LIT>" to yData ) <EOL> letsPlot ( data ) { <EOL> x = "<STR_LIT>" <EOL> y = "<STR_LIT>" <EOL> fill = "<STR_LIT>" <EOL> } + geomPath ( ) <EOL> }

/**
 * Create a [soundPlot] for all channels of given [WavFile]. If it is needed, the plot data can be
 * cut from the beginning or its end because there may be extra noises that disturbs visualization.
 *
 * @param wavFile to read sound data from
 * @param beginDrop part of data to drop from beginning from range [0, 1]
 * @param endDrop part of data to drop from an end from range [0, 1]
 * @return [Plot] representing the amplitude of sound of given [WavFile]
 */


private fun CInteropMetadataDependencyTransformationTask . configureTaskOrder ( )

{ <EOL> val tasksForVisibleSourceSets = Callable { <EOL> val allVisibleSourceSets = sourceSet . dependsOnClosure + sourceSet . getAdditionalVisibleSourceSets ( ) <EOL> project . tasks . withType < CInteropMetadataDependencyTransformationTask > ( ) . matching { it . sourceSet in allVisibleSourceSets } <EOL> } <EOL> mustRunAfter ( tasksForVisibleSourceSets ) <EOL> }

/**
 * The transformation tasks will internally access the lazy [GranularMetadataTransformation.metadataDependencyResolutionsOrEmpty] property
 * which internally will potentially resolve dependencies. Having multiple tasks accessing this synchronized lazy property
 * during execution and/or configuration phase will result in an internal deadlock in Gradle
 * `DefaultResourceLockCoordinationService.withStateLock`
 *
 * To avoid this deadlock tasks shall be ordered, so that dependsOn source sets (and source sets visible based on associate compilations)
 * will run the transformation first.
 */


fun invoke ( cause : Throwable ? )

/**
 * Signals completion.
 *
 * This function:
 * - Does not throw any exceptions.
 * For [Job] instances that are coroutines, exceptions thrown by this function will be caught, wrapped into
 * [CompletionHandlerException], and passed to [handleCoroutineException], but for those that are not coroutines,
 * they will just be rethrown, potentially crashing unrelated code.
 * - Is fast, non-blocking, and thread-safe.
 * - Can be invoked concurrently with the surrounding code.
 * - Can be invoked from any context.
 *
 * The meaning of `cause` that is passed to the handler is:
 * - It is `null` if the job has completed normally.
 * - It is an instance of [CancellationException] if the job was cancelled _normally_.
 * **It should not be treated as an error**. In particular, it should not be reported to error logs.
 * - Otherwise, the job had _failed_.
 */


override fun invoke ( cause : Throwable ? )

{ handler ( cause ) }


public fun serialize ( encoder : Encoder , value : T )

/**
 * Serializes the [value] of type [T] using the format that is represented by the given [encoder].
 * [serialize] method is format-agnostic and operates with a high-level structured [Encoder] API.
 * Throws [SerializationException] if value cannot be serialized.
 *
 * Example of serialize method:
 * ```
 * class MyData(int: Int, stringList: List<String>, alwaysZero: Long)
 *
 * fun serialize(encoder: Encoder, value: MyData): Unit = encoder.encodeStructure(descriptor) {
 * // encodeStructure encodes beginning and end of the structure
 * // encode 'int' property as Int
 * encodeIntElement(descriptor, index = 0, value.int)
 * // encode 'stringList' property as List<String>
 * encodeSerializableElement(descriptor, index = 1, serializer<List<String>>, value.stringList)
 * // don't encode 'alwaysZero' property because we decided to do so
 * } // end of the structure
 * ```
 *
 * @throws SerializationException in case of any serialization-specific error
 * @throws IllegalArgumentException if the supplied input does not comply encoder's specification
 * @see KSerializer for additional information about general contracts and exception specifics
 */


public fun deserialize ( decoder : Decoder ) : T

/**
 * Deserializes the value of type [T] using the format that is represented by the given [decoder].
 * [deserialize] method is format-agnostic and operates with a high-level structured [Decoder] API.
 * As long as most of the formats imply an arbitrary order of properties, deserializer should be able
 * to decode these properties in an arbitrary order and in a format-agnostic way.
 * For that purposes, [CompositeDecoder.decodeElementIndex]-based loop is used: decoder firstly
 * signals property at which index it is ready to decode and then expects caller to decode
 * property with the given index.
 *
 * Throws [SerializationException] if value cannot be deserialized.
 *
 * Example of deserialize method:
 * ```
 * class MyData(int: Int, stringList: List<String>, alwaysZero: Long)
 *
 * fun deserialize(decoder: Decoder): MyData = decoder.decodeStructure(descriptor) {
 * // decodeStructure decodes beginning and end of the structure
 * var int: Int? = null
 * var list: List<String>? = null
 * loop@ while (true) {
 * when (val index = decodeElementIndex(descriptor)) {
 * DECODE_DONE -> break@loop
 * 0 -> {
 * // Decode 'int' property as Int
 * int = decodeIntElement(descriptor, index = 0)
 * }
 * 1 -> {
 * // Decode 'stringList' property as List<String>
 * list = decodeSerializableElement(descriptor, index = 1, serializer<List<String>>())
 * }
 * else -> throw SerializationException("Unexpected index $index")
 * }
 * }
 * if (int == null || list == null) throwMissingFieldException()
 * // Always use 0 as a value for alwaysZero property because we decided to do so.
 * return MyData(int, list, alwaysZero = 0L)
 * }
 * ```
 *
 * @throws MissingFieldException if non-optional fields were not found during deserialization
 * @throws SerializationException in case of any deserialization-specific error
 * @throws IllegalArgumentException if the decoded input is not a valid instance of [T]
 * @see KSerializer for additional information about general contracts and exception specifics
 */


{ <EOL> outputTargets . forEach { outputTarget -> invokeTarget ( outputTarget ) } <EOL> assert ( deserializedTargets . isEmpty ( ) ) { "<STR_LIT>" } <EOL> assert ( commonizedTargets . isEmpty ( ) ) { "<STR_LIT>" } <EOL> assert ( targetDependencies . isEmpty ( ) ) { "<STR_LIT>" } <EOL> }

/**
 * Runs all tasks/targets in this queue
 */


fun ensureLookupsCacheAttributesSaved ( )

{ <EOL> if ( lookupAttributesSaved . compareAndSet ( false , true ) ) { <EOL> initialLookupsCacheStateDiff . manager . writeVersion ( ) <EOL> } <EOL> }

/**
 * Called on every successful compilation
 */


public fun l2Normalize ( scope : Scope ? , x : Operand < Float > , axis : IntArray ? ) : Operand < Float >

{ <EOL> val squareSum : Operand < Float > = ReduceSum . create ( scope , Square . create ( scope , x ) , Constant . create ( scope , axis ) , ReduceSum . keepDims ( true ) ) <EOL> val invNorm : Operand < Float > = Rsqrt . create ( scope , org . tensorflow . op . math . Maximum . create ( scope , squareSum , Constant . create ( scope , <NUM_LIT> ) ) ) <EOL> return Mul . create ( scope , x , invNorm ) <EOL> }

/**
 * Normalizes a tensor wrt the L2 norm alongside the specified axis.
 *
 * @param scope: Current scope
 * @param x: Operand
 * @param axis: Axis along which to perform normalization
 */


public fun batchDot ( scope : Scope ? , x : Operand < Float > , y : Operand < Float > , axis : IntArray ) : Operand < Float >

{ <EOL> val xDim = x . asOutput ( ) . shape ( ) . numDimensions ( ) <EOL> val yDim = y . asOutput ( ) . shape ( ) . numDimensions ( ) <EOL> val diff : Int <EOL> var x2 : Operand < Float > = x <EOL> var y2 : Operand < Float > = y <EOL> if ( xDim > yDim ) { <EOL> diff = xDim - yDim <EOL> y2 = Reshape . create ( scope , y , Concat . create ( scope , listOf ( Shape . create ( scope , y ) ) + List ( diff ) { Constant . create ( scope , <NUM_LIT:1> ) } , Constant . create ( scope , <NUM_LIT:0> ) ) , ) <EOL> } else if ( yDim > xDim ) { <EOL> diff = yDim - xDim <EOL> x2 = Reshape . create ( scope , x , Concat . create ( scope , listOf ( Shape . create ( scope , x ) ) + List ( diff ) { Constant . create ( scope , <NUM_LIT:1> ) } , Constant . create ( scope , <NUM_LIT:0> ) ) , ) <EOL> } else { <EOL> diff = <NUM_LIT:0> <EOL> } <EOL> var out : Operand < Float > <EOL> val x2Dim = x2 . asOutput ( ) . shape ( ) . numDimensions ( ) <EOL> val y2Dim = y2 . asOutput ( ) . shape ( ) . numDimensions ( ) <EOL> if ( x2Dim == <NUM_LIT:2> && y2Dim == <NUM_LIT:2> ) { <EOL> out = if ( axis [ <NUM_LIT:0> ] == axis [ <NUM_LIT:1> ] ) { <EOL> ReduceSum . create ( scope , Mul . create ( scope , x2 , y2 ) , Constant . create ( scope , axis [ <NUM_LIT:0> ] ) ) <EOL> } else { <EOL> ReduceSum . create ( scope , Mul . create ( scope , Transpose . create ( scope , x2 , Constant . create ( scope , intArrayOf ( <NUM_LIT:1> , <NUM_LIT:0> ) ) ) , y2 ) , Constant . create ( scope , axis [ <NUM_LIT:1> ] ) ) <EOL> } <EOL> } else { <EOL> val adjX = when ( axis [ <NUM_LIT:0> ] == x2Dim - <NUM_LIT:1> ) { <EOL> true -> null <EOL> false -> true <EOL> } <EOL> val adjY = when ( axis [ <NUM_LIT:1> ] == y2Dim - <NUM_LIT:1> ) { <EOL> true -> true <EOL> false -> null <EOL> } <EOL> out = MatMul . create ( scope , x2 , y2 , MatMul . transposeA ( adjX ) , MatMul . transposeB ( adjY ) ) <EOL> } <EOL> val idx : Float <EOL> if ( diff != <NUM_LIT:0> ) { <EOL> idx = if ( xDim > yDim ) { <EOL> ( xDim + yDim - <NUM_LIT:3> ) . toFloat ( ) <EOL> } else { <EOL> ( xDim - <NUM_LIT:1> ) . toFloat ( ) <EOL> } <EOL> out = Squeeze . create ( scope , Constant . create ( scope , FloatArray ( diff ) { it + idx } ) ) <EOL> } <EOL> if ( out . asOutput ( ) . shape ( ) . numDimensions ( ) == <NUM_LIT:1> ) { <EOL> ExpandDims . create ( scope , out , Constant . create ( scope , <NUM_LIT:1> ) ) <EOL> } <EOL> return out <EOL> }

/**
 * Batchwise dot product.
 *
 * @param scope: Current scope
 * @param x: Operand with dimensions>=2
 * @param y: Operand with dimensions>=2
 * @param axis: Axis along which to perform batch dot
 */


public fun doBefore ( )

/**
 * Runs all methods that were marked with `@BeforeTest` annotation.
 *
 * @see kotlin.test.BeforeTest
 */


public fun doRun ( )

/**
 * Runs the test method itself
 *
 * @see kotlin.test.Test
 */


{ <EOL> try { <EOL> doBefore ( ) <EOL> doRun ( ) <EOL> } finally { <EOL> doAfter ( ) <EOL> } <EOL> }

/**
 * Runs test with its before and after functions.
 */


public fun doAfter ( )

/**
 * Runs all methods that were marked with `@AfterTest` annotation.
 *
 * @see kotlin.test.AfterTest
 */


public fun doBeforeClass ( )

/**
 * Executes all methods marked with `@BeforeClass` annotation
 *
 * @see kotlin.test.BeforeClass
 */


public fun doAfterClass ( )

/**
 * Executes all methods marked with `@AfterClass` annotation
 *
 * @see @see kotlin.test.AfterClass
 */


fun FirQualifiedAccessExpression . createConeSubstitutorFromTypeArguments ( callableSymbol : FirCallableSymbol < * > , session : FirSession , discardErrorTypes : Boolean = false , ) : ConeSubstitutor

{ <EOL> val typeArgumentMap = buildMap { <EOL> typeArguments . zip ( callableSymbol . typeParameterSymbols ) . forEach { ( typeArgument , typeParameterSymbol ) -> <EOL> val type = ( typeArgument as? FirTypeProjectionWithVariance ) ? . typeRef ? . coneType ? : return@forEach <EOL> if ( type is ConeErrorType && discardErrorTypes ) return@forEach <EOL> put ( typeParameterSymbol , type ) <EOL> } <EOL> } <EOL> return substitutorByMap ( typeArgumentMap , session ) <EOL> }

/**
 * @param discardErrorTypes if true, then type arguments with error types are not added to the substitution map
 */


fun < T : IrElement > T . patchDeclarationParents ( initialParent : IrDeclarationParent ? = null ) : T

= apply { <EOL> accept ( PatchDeclarationParentsVisitor , initialParent ) <EOL> }

/**
 * For each [IrDeclaration] in the IR subtree with the root in `this`, sets its [IrDeclaration.parent]
 * property to its _actual_ parent in the subtree.
 *
 * @param initialParent If this parameter is not `null`, assign topmost [IrDeclaration]s'
 * parents to that value (starting with `this`, if it is an [IrDeclaration]).
 * If null, skip those topmost [IrDeclaration]s' and start assigning parents one level below
 * (this is, once an [IrDeclarationParent] is found).
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public actual fun < T : Comparable < T > > maxOf ( a : T , b : T ) : T

{ <EOL> return if ( a >= b ) a else b <EOL> }

/**
 * Returns the greater of two values.
 *
 * If values are equal, returns the first one.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Byte , b : Byte ) : Byte

{ <EOL> return maxOf ( a . toInt ( ) , b . toInt ( ) ) . toByte ( ) <EOL> }

/**
 * Returns the greater of two values.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Short , b : Short ) : Short

{ <EOL> return maxOf ( a . toInt ( ) , b . toInt ( ) ) . toShort ( ) <EOL> }


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Int , b : Int ) : Int


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Long , b : Long ) : Long


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Float , b : Float ) : Float

{ <EOL> return if ( a . compareTo ( b ) >= <NUM_LIT:0> ) a else b <EOL> }

/**
 * Returns the greater of two values.
 *
 * If either value is `NaN`, returns `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Double , b : Double ) : Double


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public actual fun < T : Comparable < T > > maxOf ( a : T , b : T , c : T ) : T

{ <EOL> return maxOf ( a , maxOf ( b , c ) ) <EOL> }

/**
 * Returns the greater of three values.
 *
 * If there are multiple equal maximal values, returns the first of them.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Byte , b : Byte , c : Byte ) : Byte

{ <EOL> return maxOf ( a . toInt ( ) , maxOf ( b . toInt ( ) , c . toInt ( ) ) ) . toByte ( ) <EOL> }

/**
 * Returns the greater of three values.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Short , b : Short , c : Short ) : Short

{ <EOL> return maxOf ( a . toInt ( ) , maxOf ( b . toInt ( ) , c . toInt ( ) ) ) . toShort ( ) <EOL> }


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Int , b : Int , c : Int ) : Int


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Long , b : Long , c : Long ) : Long


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Float , b : Float , c : Float ) : Float

/**
 * Returns the greater of three values.
 *
 * If any value is `NaN`, returns `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Double , b : Double , c : Double ) : Double


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun < T : Comparable < T > > maxOf ( a : T , vararg other : T ) : T

{ <EOL> var max = a <EOL> for ( e in other ) max = maxOf ( max , e ) <EOL> return max <EOL> }

/**
 * Returns the greater of the given values.
 *
 * If there are multiple equal maximal values, returns the first of them.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun maxOf ( a : Byte , vararg other : Byte ) : Byte

/**
 * Returns the greater of the given values.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun maxOf ( a : Short , vararg other : Short ) : Short


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun maxOf ( a : Int , vararg other : Int ) : Int


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun maxOf ( a : Long , vararg other : Long ) : Long


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun maxOf ( a : Float , vararg other : Float ) : Float

/**
 * Returns the greater of the given values.
 *
 * If any value is `NaN`, returns `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun maxOf ( a : Double , vararg other : Double ) : Double


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public actual fun < T : Comparable < T > > minOf ( a : T , b : T ) : T

{ <EOL> return if ( a <= b ) a else b <EOL> }

/**
 * Returns the smaller of two values.
 *
 * If values are equal, returns the first one.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Byte , b : Byte ) : Byte

{ <EOL> return minOf ( a . toInt ( ) , b . toInt ( ) ) . toByte ( ) <EOL> }

/**
 * Returns the smaller of two values.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Short , b : Short ) : Short

{ <EOL> return minOf ( a . toInt ( ) , b . toInt ( ) ) . toShort ( ) <EOL> }


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Int , b : Int ) : Int


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Long , b : Long ) : Long


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Float , b : Float ) : Float

{ <EOL> return when { <EOL> a . isNaN ( ) -> a <EOL> b . isNaN ( ) -> b <EOL> else -> if ( a . compareTo ( b ) <= <NUM_LIT:0> ) a else b <EOL> } <EOL> }

/**
 * Returns the smaller of two values.
 *
 * If either value is `NaN`, returns `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Double , b : Double ) : Double


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public actual fun < T : Comparable < T > > minOf ( a : T , b : T , c : T ) : T

{ <EOL> return minOf ( a , minOf ( b , c ) ) <EOL> }

/**
 * Returns the smaller of three values.
 *
 * If there are multiple equal minimal values, returns the first of them.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Byte , b : Byte , c : Byte ) : Byte

{ <EOL> return minOf ( a . toInt ( ) , minOf ( b . toInt ( ) , c . toInt ( ) ) ) . toByte ( ) <EOL> }

/**
 * Returns the smaller of three values.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Short , b : Short , c : Short ) : Short

{ <EOL> return minOf ( a . toInt ( ) , minOf ( b . toInt ( ) , c . toInt ( ) ) ) . toShort ( ) <EOL> }


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Int , b : Int , c : Int ) : Int


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Long , b : Long , c : Long ) : Long


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Float , b : Float , c : Float ) : Float

/**
 * Returns the smaller of three values.
 *
 * If any value is `NaN`, returns `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Double , b : Double , c : Double ) : Double


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun < T : Comparable < T > > minOf ( a : T , vararg other : T ) : T

{ <EOL> var min = a <EOL> for ( e in other ) min = minOf ( min , e ) <EOL> return min <EOL> }

/**
 * Returns the smaller of the given values.
 *
 * If there are multiple equal minimal values, returns the first of them.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun minOf ( a : Byte , vararg other : Byte ) : Byte

/**
 * Returns the smaller of the given values.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun minOf ( a : Short , vararg other : Short ) : Short


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun minOf ( a : Int , vararg other : Int ) : Int


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun minOf ( a : Long , vararg other : Long ) : Long


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun minOf ( a : Float , vararg other : Float ) : Float

/**
 * Returns the smaller of the given values.
 *
 * If any value is `NaN`, returns `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun minOf ( a : Double , vararg other : Double ) : Double


fun renderResult ( host : ExecutionHost , field : FieldValue , ) : Any ?

/**
 * Renders cell result [field] represented as [FieldValue] in the [host] context
 */


fun register ( renderer : RendererFieldHandler ) : Code ?

/**
 * Adds new [renderer] for this notebook.
 * Returns code to be executed on execution host
 * for [PrecompiledRendererTypeHandler]'s.
 */


open fun generate ( valueArgumentsByIndex : List < ResolvedValueArgument > , actualArgs : List < ResolvedValueArgument > , calleeDescriptor : CallableDescriptor ? <EOL> ) : DefaultCallArgs

{ <EOL> assert ( valueArgumentsByIndex . size == actualArgs . size ) { <EOL> "<STR_LIT>" <EOL> } <EOL> val arg2Index = valueArgumentsByIndex . mapToIndex ( ) <EOL> val actualArgsWithDeclIndex = actualArgs . filter { it !is DefaultValueArgument } . map { <EOL> ArgumentAndDeclIndex ( it , arg2Index [ it ] ! ! ) <EOL> } . toMutableList ( ) <EOL> for ( ( index , value ) in valueArgumentsByIndex . withIndex ( ) ) { <EOL> if ( value is DefaultValueArgument ) { <EOL> actualArgsWithDeclIndex . add ( index , ArgumentAndDeclIndex ( value , index ) ) <EOL> } <EOL> } <EOL> val defaultArgs = DefaultCallArgs ( calleeDescriptor ? . unwrapFrontendVersion ( ) ? . valueParameters ? . size ? : <NUM_LIT:0> ) <EOL> for ( argumentWithDeclIndex in actualArgsWithDeclIndex ) { <EOL> val argument = argumentWithDeclIndex . arg <EOL> val declIndex = argumentWithDeclIndex . declIndex <EOL> when ( argument ) { <EOL> is ExpressionValueArgument -> { <EOL> generateExpression ( declIndex , argument ) <EOL> } <EOL> is DefaultValueArgument -> { <EOL> defaultArgs . mark ( declIndex ) <EOL> generateDefault ( declIndex , argument ) <EOL> } <EOL> is VarargValueArgument -> { <EOL> generateVararg ( declIndex , argument ) <EOL> } <EOL> else -> { <EOL> generateOther ( declIndex , argument ) <EOL> } <EOL> } <EOL> } <EOL> reorderArgumentsIfNeeded ( actualArgsWithDeclIndex ) <EOL> return defaultArgs <EOL> }

/**
 * @return a `List` of bit masks of default arguments that should be passed as last arguments to $default method, if there were
 * any default arguments, or an empty `List` if there were none
 *
 * @see kotlin.reflect.jvm.internal.KCallableImpl.callBy
 */


private fun InteropCallContext . findMemoryAccessFunction ( isRead : Boolean , valueType : IrType ) : IrFunction

{ <EOL> val requiredType = if ( isRead ) { <EOL> IntrinsicType . INTEROP_READ_PRIMITIVE <EOL> } else { <EOL> IntrinsicType . INTEROP_WRITE_PRIMITIVE <EOL> } <EOL> val nativeMemUtilsClass = symbols . nativeMemUtils . owner <EOL> return nativeMemUtilsClass . functions . filter { <EOL> val annotationArgument = it . annotations <EOL> . findAnnotation ( RuntimeNames . typedIntrinsicAnnotation ) <EOL> ? . getAnnotationStringValue ( ) <EOL> annotationArgument == requiredType . name <EOL> } . firstOrNull { <EOL> if ( isRead ) { <EOL> it . returnType . classOrNull == valueType . classOrNull <EOL> } else { <EOL> it . valueParameters . last ( ) . type . classOrNull == valueType . classOrNull <EOL> } <EOL> } ? : error ( "<STR_LIT>" ) <EOL> }

/**
 * Search for memory read/write function in [kotlinx.cinterop.nativeMemUtils] of a given [valueType].
 */


private fun InteropCallContext . castToBoolean ( sourceClass : IrClassSymbol , value : IrExpression ) : IrExpression

{ <EOL> val ( primitiveBinaryType , immZero ) = when ( sourceClass ) { <EOL> symbols . byte -> PrimitiveBinaryType . BYTE to builder . irByte ( <NUM_LIT:0> ) <EOL> symbols . long -> PrimitiveBinaryType . LONG to builder . irLong ( <NUM_LIT:0> ) <EOL> else -> error ( "<STR_LIT>" ) <EOL> } <EOL> val areEqualByValuesBytes = symbols . areEqualByValue . getValue ( primitiveBinaryType ) <EOL> val compareToZero = builder . irCall ( areEqualByValuesBytes ) . apply { <EOL> putValueArgument ( <NUM_LIT:0> , value ) <EOL> putValueArgument ( <NUM_LIT:1> , immZero ) <EOL> } <EOL> return builder . irCall ( irBuiltIns . booleanNotSymbol ) . apply { <EOL> dispatchReceiver = compareToZero <EOL> } <EOL> }


private fun InteropCallContext . castFromBoolean ( targetClass : IrClassSymbol , value : IrExpression ) : IrExpression

{ <EOL> val ( thenPart , elsePart ) = when ( targetClass ) { <EOL> symbols . byte -> builder . irByte ( <NUM_LIT:1> ) to builder . irByte ( <NUM_LIT:0> ) <EOL> symbols . long -> builder . irLong ( <NUM_LIT:1> ) to builder . irLong ( <NUM_LIT:0> ) <EOL> else -> error ( "<STR_LIT>" ) <EOL> } <EOL> return builder . irIfThenElse ( targetClass . defaultType , value , thenPart , elsePart ) <EOL> }


internal fun tryGenerateInteropMemberAccess ( callSite : IrCall , symbols : KonanSymbols , builder : IrBuilderWithScope , failCompilation : ( String ) -> Nothing ) : IrExpression ?

= when { <EOL> callSite . symbol . owner . isCEnumVarValueAccessor ( symbols ) -> <EOL> generateInteropCall ( symbols , builder , failCompilation ) { generateEnumVarValueAccess ( callSite ) } <EOL> callSite . symbol . owner . isCStructMemberAtAccessor ( ) -> <EOL> generateInteropCall ( symbols , builder , failCompilation ) { generateMemberAtAccess ( callSite ) } <EOL> callSite . symbol . owner . isCStructBitFieldAccessor ( ) -> <EOL> generateInteropCall ( symbols , builder , failCompilation ) { generateBitFieldAccess ( callSite ) } <EOL> callSite . symbol . owner . isCStructArrayMemberAtAccessor ( ) -> <EOL> generateInteropCall ( symbols , builder , failCompilation ) { generateArrayMemberAtAccess ( callSite ) } <EOL> else -> null <EOL> }

/** Returns non-null result if [callSite] is accessor to:
 * 1. T.value, T : CEnumVar
 * 2. T.<field-name>, T : CStructVar and accessor is annotated with
 * [kotlinx.cinterop.internal.CStruct.MemberAt] or [kotlinx.cinterop.internal.CStruct.BitField]
 */


fun loadModuleMetadata ( name : String ) : SerializedMetadata

/**
 * Loads metadata for the specified module.
 */


@ DisplayName ( "<STR_LIT>" ) <EOL> @ GradleTest <EOL> @ TestMetadata ( "<STR_LIT>" ) <EOL> fun testTouchLibCommon ( gradleVersion : GradleVersion )

= withProject ( gradleVersion ) { <EOL> build ( "<STR_LIT:assemble>" ) <EOL> val usedInAppCommon = resolvePath ( "<STR_LIT:lib>" , "<STR_LIT:commonMain>" , "<STR_LIT>" ) <EOL> multiStepCheckIncrementalBuilds ( incrementalPath = usedInAppCommon , steps = listOf ( "<STR_LIT>" , "<STR_LIT>" ) , tasksExpectedToExecuteOnEachStep = mainCompileTasks , afterEachStep = { <EOL> assertIncrementalCompilation ( listOf ( usedInAppCommon , resolvePath ( "<STR_LIT:app>" , "<STR_LIT:commonMain>" , "<STR_LIT>" ) ) . relativizeTo ( projectPath ) ) <EOL> } ) <EOL> val usedInAppPlatform = resolvePath ( "<STR_LIT:lib>" , "<STR_LIT:commonMain>" , "<STR_LIT>" ) <EOL> usedInAppPlatform . replaceWithVersion ( "<STR_LIT>" ) <EOL> fun testIndividualTarget ( moduleTask : String , extraAssertions : BuildResult . ( ) -> Unit = { } ) { <EOL> build ( "<STR_LIT>" , buildOptions = defaultBuildOptions . copy ( logLevel = LogLevel . DEBUG ) ) { <EOL> val targetTasks = setOf ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> assertTasksExecuted ( targetTasks ) <EOL> assertTasksAreNotInTaskGraph ( * ( mainCompileTasks - targetTasks ) . toTypedArray ( ) ) <EOL> extraAssertions ( ) <EOL> } <EOL> } <EOL> testIndividualTarget ( "<STR_LIT>" ) { <EOL> assertCompiledKotlinSources ( listOf ( usedInAppPlatform , resolvePath ( "<STR_LIT:app>" , "<STR_LIT:jvmMain>" , "<STR_LIT>" ) ) . relativizeTo ( projectPath ) , output ) <EOL> } <EOL> testIndividualTarget ( "<STR_LIT>" ) { <EOL> assertIncrementalCompilation ( listOf ( usedInAppPlatform , resolvePath ( "<STR_LIT:app>" , "<STR_LIT>" , "<STR_LIT>" ) ) . relativizeTo ( projectPath ) ) <EOL> } <EOL> testIndividualTarget ( "<STR_LIT>" ) <EOL> }

/**
 * Tests api change across the module + sourceSet boundary
 */


@ DisplayName ( "<STR_LIT>" ) <EOL> @ GradleTest <EOL> @ TestMetadata ( "<STR_LIT>" ) <EOL> fun testTouchLibPlatform ( gradleVersion : GradleVersion )

= withProject ( gradleVersion ) { <EOL> build ( "<STR_LIT:assemble>" ) <EOL> val commonSteps = listOf ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> val jvmUtil = resolvePath ( "<STR_LIT:lib>" , "<STR_LIT:jvmMain>" , "<STR_LIT>" ) <EOL> multiStepCheckIncrementalBuilds ( incrementalPath = jvmUtil , steps = commonSteps , tasksExpectedToExecuteOnEachStep = setOf ( "<STR_LIT>" , "<STR_LIT>" ) , afterEachStep = { <EOL> assertCompiledKotlinSources ( expectedSources = listOf ( jvmUtil , resolvePath ( "<STR_LIT:app>" , "<STR_LIT:jvmMain>" , "<STR_LIT>" ) ) . relativizeTo ( projectPath ) , output = output ) <EOL> } ) <EOL> val jsUtil = resolvePath ( "<STR_LIT:lib>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> multiStepCheckIncrementalBuilds ( incrementalPath = jsUtil , steps = commonSteps , tasksExpectedToExecuteOnEachStep = setOf ( "<STR_LIT>" , "<STR_LIT>" ) , afterEachStep = { <EOL> assertIncrementalCompilation ( listOf ( jsUtil , resolvePath ( "<STR_LIT:app>" , "<STR_LIT>" , "<STR_LIT>" ) ) . relativizeTo ( projectPath ) ) <EOL> } ) <EOL> val nativeUtil = resolvePath ( "<STR_LIT:lib>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> multiStepCheckIncrementalBuilds ( incrementalPath = nativeUtil , steps = commonSteps , tasksExpectedToExecuteOnEachStep = setOf ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> }

/**
 * Three platforms, two steps for each. Do source-compatible changes: first add default parameter,
 * then change return type.
 * lib/platform utils are used in app/platform with deduced return type.
 */


@ DisplayName ( "<STR_LIT>" ) <EOL> @ GradleTest <EOL> @ TestMetadata ( "<STR_LIT>" ) <EOL> fun testTouchAppCommon ( gradleVersion : GradleVersion )

= withProject ( gradleVersion ) { <EOL> build ( "<STR_LIT:assemble>" ) <EOL> val utilPath = resolvePath ( "<STR_LIT:app>" , "<STR_LIT:commonMain>" , "<STR_LIT>" ) <EOL> multiStepCheckIncrementalBuilds ( incrementalPath = utilPath , steps = listOf ( "<STR_LIT>" , "<STR_LIT>" ) , tasksExpectedToExecuteOnEachStep = setOf ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , afterEachStep = { <EOL> assertIncrementalCompilation ( listOf ( utilPath , resolvePath ( "<STR_LIT:app>" , "<STR_LIT>" , "<STR_LIT>" ) , resolvePath ( "<STR_LIT:app>" , "<STR_LIT:jvmMain>" , "<STR_LIT>" ) ) . relativizeTo ( projectPath ) ) <EOL> } ) <EOL> }

/**
 * Main smoke tests for api changes on the source set boundary
 */


@ DisplayName ( "<STR_LIT>" ) <EOL> @ GradleTest <EOL> @ TestMetadata ( "<STR_LIT>" ) <EOL> fun testTouchAppPlatform ( gradleVersion : GradleVersion )

= withProject ( gradleVersion ) { <EOL> build ( "<STR_LIT:assemble>" ) <EOL> val changedJvmSource = resolvePath ( "<STR_LIT:app>" , "<STR_LIT:jvmMain>" , "<STR_LIT>" ) <EOL> . replaceWithVersion ( "<STR_LIT>" ) <EOL> checkIncrementalBuild ( tasksExpectedToExecute = setOf ( "<STR_LIT>" ) ) { <EOL> assertCompiledKotlinSources ( listOf ( changedJvmSource ) . relativizeTo ( projectPath ) , output ) <EOL> } <EOL> val changedJsSource = resolvePath ( "<STR_LIT:app>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> . replaceWithVersion ( "<STR_LIT>" ) <EOL> checkIncrementalBuild ( tasksExpectedToExecute = setOf ( "<STR_LIT>" ) ) { <EOL> assertIncrementalCompilation ( listOf ( changedJsSource ) . relativizeTo ( projectPath ) ) <EOL> } <EOL> resolvePath ( "<STR_LIT:app>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> . replaceWithVersion ( "<STR_LIT>" ) <EOL> checkIncrementalBuild ( tasksExpectedToExecute = setOf ( "<STR_LIT>" ) ) <EOL> }

/**
 * Platform changes in a non-dependency shouldn't affect anything else
 */


internal fun buildThrowableAsErrorMethod ( ) : ObjCMethod

{ <EOL> return ObjCMethod ( comment = null , isInstanceMethod = true , returnType = ObjCClassType ( "<STR_LIT>" ) , selectors = listOf ( "<STR_LIT>" ) , parameters = emptyList ( ) , attributes = listOf ( swiftNameAttribute ( "<STR_LIT>" ) ) , origin = null ) <EOL> }

/**
 * See K1: [org.jetbrains.kotlin.backend.konan.objcexport.ObjCExportTranslatorImpl.buildThrowableAsErrorMethod]
 */


@ Test <EOL> fun `test - simple project - jvmTarget is explicit - and uses correct default` ( )

{ <EOL> val project = buildProjectWithJvm ( ) <EOL> val kotlin = project . kotlinJvmExtension <EOL> project . evaluate ( ) <EOL> val mainCompilation = kotlin . target . compilations . getByName ( "<STR_LIT:main>" ) <EOL> val mainCompilationTask = mainCompilation . compileTaskProvider . get ( ) as KotlinCompile <EOL> val arguments = mainCompilationTask . createCompilerArguments ( lenient ) <EOL> val argumentsString = ArgumentUtils . convertArgumentsToStringList ( arguments ) <EOL> val jvmTargetArgument = K2JVMCompilerArguments :: jvmTarget . javaField ! ! . getAnnotation ( Argument :: class . java ) ! ! . value <EOL> if ( jvmTargetArgument !in argumentsString ) fail ( "<STR_LIT>" ) <EOL> val indexOfJvmTargetArgument = argumentsString . indexOf ( jvmTargetArgument ) <EOL> val jvmTargetTargetArgumentValue = argumentsString . getOrNull ( indexOfJvmTargetArgument + <NUM_LIT:1> ) <EOL> assertEquals ( JvmTarget . fromTarget ( JavaVersion . current ( ) . toString ( ) ) . target , jvmTargetTargetArgumentValue ) <EOL> val parsedArguments = K2JVMCompilerArguments ( ) . apply { parseCommandLineArguments ( argumentsString , this ) } <EOL> assertNotNull ( parsedArguments . jvmTarget ) <EOL> assertEquals ( JvmTarget . fromTarget ( JavaVersion . current ( ) . toString ( ) ) . target , parsedArguments . jvmTarget ) <EOL> }

/**
 * The jvmTargets default argument value is up for change over time.
 * The argument shall always be explicitly set!
 */


public expect fun CoroutineScope . newCoroutineContext ( context : CoroutineContext ) : CoroutineContext

/**
 * Creates a context for a new coroutine. It installs [Dispatchers.Default] when no other dispatcher or
 * [ContinuationInterceptor] is specified and adds optional support for debugging facilities (when turned on)
 * and copyable-thread-local facilities on JVM.
 */


@ InternalCoroutinesApi <EOL> public expect fun CoroutineContext . newCoroutineContext ( addedContext : CoroutineContext ) : CoroutineContext

/**
 * Creates a context for coroutine builder functions that do not launch a new coroutine, e.g. [withContext].
 * @suppress
 */


= <NUM_LIT:42>

/**
 * The ultimate answer to life, universe, and everything can be printed like this:
 * ```kotlin
 * fun main() {
 * println(theAnswer())
 * }
 * ```
 * <!--- KNIT example-kdoc-01.kt -->
 */


@ Provides @ Singleton @ ForApplication <EOL> fun provideApplicationContext ( ) : Context

{ <EOL> return application <EOL> }

/**
 * Allow the application context to be injected but require that it be annotated with
 * [@Annotation][ForApplication] to explicitly differentiate it from an activity context.
 */


{ <EOL> val modelHub = ONNXModelHub ( cacheDirectory = File ( "<STR_LIT>" ) ) <EOL> val modelType = ONNXModels . PoseDetection . MoveNetSinglePoseLighting <EOL> val model = modelHub . loadModel ( modelType ) <EOL> model . printSummary ( ) <EOL> model . use { <EOL> println ( it ) <EOL> val file = getFileFromResource ( "<STR_LIT>" ) <EOL> val image = ImageConverter . toBufferedImage ( file ) <EOL> val preprocessing = pipeline < BufferedImage > ( ) <EOL> . resize { <EOL> outputHeight = <NUM_LIT> <EOL> outputWidth = <NUM_LIT> <EOL> } <EOL> . convert { colorMode = ColorMode . BGR } <EOL> . toFloatArray { } <EOL> . call ( modelType . preprocessor ) <EOL> val inputData = preprocessing . apply ( image ) <EOL> val rawPoseLandMarks = it . predict ( inputData ) { result -> <EOL> result . get2DFloatArray ( "<STR_LIT>" ) <EOL> } <EOL> println ( rawPoseLandMarks . contentDeepToString ( ) ) <EOL> val keypoints = mapOf ( <NUM_LIT:0> to "<STR_LIT>" , <NUM_LIT:1> to "<STR_LIT>" , <NUM_LIT:2> to "<STR_LIT>" , <NUM_LIT:3> to "<STR_LIT>" , <NUM_LIT:4> to "<STR_LIT>" , <NUM_LIT:5> to "<STR_LIT>" , <NUM_LIT:6> to "<STR_LIT>" , <NUM_LIT:7> to "<STR_LIT>" , <NUM_LIT:8> to "<STR_LIT>" , <NUM_LIT:9> to "<STR_LIT>" , <NUM_LIT:10> to "<STR_LIT>" , <NUM_LIT:11> to "<STR_LIT>" , <NUM_LIT:12> to "<STR_LIT>" , <NUM_LIT> to "<STR_LIT>" , <NUM_LIT> to "<STR_LIT>" , <NUM_LIT> to "<STR_LIT>" , <NUM_LIT:16> to "<STR_LIT>" ) <EOL> rawPoseLandMarks . forEachIndexed { index , data -> <EOL> println ( keypoints [ index ] + "<STR_LIT>" + data [ <NUM_LIT:1> ] + "<STR_LIT>" + data [ <NUM_LIT:0> ] + "<STR_LIT>" + data [ <NUM_LIT:2> ] ) <EOL> } <EOL> val foundPoseLandmarks = mutableListOf < PoseLandmark > ( ) <EOL> for ( i in rawPoseLandMarks . indices ) { <EOL> val poseLandmark = PoseLandmark ( x = rawPoseLandMarks [ i ] [ <NUM_LIT:1> ] , y = rawPoseLandMarks [ i ] [ <NUM_LIT:0> ] , probability = rawPoseLandMarks [ i ] [ <NUM_LIT:2> ] , label = keypoints [ i ] ! ! <EOL> ) <EOL> foundPoseLandmarks . add ( i , poseLandmark ) <EOL> } <EOL> val detectedPose = DetectedPose ( foundPoseLandmarks , emptyList ( ) ) <EOL> val displayedImage = pipeline < BufferedImage > ( ) <EOL> . resize { outputWidth = <NUM_LIT> ; outputHeight = <NUM_LIT> } <EOL> . apply ( image ) <EOL> showFrame ( "<STR_LIT>" , createDetectedPosePanel ( displayedImage , detectedPose ) ) <EOL> } <EOL> }

/**
 * This examples demonstrates the inference concept on MoveNetSinglePoseLighting model:
 * - Model is obtained from [ONNXModelHub].
 * - Model predicts on a few images located in resources.
 * - Special preprocessing is applied to each image before prediction.
 */


= poseDetectionMoveNet ( )


= if ( diff == null ) <EOL> "<STR_LIT>" <EOL> else <EOL> "<STR_LIT>"

/**
 * Formats difference returned by [computeLinesDiff] for display in exception messages.
 */


public fun computeLinesDiff ( oldLines : List < String > , newLines : List < String > , limit : Int = DIFF_LIMIT ) : ComputedLinesDiff

{ <EOL> val diff = computeDiff ( oldLines , newLines , limit ) ? : return ComputedLinesDiff ( null ) <EOL> val out = ArrayList < String > ( diff . size * <NUM_LIT:2> ) <EOL> var pOp : DiffOp ? = null <EOL> var pPos = <NUM_LIT:0> <EOL> var pHdr = - <NUM_LIT:1> <EOL> var d1 : Diff by Delegates . notNull ( ) <EOL> var d2 : Diff by Delegates . notNull ( ) <EOL> fun flushHeader ( ) { <EOL> if ( pHdr < <NUM_LIT:0> ) return <EOL> out [ pHdr ] = formatHeader ( d1 , d2 ) <EOL> pHdr = - <NUM_LIT:1> <EOL> } <EOL> for ( d in diff ) { <EOL> val pos = if ( d . op == DiffOp . DELETE ) d . x else d . y <EOL> if ( d . op != pOp || pos != pPos + <NUM_LIT:1> ) { <EOL> if ( pOp == DiffOp . DELETE && d . op == DiffOp . INSERT && d . x == d2 . x ) { <EOL> d1 = Diff ( d1 . x , d . y , DiffOp . CHANGE , "<STR_LIT>" ) <EOL> d2 = d <EOL> out . add ( "<STR_LIT>" ) <EOL> } else { <EOL> flushHeader ( ) <EOL> d1 = d <EOL> d2 = d <EOL> pHdr = out . size <EOL> out . add ( "<STR_LIT>" ) <EOL> } <EOL> } else { <EOL> d2 = d <EOL> } <EOL> out . add ( "<STR_LIT>" ) <EOL> pOp = d . op <EOL> pPos = pos <EOL> } <EOL> flushHeader ( ) <EOL> return ComputedLinesDiff ( out ) <EOL> }

/**
 * Computes difference between two set of lines and returns it in diff format as a list of strings.
 * The resulting [ComputedLinesDiff.diff] is `null` when difference exceeds [limit] lines.
 */


public fun resnet50 ( imageSize : Long = <NUM_LIT> , numberOfClasses : Int = <NUM_LIT:10> , numberOfInputChannels : Long = <NUM_LIT:3> , lastLayerActivation : Activations = Activations . Linear , ) : Functional

{ <EOL> val stackFn = fun ( pointer : Layer ) : Layer { <EOL> var x = pointer <EOL> x = stack1 ( x , <NUM_LIT> , <NUM_LIT:3> , stride1 = <NUM_LIT:1> , name = "<STR_LIT>" ) <EOL> x = stack1 ( x , <NUM_LIT> , <NUM_LIT:4> , name = "<STR_LIT>" ) <EOL> x = stack1 ( x , <NUM_LIT> , <NUM_LIT:6> , name = "<STR_LIT>" ) <EOL> return stack1 ( x , <NUM_LIT> , <NUM_LIT:3> , name = "<STR_LIT>" ) <EOL> } <EOL> return resnet ( stackFn = stackFn , imageSize = imageSize , numberOfClasses = numberOfClasses , numberOfInputChannels = numberOfInputChannels , lastLayerActivation = lastLayerActivation , preact = false ) <EOL> }

/**
 * Instantiates the ResNet50 architecture as a Functional model.
 *
 * @param [imageSize] Height = width of image.
 * @param [numberOfClasses] Number of neurons in the last layer (usually, Dense layer).
 * @param [lastLayerActivation] Activation for last layer (usually, Dense layer).
 *
 * @see
 * Deep Residual Learning for Image Recognition.
 * @see
 * Detailed description of ResNet'50 model and an approach to build it in Keras.
 */


public fun resnet101 ( imageSize : Long = <NUM_LIT> , numberOfClasses : Int = <NUM_LIT:10> , numberOfInputChannels : Long = <NUM_LIT:3> , lastLayerActivation : Activations = Activations . Linear , ) : Functional

{ <EOL> val stackFn = fun ( pointer : Layer ) : Layer { <EOL> var x = pointer <EOL> x = stack1 ( x , <NUM_LIT> , <NUM_LIT:3> , stride1 = <NUM_LIT:1> , name = "<STR_LIT>" ) <EOL> x = stack1 ( x , <NUM_LIT> , <NUM_LIT:4> , name = "<STR_LIT>" ) <EOL> x = stack1 ( x , <NUM_LIT> , <NUM_LIT:23> , name = "<STR_LIT>" ) <EOL> return stack1 ( x , <NUM_LIT> , <NUM_LIT:3> , name = "<STR_LIT>" ) <EOL> } <EOL> return resnet ( stackFn = stackFn , imageSize = imageSize , numberOfClasses = numberOfClasses , numberOfInputChannels = numberOfInputChannels , lastLayerActivation = lastLayerActivation , preact = false ) <EOL> }

/**
 * Instantiates the ResNet101 architecture as a Functional model.
 *
 * @param [imageSize] Height = width of image.
 * @param [numberOfClasses] Number of neurons in the last layer (usually, Dense layer).
 * @param [lastLayerActivation] Activation for last layer (usually, Dense layer).
 *
 * @see
 * Deep Residual Learning for Image Recognition.
 * @see
 * Detailed description of ResNet101 model and an approach to build it in Keras.
 */


public fun resnet152 ( imageSize : Long = <NUM_LIT> , numberOfClasses : Int = <NUM_LIT:10> , numberOfInputChannels : Long = <NUM_LIT:3> , lastLayerActivation : Activations = Activations . Linear , ) : Functional

{ <EOL> val stackFn = fun ( pointer : Layer ) : Layer { <EOL> var x = pointer <EOL> x = stack1 ( x , <NUM_LIT> , <NUM_LIT:3> , stride1 = <NUM_LIT:1> , name = "<STR_LIT>" ) <EOL> x = stack1 ( x , <NUM_LIT> , <NUM_LIT:8> , name = "<STR_LIT>" ) <EOL> x = stack1 ( x , <NUM_LIT> , <NUM_LIT> , name = "<STR_LIT>" ) <EOL> return stack1 ( x , <NUM_LIT> , <NUM_LIT:3> , name = "<STR_LIT>" ) <EOL> } <EOL> return resnet ( stackFn = stackFn , imageSize = imageSize , numberOfClasses = numberOfClasses , numberOfInputChannels = numberOfInputChannels , lastLayerActivation = lastLayerActivation , preact = false ) <EOL> }

/**
 * Instantiates the ResNet152 architecture as a Functional model.
 *
 * @param [imageSize] Height = width of image.
 * @param [numberOfClasses] Number of neurons in the last layer (usually, Dense layer).
 * @param [lastLayerActivation] Activation for last layer (usually, Dense layer).
 *
 * @see
 * Deep Residual Learning for Image Recognition.
 * @see
 * Detailed description of ResNet152 model and an approach to build it in Keras.
 */


public fun resnet50v2 ( imageSize : Long = <NUM_LIT> , numberOfClasses : Int = <NUM_LIT:10> , numberOfInputChannels : Long = <NUM_LIT:3> , lastLayerActivation : Activations = Activations . Linear , ) : Functional

{ <EOL> val stackFn = fun ( pointer : Layer ) : Layer { <EOL> var x = pointer <EOL> x = stack2 ( x , <NUM_LIT> , <NUM_LIT:3> , name = "<STR_LIT>" ) <EOL> x = stack2 ( x , <NUM_LIT> , <NUM_LIT:4> , name = "<STR_LIT>" ) <EOL> x = stack2 ( x , <NUM_LIT> , <NUM_LIT:6> , name = "<STR_LIT>" ) <EOL> return stack2 ( x , <NUM_LIT> , <NUM_LIT:3> , stride1 = <NUM_LIT:1> , name = "<STR_LIT>" ) <EOL> } <EOL> return resnet ( stackFn = stackFn , imageSize = imageSize , numberOfClasses = numberOfClasses , numberOfInputChannels = numberOfInputChannels , lastLayerActivation = lastLayerActivation , preact = true ) <EOL> }

/**
 * Instantiates the ResNet50V2 architecture as a Functional model.
 *
 * @param [imageSize] Height = width of image.
 * @param [numberOfClasses] Number of neurons in the last layer (usually, Dense layer).
 * @param [lastLayerActivation] Activation for last layer (usually, Dense layer).
 *
 * @see
 * Deep Residual Learning for Image Recognition.
 * @see
 * Detailed description of ResNet50V2 model and an approach to build it in Keras.
 */


public fun resnet101v2 ( imageSize : Long = <NUM_LIT> , numberOfClasses : Int = <NUM_LIT:10> , numberOfInputChannels : Long = <NUM_LIT:3> , lastLayerActivation : Activations = Activations . Linear , ) : Functional

{ <EOL> val stackFn = fun ( pointer : Layer ) : Layer { <EOL> var x = pointer <EOL> x = stack2 ( x , <NUM_LIT> , <NUM_LIT:3> , name = "<STR_LIT>" ) <EOL> x = stack2 ( x , <NUM_LIT> , <NUM_LIT:4> , name = "<STR_LIT>" ) <EOL> x = stack2 ( x , <NUM_LIT> , <NUM_LIT:23> , name = "<STR_LIT>" ) <EOL> return stack2 ( x , <NUM_LIT> , <NUM_LIT:3> , stride1 = <NUM_LIT:1> , name = "<STR_LIT>" ) <EOL> } <EOL> return resnet ( stackFn = stackFn , imageSize = imageSize , numberOfClasses = numberOfClasses , numberOfInputChannels = numberOfInputChannels , lastLayerActivation = lastLayerActivation , preact = true ) <EOL> }

/**
 * Instantiates the ResNet101V2 architecture as a Functional model.
 *
 * @param [imageSize] Height = width of image.
 * @param [numberOfClasses] Number of neurons in the last layer (usually, Dense layer).
 * @param [lastLayerActivation] Activation for last layer (usually, Dense layer).
 *
 * @see
 * Deep Residual Learning for Image Recognition.
 * @see
 * Detailed description of ResNet101V2 model and an approach to build it in Keras.
 */


public fun resnet152v2 ( imageSize : Long = <NUM_LIT> , numberOfClasses : Int = <NUM_LIT:10> , numberOfInputChannels : Long = <NUM_LIT:3> , lastLayerActivation : Activations = Activations . Linear , ) : Functional

{ <EOL> val stackFn = fun ( pointer : Layer ) : Layer { <EOL> var x = pointer <EOL> x = stack2 ( x , <NUM_LIT> , <NUM_LIT:3> , name = "<STR_LIT>" ) <EOL> x = stack2 ( x , <NUM_LIT> , <NUM_LIT:8> , name = "<STR_LIT>" ) <EOL> x = stack2 ( x , <NUM_LIT> , <NUM_LIT> , name = "<STR_LIT>" ) <EOL> return stack2 ( x , <NUM_LIT> , <NUM_LIT:3> , stride1 = <NUM_LIT:1> , name = "<STR_LIT>" ) <EOL> } <EOL> return resnet ( stackFn = stackFn , imageSize = imageSize , numberOfClasses = numberOfClasses , numberOfInputChannels = numberOfInputChannels , lastLayerActivation = lastLayerActivation , preact = true ) <EOL> }

/**
 * Instantiates the ResNet152V2 architecture as a Functional model.
 *
 * @param [imageSize] Height = width of image.
 * @param [numberOfClasses] Number of neurons in the last layer (usually, Dense layer).
 * @param [lastLayerActivation] Activation for last layer (usually, Dense layer).
 *
 * @see
 * Deep Residual Learning for Image Recognition.
 * @see
 * Detailed description of ResNet152V2 model and an approach to build it in Keras.
 */


private fun stack1 ( pointer : Layer , filters : Int , blocks : Int , stride1 : Int = <NUM_LIT:2> , name : String , ) : Layer

{ <EOL> var x = pointer <EOL> x = block1 ( x , filters , stride = stride1 , name = name + "<STR_LIT>" ) <EOL> for ( i in <NUM_LIT:2> until blocks + <NUM_LIT:1> ) { <EOL> x = block1 ( x , filters , conv_shortcut = false , name = name + "<STR_LIT>" + i ) <EOL> } <EOL> return x <EOL> }

/**
 * A set of stacked residual blocks.
 *
 * @param [pointer]: input tensor.
 * @param [filters]: filters of the bottleneck layer in a block.
 * @param [blocks]: blocks in the stacked blocks.
 * @param [stride1]: default 2, stride of the first layer in the first block.
 * @param [name]: string, stack label.
 */


private fun stack2 ( pointer : Layer , filters : Int , blocks : Int , stride1 : Int = <NUM_LIT:2> , name : String ) : Layer

{ <EOL> var x = pointer <EOL> x = block2 ( x , filters , convShortcut = true , stride = stride1 , name = name + "<STR_LIT>" ) <EOL> for ( i in <NUM_LIT:2> until blocks ) { <EOL> x = block2 ( x , filters , name = name + "<STR_LIT>" + i ) <EOL> } <EOL> x = block2 ( x , filters , stride = stride1 , name = name + "<STR_LIT>" + blocks ) <EOL> return x <EOL> }


private fun Context . similarOrCloselyBoundCapturedTypes ( subType : KotlinTypeMarker ? , superType : KotlinTypeMarker ? ) : Boolean

{ <EOL> if ( subType == null ) return false <EOL> if ( superType == null ) return false <EOL> val subTypeLowerConstructor = subType . lowerBoundIfFlexible ( ) . typeConstructor ( ) <EOL> if ( ! subTypeLowerConstructor . isCapturedTypeConstructor ( ) ) return false <EOL> if ( superType in subTypeLowerConstructor . supertypes ( ) && superType . contains { it . typeConstructor ( ) . isCapturedTypeConstructor ( ) } ) { <EOL> return true <EOL> } <EOL> return subTypeLowerConstructor == subType . upperBoundIfFlexible ( ) . typeConstructor ( ) && <EOL> subTypeLowerConstructor == superType . lowerBoundIfFlexible ( ) . typeConstructor ( ) && <EOL> subTypeLowerConstructor == superType . upperBoundIfFlexible ( ) . typeConstructor ( ) <EOL> }

/**
 * This function is used to determine if a resulting captured type should be approximated before returning it as a result type.
 *
 * In general, it's good not to approximate resulting captured types at all (see KT-66346).
 * Strictly speaking, such an approximation can build a type which is out of given constraints at all, e.g. (see KT-67221):
 *
 * Given CapturedType(out Generic<CapturedType(*)>) <: T <: Generic<CapturedType(*)>,
 * we can produce just Generic<out Any> and break the constraint system.
 *
 * However, avoiding approximation can also have drawbacks.
 * In cases like CapturedType(out String) <: T <: String (constraint system from KT-54077),
 * we can approximate the result to String safely, and if we keep CapturedType(out String) instead,
 * we get type mismatch error later. Also, extra captured types can break diagnostics like REIFIED_TYPE_FORBIDDEN_SUBSTITUTION.
 *
 * So currently (before full KT-66346 implementation), we are doing something intermediate
 * and this function should return true if approximation is not needed.
 *
 * Currently, it does so for "similar captured types": it's a pair of captured-type based types like
 * CapturedType&Any..CapturedType? and CapturedType..CapturedType?.
 * Type constructors of lower/upper bound of both types should be the same captured types, to get true result here.
 *
 * Also, true is returned for "closely bound captured types":
 * in this case a captured [subType] is inherited from a captured-containing [superType].
 *
 * @return true for similar or closely bound [subType] and [superType] captured types, which aren't approximated after that.
 */


public fun matchEntire ( input : CharSequence ) : MatchResult ?

/**
 * Attempts to match the entire [input] CharSequence against the pattern.
 *
 * @return An instance of [MatchResult] if the entire input matches or `null` otherwise.
 */


public infix fun matches ( input : CharSequence ) : Boolean

/** Indicates whether the regular expression matches the entire [input]. */


@ SinceKotlin ( "<STR_LIT:1.7>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class ) <EOL> public fun matchAt ( input : CharSequence , index : Int ) : MatchResult ?

/**
 * Attempts to match a regular expression exactly at the specified [index] in the [input] char sequence.
 *
 * Unlike [matchEntire] function, it doesn't require the match to span to the end of [input].
 *
 * @return An instance of [MatchResult] if the input matches this [Regex] at the specified [index] or `null` otherwise.
 * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of the [input] char sequence.
 * @sample samples.text.Regexps.matchAt
 */


@ SinceKotlin ( "<STR_LIT:1.7>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class ) <EOL> public fun matchesAt ( input : CharSequence , index : Int ) : Boolean

/**
 * Checks if a regular expression matches a part of the specified [input] char sequence
 * exactly at the specified [index].
 *
 * Unlike [matches] function, it doesn't require the match to span to the end of [input].
 *
 * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of the [input] char sequence.
 * @sample samples.text.Regexps.matchesAt
 */


public fun containsMatchIn ( input : CharSequence ) : Boolean

/** Indicates whether the regular expression can find at least one match in the specified [input]. */


public fun replace ( input : CharSequence , replacement : String ) : String

/**
 * Replaces all occurrences of this regular expression in the specified [input] string with specified [replacement] expression.
 *
 * The replacement string may contain references to the captured groups during a match. Occurrences of `${name}` or `$index`
 * in the replacement string will be substituted with the subsequences corresponding to the captured groups with the specified name or index.
 * In case of `$index`, the first digit after '$' is always treated as a part of group reference. Subsequent digits are incorporated
 * into `index` only if they would form a valid group reference. Only the digits '0'..'9' are considered as potential components
 * of the group reference. Note that indexes of captured groups start from 1, and the group with index 0 is the whole match.
 * In case of `${name}`, the `name` can consist of latin letters 'a'..'z' and 'A'..'Z', or digits '0'..'9'. The first character must be
 * a letter.
 *
 * Backslash character '\' can be used to include the succeeding character as a literal in the replacement string, e.g, `\$` or `\\`.
 * [Regex.escapeReplacement] can be used if [replacement] have to be treated as a literal string.
 *
 * @param input the char sequence to find matches of this regular expression in
 * @param replacement the expression to replace found matches with
 * @return the result of replacing each occurrence of this regular expression in [input] with the result of evaluating the [replacement] expression
 * @throws RuntimeException if [replacement] expression is malformed, or capturing group with specified `name` or `index` does not exist
 */


public fun replace ( input : CharSequence , transform : ( MatchResult ) -> CharSequence ) : String

/**
 * Replaces all occurrences of this regular expression in the specified [input] string with the result of
 * the given function [transform] that takes [MatchResult] and returns a string to be used as a
 * replacement for that match.
 */


public fun replaceFirst ( input : CharSequence , replacement : String ) : String

/**
 * Replaces the first occurrence of this regular expression in the specified [input] string with specified [replacement] expression.
 *
 * The replacement string may contain references to the captured groups during a match. Occurrences of `${name}` or `$index`
 * in the replacement string will be substituted with the subsequences corresponding to the captured groups with the specified name or index.
 * In case of `$index`, the first digit after '$' is always treated as a part of group reference. Subsequent digits are incorporated
 * into `index` only if they would form a valid group reference. Only the digits '0'..'9' are considered as potential components
 * of the group reference. Note that indexes of captured groups start from 1, and the group with index 0 is the whole match.
 * In case of `${name}`, the `name` can consist of latin letters 'a'..'z' and 'A'..'Z', or digits '0'..'9'. The first character must be
 * a letter.
 *
 * Backslash character '\' can be used to include the succeeding character as a literal in the replacement string, e.g, `\$` or `\\`.
 * [Regex.escapeReplacement] can be used if [replacement] have to be treated as a literal string.
 *
 * @param input the char sequence to find a match of this regular expression in
 * @param replacement the expression to replace the found match with
 * @return the result of replacing the first occurrence of this regular expression in [input] with the result of evaluating the [replacement] expression
 * @throws RuntimeException if [replacement] expression is malformed, or capturing group with specified `name` or `index` does not exist
 */


public fun find ( input : CharSequence , startIndex : Int = <NUM_LIT:0> ) : MatchResult ?

/**
 * Returns the first match of a regular expression in the [input], beginning at the specified [startIndex].
 *
 * @param startIndex An index to start search with, by default 0. Must be not less than zero and not greater than `input.length()`
 * @return An instance of [MatchResult] if match was found or `null` otherwise.
 * @throws IndexOutOfBoundsException if [startIndex] is less than zero or greater than the length of the [input] char sequence.
 * @sample samples.text.Regexps.find
 */


public fun findAll ( input : CharSequence , startIndex : Int = <NUM_LIT:0> ) : Sequence < MatchResult >

/**
 * Returns a sequence of all occurrences of a regular expression within the [input] string, beginning at the specified [startIndex].
 *
 * @throws IndexOutOfBoundsException if [startIndex] is less than zero or greater than the length of the [input] char sequence.
 *
 * @sample samples.text.Regexps.findAll
 */


public fun split ( input : CharSequence , limit : Int = <NUM_LIT:0> ) : List < String >

/**
 * Splits the [input] CharSequence to a list of strings around matches of this regular expression.
 *
 * @param limit Non-negative value specifying the maximum number of substrings the string can be split to.
 * Zero by default means no limit is set.
 */


@ SinceKotlin ( "<STR_LIT:1.6>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class ) <EOL> public fun splitToSequence ( input : CharSequence , limit : Int = <NUM_LIT:0> ) : Sequence < String >

/**
 * Splits the [input] CharSequence to a sequence of strings around matches of this regular expression.
 *
 * @param limit Non-negative value specifying the maximum number of substrings the string can be split to.
 * Zero by default means no limit is set.
 * @sample samples.text.Regexps.splitToSequence
 */


public fun fromLiteral ( literal : String ) : Regex

/**
 * Returns a regular expression that matches the specified [literal] string literally.
 * No characters of that string will have special meaning when searching for an occurrence of the regular expression.
 */


public fun escape ( literal : String ) : String

/**
 * Returns a regular expression pattern string that matches the specified [literal] string literally.
 * No characters of that string will have special meaning when searching for an occurrence of the regular expression.
 */


public fun escapeReplacement ( literal : String ) : String

/**
 * Returns a literal replacement expression for the specified [literal] string.
 * No characters of that string will have special meaning when it is used as a replacement string in [Regex.replace] function.
 */


public expect fun Char . isHighSurrogate ( ) : Boolean

/**
 * Returns `true` if this character is a Unicode high-surrogate code unit (also known as leading-surrogate code unit).
 */


public expect fun Char . isLowSurrogate ( ) : Boolean

/**
 * Returns `true` if this character is a Unicode low-surrogate code unit (also known as trailing-surrogate code unit).
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ Deprecated ( "<STR_LIT>" , ReplaceWith ( "<STR_LIT>" ) ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.4>" , errorSince = "<STR_LIT:1.5>" ) <EOL> public expect fun String ( chars : CharArray ) : String

/**
 * Converts the characters in the specified array to a string.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ Deprecated ( "<STR_LIT>" , ReplaceWith ( "<STR_LIT>" ) ) <EOL> @ DeprecatedSinceKotlin ( warningSince = "<STR_LIT:1.4>" , errorSince = "<STR_LIT:1.5>" ) <EOL> public expect fun String ( chars : CharArray , offset : Int , length : Int ) : String

/**
 * Converts the characters from a portion of the specified array to a string.
 *
 * @throws IndexOutOfBoundsException if either [offset] or [length] are less than zero
 * or `offset + length` is out of [chars] array bounds.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun CharArray . concatToString ( ) : String

/**
 * Concatenates characters in this [CharArray] into a String.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun CharArray . concatToString ( startIndex : Int = <NUM_LIT:0> , endIndex : Int = this . size ) : String

/**
 * Concatenates characters in this [CharArray] or its subrange into a String.
 *
 * @param startIndex the beginning (inclusive) of the subrange of characters, 0 by default.
 * @param endIndex the end (exclusive) of the subrange of characters, size of this array by default.
 *
 * @throws IndexOutOfBoundsException if [startIndex] is less than zero or [endIndex] is greater than the size of this array.
 * @throws IllegalArgumentException if [startIndex] is greater than [endIndex].
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun String . toCharArray ( ) : CharArray

/**
 * Returns a [CharArray] containing characters of this string.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun String . toCharArray ( startIndex : Int = <NUM_LIT:0> , endIndex : Int = this . length ) : CharArray

/**
 * Returns a [CharArray] containing characters of this string or its substring.
 *
 * @param startIndex the beginning (inclusive) of the substring, 0 by default.
 * @param endIndex the end (exclusive) of the substring, length of this string by default.
 *
 * @throws IndexOutOfBoundsException if [startIndex] is less than zero or [endIndex] is greater than the length of this string.
 * @throws IllegalArgumentException if [startIndex] is greater than [endIndex].
 */


@ SinceKotlin ( "<STR_LIT:2.0>" ) <EOL> public expect fun String . toCharArray ( destination : CharArray , destinationOffset : Int = <NUM_LIT:0> , startIndex : Int = <NUM_LIT:0> , endIndex : Int = length ) : CharArray

/**
 * Copies characters from this string into the [destination] character array and returns that array.
 *
 * @param destination the array to copy to.
 * @param destinationOffset the position in the array to copy to.
 * @param startIndex the start offset (inclusive) of the substring to copy.
 * @param endIndex the end offset (exclusive) of the substring to copy.
 *
 * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this string builder indices or when `startIndex > endIndex`.
 * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],
 * or when that index is out of the [destination] array indices range.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun ByteArray . decodeToString ( ) : String

/**
 * Decodes a string from the bytes in UTF-8 encoding in this array.
 *
 * Malformed byte sequences are replaced by the replacement char `\uFFFD`.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun ByteArray . decodeToString ( startIndex : Int = <NUM_LIT:0> , endIndex : Int = this . size , throwOnInvalidSequence : Boolean = false ) : String

/**
 * Decodes a string from the bytes in UTF-8 encoding in this array or its subrange.
 *
 * @param startIndex the beginning (inclusive) of the subrange to decode, 0 by default.
 * @param endIndex the end (exclusive) of the subrange to decode, size of this array by default.
 * @param throwOnInvalidSequence specifies whether to throw an exception on malformed byte sequence or replace it by the replacement char `\uFFFD`.
 *
 * @throws IndexOutOfBoundsException if [startIndex] is less than zero or [endIndex] is greater than the size of this array.
 * @throws IllegalArgumentException if [startIndex] is greater than [endIndex].
 * @throws CharacterCodingException if the byte array contains malformed UTF-8 byte sequence and [throwOnInvalidSequence] is true.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun String . encodeToByteArray ( ) : ByteArray

/**
 * Encodes this string to an array of bytes in UTF-8 encoding.
 *
 * Any malformed char sequence is replaced by the replacement byte sequence.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun String . encodeToByteArray ( startIndex : Int = <NUM_LIT:0> , endIndex : Int = this . length , throwOnInvalidSequence : Boolean = false ) : ByteArray

/**
 * Encodes this string or its substring to an array of bytes in UTF-8 encoding.
 *
 * @param startIndex the beginning (inclusive) of the substring to encode, 0 by default.
 * @param endIndex the end (exclusive) of the substring to encode, length of this string by default.
 * @param throwOnInvalidSequence specifies whether to throw an exception on malformed char sequence or replace.
 *
 * @throws IndexOutOfBoundsException if [startIndex] is less than zero or [endIndex] is greater than the length of this string.
 * @throws IllegalArgumentException if [startIndex] is greater than [endIndex].
 * @throws CharacterCodingException if this string contains malformed char sequence and [throwOnInvalidSequence] is true.
 */


public expect fun CharSequence . repeat ( n : Int ) : String

/**
 * Returns a string containing this char sequence repeated [n] times.
 * @throws [IllegalArgumentException] when n < 0.
 * @sample samples.text.Strings.repeat
 */


public expect fun String . replace ( oldChar : Char , newChar : Char , ignoreCase : Boolean = false ) : String

/**
 * Returns a new string with all occurrences of [oldChar] replaced with [newChar].
 *
 * @sample samples.text.Strings.replace
 */


public expect fun String . replace ( oldValue : String , newValue : String , ignoreCase : Boolean = false ) : String

/**
 * Returns a new string obtained by replacing all occurrences of the [oldValue] substring in this string
 * with the specified [newValue] string.
 *
 * @sample samples.text.Strings.replace
 */


public expect fun String . replaceFirst ( oldChar : Char , newChar : Char , ignoreCase : Boolean = false ) : String

/**
 * Returns a new string with the first occurrence of [oldChar] replaced with [newChar].
 */


public expect fun String . replaceFirst ( oldValue : String , newValue : String , ignoreCase : Boolean = false ) : String

/**
 * Returns a new string obtained by replacing the first occurrence of the [oldValue] substring in this string
 * with the specified [newValue] string.
 */


public expect fun String ? . equals ( other : String ? , ignoreCase : Boolean = false ) : Boolean

/**
 * Returns `true` if this string is equal to [other], optionally ignoring character case.
 *
 * Two strings are considered to be equal if they have the same length and the same character at the same index.
 * If [ignoreCase] is true, the result of `Char.uppercaseChar().lowercaseChar()` on each character is compared.
 *
 * @param ignoreCase `true` to ignore character case when comparing strings. By default `false`.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public expect fun String . compareTo ( other : String , ignoreCase : Boolean = false ) : Int

/**
 * Compares two strings lexicographically, optionally ignoring case differences.
 *
 * If [ignoreCase] is true, the result of `Char.uppercaseChar().lowercaseChar()` on each character is compared.
 */


public expect fun CharSequence . regionMatches ( thisOffset : Int , other : CharSequence , otherOffset : Int , length : Int , ignoreCase : Boolean = false ) : Boolean

/**
 * Returns `true` if the specified range in this char sequence is equal to the specified range in another char sequence.
 * @param thisOffset the start offset in this char sequence of the substring to compare.
 * @param other the string against a substring of which the comparison is performed.
 * @param otherOffset the start offset in the other char sequence of the substring to compare.
 * @param length the length of the substring to compare.
 */


@ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> public expect fun String . regionMatches ( thisOffset : Int , other : String , otherOffset : Int , length : Int , ignoreCase : Boolean = false ) : Boolean

/**
 * Returns `true` if the specified range in this string is equal to the specified range in another string.
 * @param thisOffset the start offset in this string of the substring to compare.
 * @param other the string against a substring of which the comparison is performed.
 * @param otherOffset the start offset in the other string of the substring to compare.
 * @param length the length of the substring to compare.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public expect fun String ? . toBoolean ( ) : Boolean

/**
 * Returns `true` if this string is not `null` and its content is equal to the word "true", ignoring case, and `false` otherwise.
 *
 * There are also strict versions of the function available on non-nullable String, [toBooleanStrict] and [toBooleanStrictOrNull].
 */


public expect fun String . toByte ( ) : Byte

/**
 * Parses the string as a signed [Byte] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 */


public expect fun String . toByte ( radix : Int ) : Byte

/**
 * Parses the string as a signed [Byte] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
 */


public expect fun String . toShort ( ) : Short

/**
 * Parses the string as a [Short] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 */


public expect fun String . toShort ( radix : Int ) : Short

/**
 * Parses the string as a [Short] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
 */


public expect fun String . toInt ( ) : Int

/**
 * Parses the string as an [Int] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 */


public expect fun String . toInt ( radix : Int ) : Int

/**
 * Parses the string as an [Int] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
 */


public expect fun String . toLong ( ) : Long

/**
 * Parses the string as a [Long] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 */


public expect fun String . toLong ( radix : Int ) : Long

/**
 * Parses the string as a [Long] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.
 */


public expect fun String . toDouble ( ) : Double

/**
 * Parses the string as a [Double] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 */


public expect fun String . toFloat ( ) : Float

/**
 * Parses the string as a [Float] number and returns the result.
 * @throws NumberFormatException if the string is not a valid representation of a number.
 */


public expect fun String . toDoubleOrNull ( ) : Double ?

/**
 * Parses the string as a [Double] number and returns the result
 * or `null` if the string is not a valid representation of a number.
 */


public expect fun String . toFloatOrNull ( ) : Float ?

/**
 * Parses the string as a [Float] number and returns the result
 * or `null` if the string is not a valid representation of a number.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public expect fun Byte . toString ( radix : Int ) : String

/**
 * Returns a string representation of this [Byte] value in the specified [radix].
 *
 * @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public expect fun Short . toString ( radix : Int ) : String

/**
 * Returns a string representation of this [Short] value in the specified [radix].
 *
 * @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public expect fun Int . toString ( radix : Int ) : String

/**
 * Returns a string representation of this [Int] value in the specified [radix].
 *
 * @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public expect fun Long . toString ( radix : Int ) : String

/**
 * Returns a string representation of this [Long] value in the specified [radix].
 *
 * @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.
 */


fun saveClassToCache ( kotlinClassInfo : KotlinClassInfo , sourceFiles : List < File > ? , changesCollector : ChangesCollector )

{ <EOL> val className = kotlinClassInfo . className <EOL> dirtyOutputClassesMap . notDirty ( className ) <EOL> if ( sourceFiles != null ) { <EOL> sourceFiles . forEach { <EOL> sourceToClassesMap . append ( it , className ) <EOL> } <EOL> if ( ! icContext . useCompilerMapsOnly ) internalNameToSource [ className . internalName ] = sourceFiles <EOL> } <EOL> if ( kotlinClassInfo . classId . isLocal ) return <EOL> when ( kotlinClassInfo . classKind ) { <EOL> KotlinClassHeader . Kind . FILE_FACADE -> { <EOL> if ( sourceFiles != null ) { <EOL> assert ( sourceFiles . size == <NUM_LIT:1> ) { "<STR_LIT>" } <EOL> } <EOL> packagePartMap . addPackagePart ( className ) <EOL> protoMap . process ( kotlinClassInfo , changesCollector ) <EOL> if ( ! icContext . useCompilerMapsOnly ) { <EOL> constantsMap . process ( kotlinClassInfo , changesCollector ) <EOL> inlineFunctionsMap . process ( kotlinClassInfo , changesCollector ) <EOL> } <EOL> } <EOL> KotlinClassHeader . Kind . MULTIFILE_CLASS -> { <EOL> val partNames = kotlinClassInfo . classHeaderData . toList ( ) <EOL> check ( partNames . isNotEmpty ( ) ) { "<STR_LIT>" } <EOL> multifileFacadeToParts [ className ] = partNames <EOL> if ( className in protoMap ) { <EOL> changesCollector . collectSignature ( className . fqNameForClassNameWithoutDollars , areSubclassesAffected = true ) <EOL> } <EOL> protoMap . remove ( className , changesCollector ) <EOL> classFqNameToSourceMap . remove ( className . fqNameForClassNameWithoutDollars ) <EOL> if ( ! icContext . useCompilerMapsOnly ) { <EOL> classAttributesMap . remove ( className . fqNameForClassNameWithoutDollars ) <EOL> internalNameToSource . remove ( className . internalName ) <EOL> constantsMap . process ( kotlinClassInfo , changesCollector ) <EOL> inlineFunctionsMap . process ( kotlinClassInfo , changesCollector ) <EOL> } <EOL> } <EOL> KotlinClassHeader . Kind . MULTIFILE_CLASS_PART -> { <EOL> if ( sourceFiles != null ) { <EOL> assert ( sourceFiles . size == <NUM_LIT:1> ) { "<STR_LIT>" } <EOL> } <EOL> packagePartMap . addPackagePart ( className ) <EOL> partToMultifileFacade [ className ] = kotlinClassInfo . multifileClassName ! ! <EOL> protoMap . process ( kotlinClassInfo , changesCollector ) <EOL> if ( ! icContext . useCompilerMapsOnly ) { <EOL> constantsMap . process ( kotlinClassInfo , changesCollector ) <EOL> inlineFunctionsMap . process ( kotlinClassInfo , changesCollector ) <EOL> } <EOL> } <EOL> KotlinClassHeader . Kind . CLASS -> { <EOL> if ( ! icContext . useCompilerMapsOnly ) { <EOL> addToClassStorage ( kotlinClassInfo . protoData as ClassProtoData , sourceFiles ? . let { sourceFiles . single ( ) } ) <EOL> } <EOL> protoMap . process ( kotlinClassInfo , changesCollector ) <EOL> if ( ! icContext . useCompilerMapsOnly ) { <EOL> constantsMap . process ( kotlinClassInfo , changesCollector ) <EOL> inlineFunctionsMap . process ( kotlinClassInfo , changesCollector ) <EOL> } <EOL> } <EOL> KotlinClassHeader . Kind . UNKNOWN , KotlinClassHeader . Kind . SYNTHETIC_CLASS -> { <EOL> } <EOL> } <EOL> }

/**
 * Saves information about the given (Kotlin) class to this cache, and stores changes between this class and its previous version into
 * the given [ChangesCollector].
 *
 * @param kotlinClassInfo Information about a Kotlin class
 * @param sourceFiles The source files that the given class was generated from, or `null` if this information is not available
 * @param changesCollector A [ChangesCollector]
 */


public fun disable ( )


public fun useJacoco ( )

/**
 * Use [JaCoCo](https://www.jacoco.org/jacoco/) as coverage tool with version [JACOCO_TOOL_DEFAULT_VERSION] for measure coverage and generate reports.
 */


public fun useJacoco ( version : String )

/**
 * Use [JaCoCo](https://www.jacoco.org/jacoco/) as coverage tool with version [version] for measure coverage and generate reports.
 */


public fun currentProject ( block : Action < KoverCurrentProjectVariantsConfig > )

/**
 * Customize report variants shared by the current project.
 *
 * A report variant is a set of information used to generate a reports, namely:
 * project classes, a list of Gradle test tasks, classes that need to be excluded from instrumentation.
 *
 * ```
 * currentProject {
 * // create report variant with custom name,
 * // in which it is acceptable to add information from other variants of the current project, as well as `kover` dependencies
 * createVariant("custom") {
 * // ...
 * }
 *
 * // Configure the variant that is automatically created in the current project
 * // For example, "jvm" for JVM target or "debug" for Android build variant
 * providedVariant("jvm") {
 * // ...
 * }
 *
 * // Configure the variant for all the code that is available in the current project.
 * // This variant always exists for any type of project.
 * totalVariant {
 * // ...
 * }
 * }
 * ```
 */


public fun reports ( block : Action < KoverReportsConfig > )

/**
 * Configuration of Kover reports.
 *
 * An individual set of reports is created for each Kover report variant.
 * All these sets can be configured independently of each other.
 *
 * The main difference between the reports sets and the report variants is that the reports are individual for each project, the settings of reports in different projects do not affect each other in any way.
 * At the same time, changing a report variant affects all reports that are based on it, for example, if several projects import a variant through a dependency `kover(project(":subproject"))`.
 *
 * Example of usage:
 * ```
 * kover {
 * reports {
 * filters {
 * // common filters for all reports of all variants
 * }
 * verify {
 * // common verification rules for all variants
 * }
 *
 * /*
 * Total reports set - special reports for all code of current project and it's kover dependencies.
 * These are the reports for total variant of current project and it's kover dependencies.
 * */
 * total {
 * // config
 * }
 *
 * /*
 * Configure custom reports set with name "custom".
 * These are the reports for variant "custom" of current project and it's kover dependencies.
 * */
 * variant("custom") {
 * }
 * }
 * }
 * ```
 */


public fun merge ( block : Action < KoverMergingConfig > )

/**
 * Configuring a merged report.
 *
 * **Attention! Usage of this block breaks project isolation and is incompatible with the configuration cache!**
 * If you need configuration cache support, please explicitly configure Kover plugin in each project using [currentProject] blocks.
 *
 * Used as a shortcut for group configuration of the plugin in several projects and merging reports.
 * If you specify this block without additional commands
 * ```
 * kover {
 * merge {
 * }
 * }
 * ```
 * it will be equivalent to this code
 * ```
 * val thisProject = project
 * subprojects {
 * apply("org.jetbrains.kotlinx.kover")
 * thisProject.dependencies.add("kover", this)
 *
 * // apply values from `useJacoco` and `jacocoVersion`
 * }
 * ```
 * As a result, a merged report will be created in the project in which this `merge` block was called (merging project).
 *
 * It is acceptable to limit the projects in which the configuration will take place by adding filters:
 * ```
 * kover {
 * merge {
 * subprojects {
 * it.name != "uncovered"
 * }
 * }
 * }
 * ```
 * This way Kover plugin will not be applied in a project named `uncovered`.
 *
 * If you specify several filters, Kover plugin will be applied in the project if at least one of these filters will return `true`.
 *
 *
 * Full list of functions:
 * ```
 * kover {
 * merge {
 * // include all subprojects
 * subprojects()
 *
 * // include subprojects that have passed the filter
 * subprojects {
 * // filter predicate
 * }
 *
 * // include all projects of the build
 * allProjects()
 *
 * // include all projects of the build that have passed the filter
 * allProjects {
 * // filter predicate
 * }
 *
 * // include projects by name or path
 * projects("project-name", ":")
 *
 * sources {
 * // set up sources for all variants of all included projects
 * }
 *
 * instrumentation {
 * // set up instrumentation for all variants of all included projects
 * }
 *
 * createVariant("variantName") {
 * // create custom variant
 * }
 * }
 * }
 * ```
 */


fun joinFlow ( flows : Collection < PersistentFlow > , statementFlows : Collection < PersistentFlow > , union : Boolean ) : MutableFlow

{ <EOL> when ( flows . size ) { <EOL> <NUM_LIT:0> -> return MutableFlow ( ) <EOL> <NUM_LIT:1> -> return flows . first ( ) . fork ( ) <EOL> } <EOL> val commonFlow = flows . reduce { a , b -> a . lowestCommonAncestor ( b ) ? : error ( "<STR_LIT>" ) } <EOL> val result = commonFlow . fork ( ) <EOL> result . mergeAssignments ( flows ) <EOL> if ( union ) { <EOL> result . copyNonConflictingAliases ( flows , commonFlow ) <EOL> } else { <EOL> result . copyCommonAliases ( flows ) <EOL> } <EOL> result . copyStatements ( statementFlows , commonFlow , union ) <EOL> result . copyImplications ( statementFlows ) <EOL> return result <EOL> }

/**
 * Creates the next [Flow] by joining a set of previous [Flow]s.
 *
 * @param flows All [PersistentFlow]s which flow into the join flow. These will determine assignments and variable aliases for the
 * resulting join flow.
 * @param statementFlows A *subset* of [flows] used to determine what [TypeStatement]s and [Implication]s will be copied to the joined
 * flow.
 * @param union Determines if [TypeStatement]s from different flows should be combined with union or intersection logic.
 */


public fun < T > createValueColumn ( name : String , values : List < T > , type : KType , infer : Infer = Infer . None , defaultValue : T ? = null , ) : ValueColumn < T >

= ValueColumnImpl ( values , name , getValuesType ( values , type , infer ) , defaultValue )

/**
 * Creates [ValueColumn] using given [name], [values] and [type].
 *
 * @param name name of the column
 * @param values list of column values
 * @param type type of the column
 * @param infer column type inference mode
 */


public inline fun < reified T > createValueColumn ( name : String , values : List < T > , infer : Infer = Infer . None , ) : ValueColumn < T >

= createValueColumn ( name , values , getValuesType ( values , typeOf < T > ( ) , infer ) )

/**
 * Creates [ValueColumn] using given [name], [values] and reified column [type].
 *
 * Note, that column [type] will be defined at compile-time using [T] argument
 *
 * @param T type of the column
 * @param name name of the column
 * @param values list of column values
 * @param infer column type inference mode
 */


fun getQualifiedClassName ( index : Int ) : String

/**
 * @return the fully qualified name of some class in the format: `org/foo/bar/Test.Inner`
 */


private fun ControlFlowGraph . contains ( firCandidates : Set < FirElement > ) : Boolean

{ <EOL> for ( node in nodes ) { <EOL> if ( node . fir in firCandidates ) { <EOL> return true <EOL> } <EOL> if ( node is CFGNodeWithSubgraphs < * > && node . subGraphs . any { it . contains ( firCandidates ) } ) { <EOL> return true <EOL> } <EOL> } <EOL> return false <EOL> }

/**
 * Returns `true` if the control graph contains at least one of the [firCandidates].
 */


fun findLast ( fir : FirElement ) : CFGNode < * > ?

{ <EOL> val directNodes = mapping [ fir ] <EOL> if ( directNodes != null ) { <EOL> return directNodes . last ( ) <EOL> } <EOL> if ( fir is FirBlock ) { <EOL> return fir . statements <EOL> . asReversed ( ) <EOL> . firstNotNullOfOrNull ( :: findLast ) <EOL> } <EOL> return null <EOL> }

/**
 * Find the last node in a graph (or its subgraphs) that point to the given [fir] element.
 */