fun < T : Any > KtNDArray < T > . all ( vararg axis : Int ) : KtNDArray < Boolean >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , axis ) )

/**
 * @param axis: [Int] or [IntArray]- axis along which a logical AND reduction is performed.
 * If [axis] is negative, in which case if counts from the last to the first axis.
 *
 * @return new [KtNDArray] of type [Boolean].
 */


inline fun < T : Any > KtNDArray < T > . all ( predicate : ( T ) -> Boolean ) : Boolean

{ <EOL> for ( element in this . flatIter ( ) ) if ( ! predicate ( element ) ) return false <EOL> return true <EOL> }

/**
 * Returns *true* if all elements satisfy the predicate.
 * Using buffer.
 */


fun < T : Any > KtNDArray < T > . any ( ) : Boolean

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this ) , kClass = Boolean :: class )

/**
 * Test whether any array element along a given axis evaluates to *true*.
 *
 * @return [Boolean] value.
 */


fun < T : Any > KtNDArray < T > . any ( vararg axis : Int ) : KtNDArray < Boolean >

/**
 * @param axis: default none, [Int] or [IntArray] - Axis along which a logical OR reduction is performed.
 * If [axis] is negative, in which case it counts from the last to the first axis.
 * @return new [KtNDArray] of type [Boolean].
 */


inline fun < T : Any > KtNDArray < T > . any ( predicate : ( T ) -> Boolean ) : Boolean

{ <EOL> for ( element in this . flatIter ( ) ) if ( predicate ( element ) ) return true <EOL> return false <EOL> }

/**
 * Returns 'true' if any element satisfy the predicate.
 */


fun < T : Number > KtNDArray < T > . argMax ( ) : Long

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this ) , kClass = Long :: class )

/**
 * Returns the indices of the maximum values along an axis.
 *
 * @return [Long] value.
 */


fun < T : Number > KtNDArray < T > . argMax ( axis : Int ) : KtNDArray < Long >

/**
 * @param axis index is into the specified axis. By default, the index is into the flattened array.
 * @return new [KtNDArray] of type [Long]. Array indices into the array.
 * It has the same shape as shape with the dimension along [axis] removed.
 */


fun < T : Number > KtNDArray < T > . argMin ( ) : Long

/**
 * Return the indices of the minimum values along the given axis of array.
 *
 * @return [Long] value.
 */


fun < T : Number > KtNDArray < T > . argMin ( axis : Int ) : KtNDArray < Long >

/**
 * @param axis By default, axis is none, the index is nto the flattened array,
 * otherwise along the specified axis.
 * @return new [KtNDArray] of type [Long].
 */


fun < T : Any > KtNDArray < T > . argSort ( axis : Int ? = - <NUM_LIT:1> , kind : String ? = null ) : KtNDArray < Long >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , axis ? : None . none , kind ? : None . none ) )

/**
 * Returns the indices that would sort this array.
 *
 * @param axis axis along which to sort.
 * The default is -1 (the last axis). If null, the flattened array is used.
 * @param kind sorting algorithm from {'quicksort', 'mergesort', 'heapsort', 'stable'}. The default is 'quicksort'.
 * @return [KtNDArray] of [Long] type. Array of indices that sort this array along the specified [axis].
 */


fun < T : Any > KtNDArray < T > . byteSwap ( inplace : Boolean = false ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , inplace ) )

/**
 * Swap the bytes of the array elements.
 *
 * @param inplace if 'true', swap swap in-place. Default value 'false'.
 * @return [KtNDArray]. If inplace 'true' return view, else copy data to new buffer.
 */


fun < E : Number , T : Number > KtNDArray < T > . choose ( choices : Array < E > , mode : Mode = Mode . RAISE ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , choices , None . none , mode . str ) )

/**
 * Use an index array to construct a new array from a set of choices.
 *
 * @param choices choice arrays.
 * @param mode specifies how indices outside ```[0, n-1]``` will be treated.
 * @return The merged [KtNDArray] of type [T].
 */


fun < T : Any > KtNDArray < T > . clip ( min : T ? = null , max : T ? = null ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , min ? : None . none , max ? : None . none ) )

/**
 * Return an array whose values are limited to (min, max). One of max or min must be given.
 *
 * @param min minimum value. If null, clipping is not performed on lower interval edge.
 * Not more than one of [min] and [max] may be null.
 * @param max maximum value. If null, clipping is not performed on upper interval edge.
 * Not more than one of [min] and [max] may be null.
 * @return [KtNDArray] of type [T].
 */


fun < T : Any > KtNDArray < T > . compress ( condition : BooleanArray , axis : Int ? = null ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , condition , axis ? : None . none ) )

/** Return selected slices of this array along given axis.
 *
 * @param condition array of boolean that selects which entries to return.
 * @param axis axis along which to take slices. If null (default), work on the flattened array.
 * @return a copy of a without the slices along axis for which condition is false.
 */


fun < T : Any > KtNDArray < T > . copy ( order : Order = Order . C ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , order . name ) )


fun < T : Any > KtNDArray < T > . cumProd ( axis : Int ? = null ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , axis ? : None . none , this . dtype ) )

/**
 * Return the cumulative product of the elements along the given axis.
 *
 * @param axis along which the cumulative product is computed.
 * The default (null) is to compute the [cumProd] over the flattened array.
 * @return a new [KtNDArray] of type [T].
 */


fun < T : Any > KtNDArray < T > . cumSum ( axis : Int ? = null ) : KtNDArray < T >

/**
 * Return the cumulative sum of the elements along the given axis.
 *
 * @param axis along which the cumulative sum is computed.
 * The default (null) is to compute the [cumSum] over the flattened array.
 * @return a new [KtNDArray] of type [T].
 */


fun < T : Any > KtNDArray < T > . diagonal ( offset : Int = <NUM_LIT:0> , axis1 : Int = <NUM_LIT:0> , axis2 : Int = <NUM_LIT:1> ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , offset , axis1 , axis2 ) )

/** Return specified diagonals.
 *
 * @param offset of the digonal from the main diagonal. Can be positive or negative.
 * Defaults to main diagonal, offset is 0.
 * @param axis1 to be used as the first axis of the 2D subarrays from which the diagonals should be taken.
 * Defaults to first axis is 0.
 * @param axis2 to be used as the second axis of the 2D subarrays from which the diagonals should be taken.
 * Defaults to second axis is 1
 */


@ JvmName ( "<STR_LIT>" ) <EOL> fun < T : Number > KtNDArray < Byte > . dot ( b : KtNDArray < T > ) : KtNDArray < T >

= this . prDot ( b )

/**
 * Dot product of two arrays.
 *
 * @param b second array.
 * @return returns the dot product this array and b array.
 */


fun < T : Any > KtNDArray < T > . dump ( file : String )

{ <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , file ) , kClass = Unit :: class ) <EOL> }

/**
 * Dump a pickle of the array to the specified file.
 * @param file filename.
 */


fun < T : Any > KtNDArray < T > . dumps ( ) : String

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this ) , kClass = String :: class )

/**
 * Returns the pickle of the array as a string.
 */


fun < T : Any > KtNDArray < T > . fill ( value : T )

{ <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , value ) , kClass = Unit :: class ) <EOL> }

/**
 * Fill the array with a scalar value.
 *
 * @param value - all elements of a will be assigned this value.
 */


fun < T : Any > KtNDArray < T > . flatten ( order : Order = Order . C ) : KtNDArray < T >

/**
 * Return a copy of the array collapsed into one dimension.
 *
 * @param order see [Order].
 * @return a flatten [KtNDArray] of type [T].
 */


inline fun < T : Any , reified R : Any > KtNDArray < T > . getfield ( offset : Int = <NUM_LIT:0> ) : KtNDArray < R >

= <EOL> callFunc ( nameMethod = arrayOf ( "<STR_LIT>" , "<STR_LIT>" ) , args = arrayOf ( this , R :: class . javaObjectType , offset ) )

/**
 * Returns a field of the given array as a certain type.
 * A field is a view of the array data with a given data-type.
 *
 * @param T type of array.
 * @param R type of field.
 * @param offset numbers of bytes to skip before beginning the element view.
 * @return view of [KtNDArray] of type [R].
 */


inline fun < reified T : Any > KtNDArray < T > . item ( vararg arg : Int ) : T

= <EOL> callFunc ( nameMethod = arrayOf ( "<STR_LIT>" , "<STR_LIT>" ) , args = arrayOf ( this , arg ) , kClass = T :: class )

/**
 * Copy an element of an array to a standard Python/Java scalar and return it.
 */


inline fun < reified T : Number > KtNDArray < T > . max ( ) : T ?

= <EOL> callFunc ( nameMethod = arrayOf ( "<STR_LIT>" , "<STR_LIT>" ) , args = arrayOf ( this ) , kClass = T :: class )

/**
 * Maximum of an array or maximum along an axis.
 *
 * @param axis axis or axes along which to operate. By default, flattened input is used.
 * @return new [KtNDArray] of type [T] or [T] value.
 */


fun < T : Number > KtNDArray < T > . mean ( ) : Double

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , None . none , Double :: class . javaObjectType ) , kClass = Double :: class )

/**
 * Returns the average of the array elements along given axis.
 *
 * @return [Double].
 */


fun < T : Number > KtNDArray < T > . mean ( vararg axis : Int ) : KtNDArray < Double >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , axis , Double :: class . javaObjectType ) )

/**
 * @param axis Int or IntArray - axis or axes along which the means are computed.
 * @return [KtNDArray].
 */


inline fun < reified T : Any > KtNDArray < T > . min ( ) : T ?

/**
 * Return the minimum along a given axis.
 *
 * @return [T] value.
 */


fun < T : Any > KtNDArray < T > . min ( vararg axis : Int ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , axis ) )

/**
 * @param axis axis or axes along which to operate.
 * @return new [KtNDArray] of type [T]/
 */


fun < T : Any > KtNDArray < T > . nonZero ( ) : Array < Any >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this ) , kClass = Array < Any > :: class )

/**
 * Return the indices of the elements that are non-zero.
 */


fun < T : Any > KtNDArray < T > . partition ( kth : IntArray , axis : Int = - <NUM_LIT:1> , kind : String = "<STR_LIT>" )

{ <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , kth , axis , kind ) , kClass = Unit :: class ) <EOL> }

/**
 * Rearranges the elements in the array in such a way that the value of
 * the element in kth position is in the position it would be in a sorted array.
 *
 * @param kth element index to partition by.
 * @param axis axis along which to sort. Default is -1, which means sort along the last axis.
 * @param kind selection algorithm. Default is 'introselect'.
 */


inline fun < reified T : Number > KtNDArray < T > . prod ( ) : T

= <EOL> callFunc ( nameMethod = arrayOf ( "<STR_LIT>" , "<STR_LIT>" ) , args = arrayOf ( this , None . none , T :: class . javaObjectType ) , kClass = T :: class )

/**
 * Return the product of the array elements over the given axis.
 *
 * @return [T] value.
 */


fun < T : Number > KtNDArray < T > . prod ( vararg axis : Int ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , axis , this . dtype ) )

/**
 * @param axis [Int] or [IntArray] - axis or axes along which a product is performed.
 *
 * @return new [KtNDArray] of type [T].
 */


fun < T : Number > KtNDArray < T > . ptp ( vararg axis : Int ? = emptyArray ( ) ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , axis . ifEmpty { None . none } ) )

/**
 * Peak to peak (maximum - minimum) value along a given axis.
 *
 * @param axis null, [Int], [IntArray] - Axis along which to find the peaks.
 * @return A new array holding the result.
 */


fun < T : Any > KtNDArray < T > . put ( indices : IntArray , values : Array < T > , mode : Mode = Mode . RAISE )

{ <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , indices , values , mode . str ) , kClass = Unit :: class ) <EOL> }

/**
 * Set array.flat.set(n) = values.set(n) for all n in indices.
 */


fun < T : Any > KtNDArray < T > . ravel ( order : Order = Order . C ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , order . name ) )

/**
 * Return a flattened array.
 *
 * Return a contiguous flattened array.
 * A 1-D array, containing the elements of the input, is returned.
 *
 * @return view of [KtNDArray].
 * */


fun < T : Any > KtNDArray < T > . repeat ( repeats : Int , axis : Int ? = null ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , repeats , axis ? : None . none ) )

/**
 * Repeat elements of an array.
 *
 * @param repeats The number of repetitions for each element.
 * @param axis The axis along which to repeat values.
 * By default, use the flattened input array, and return a flat output array.
 *
 * @return [KtNDArray]. Output array which has the same shape as input array, except along the given axis.
 */


fun < T : Any > KtNDArray < T > . reshape ( vararg dims : Int , order : Order = Order . C ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , dims ) , order = order )

/**
 * Returns an array containing the same data with a new shape.
 */


fun < T : Any > KtNDArray < T > . resize ( vararg dims : Int )

{ <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , dims ) , kClass = Unit :: class ) <EOL> }

/**
 * Change shape and size of array in-place.
 */


fun < T : Number > KtNDArray < T > . round ( decimals : Int = <NUM_LIT:0> ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , decimals ) )

/**
 * Return a with each element rounded to the given number of decimals.
 *
 * @param decimals Number of decimal places to round to (default: 0).
 * If decimals is negative, it specifies the number of positions to the left of the decimal point.
 *
 * @return [KtNDArray]
 */


fun < T : Any > KtNDArray < T > . searchSorted ( v : Int , side : String = "<STR_LIT>" ) : Long

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , v , side ) , kClass = Long :: class )

/**
 * Find indices where elements of v should be inserted in a to maintain order.
 */


inline fun < T : Any , reified R : Any > KtNDArray < T > . setfield ( value : R , offset : Int = <NUM_LIT:0> )

{ <EOL> callFunc ( nameMethod = arrayOf ( "<STR_LIT>" , "<STR_LIT>" ) , args = arrayOf ( this , value , R :: class . javaObjectType , offset ) , kClass = Unit :: class ) <EOL> }

/**
 * Put a value into a specified place in a field defined by a data-type.
 */


fun < T : Any > KtNDArray < T > . setFlags ( write : Int ? = null , align : Int ? = null , uic : Int ? = null )

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , write ? : None . none , align ? : None . none , uic ? : None . none ) , kClass = Unit :: class )

/**
 * Set array flags WRITEABLE, ALIGNED, (WRITEBACKIFCOPY and UPDATEIFCOPY), respectively.
 */


fun < T : Any > KtNDArray < T > . sort ( axis : Int = - <NUM_LIT:1> , kind : KindSort ? = null )

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , axis , kind ? : None . none ) , kClass = Unit :: class )


fun < T : Any > KtNDArray < T > . squeeze ( axis : Int ? = null ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , axis ? : None . none ) )

/**
 * Remove single-dimensional entries from the shape of a.
 *
 * @return View.
 */


fun < T : Number > KtNDArray < T > . std ( ddof : Int = <NUM_LIT:0> ) : Double

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , None . none , Double :: class . javaObjectType , None . none , ddof ) , kClass = Double :: class )

/**
 * Returns the standard deviation of the array elements along given axis.
 *
 * @return [Double] or [KtNDArray] of [Double].
 */


inline fun < reified T : Number > KtNDArray < T > . sum ( ) : T ?

/**
 * Sum of array elements over a given axis.
 *
 * @return [T] value.
 */


fun < T : Number > KtNDArray < T > . sum ( axis : Int ) : KtNDArray < T >

/**
 * @param axis Axis or axes along which a sum is performed.
 * If [axis] is negative it counts from the last to the first axis.
 * @return new [KtNDArray] of type [T]. An array with the same shape as *this*,
 * with the specified axis removed.
 */


fun < T : Any > KtNDArray < T > . swapAxes ( axis1 : Int , axis2 : Int ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , axis1 , axis2 ) )

/**
 * Return a view of the array with axis1 and axis2 interchanged.
 *
 * @return View of [KtNDArray].
 */


fun < T : Any > KtNDArray < T > . take ( indices : KtNDArray < Long > , axis : Int ? = null , mode : Mode = Mode . RAISE ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , indices , axis ? : None . none , None . none , mode . str ) )

/**
 * Return an array formed from the elements of a at the given indices.
 */


fun < T : Any > KtNDArray < T > . toBytes ( order : Order = Order . C ) : ByteArray

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , order . name ) , kClass = ByteArray :: class )

/**
 * Construct Python bytes containing the raw data bytes in the array.
 */


fun < T : Any > KtNDArray < T > . toFile ( fid : String , sep : String = "<STR_LIT>" , format : String = "<STR_LIT>" )

{ <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , fid , sep , format ) , kClass = Unit :: class ) <EOL> }

/**
 * Write array to a file as text or binary (default).
 */


fun < T : Any > KtNDArray < T > . trace ( offset : Int = <NUM_LIT:0> , axis1 : Int = <NUM_LIT:0> , axis2 : Int = <NUM_LIT:1> ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , offset , axis1 , axis2 ) )

/**
 * Return the sum along diagonals of the array.
 */


fun < T : Any > KtNDArray < T > . transpose ( vararg axes : Int ? = emptyArray ( ) ) : KtNDArray < T >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this , axes . ifEmpty { None . none } ) )

/**
 * Returns a view of the array with axes transposed.
 */


fun < T : Number > KtNDArray < T > . `var` ( ddof : Int = <NUM_LIT:0> ) : Double

/**
 * Returns the variance of the array elements, along given axis.
 */


fun < T : Any , NT : Any > KtNDArray < T > . view ( ) : KtNDArray < NT >

= <EOL> callFunc ( nameMethod = arrayOf ( NDARRAY_STR , "<STR_LIT>" ) , args = arrayOf ( this ) )

/**
 * New view of array with the same data.
 */


@ Deprecated ( "<STR_LIT>" , ReplaceWith ( "<STR_LIT>" ) , DeprecationLevel . ERROR ) <EOL> fun postProcess ( )

= postProcess ( inOrAfterLinkageStep = true )

/**
 * [postProcess] has two usages with different expectations:
 * - IR plugin API: actualize expects/actuals, generate fake overrides
 * - Linker(s): the same + run partial linkage
 *
 * In the future, this function should be split into several functions with different semantics for more precise use.
 */


{ <EOL> val ( train , test ) = mnist ( ) <EOL> modernLeNet . use { <EOL> it . compile ( optimizer = SGD ( learningRate = <NUM_LIT> ) , loss = Losses . SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS , metric = Metrics . ACCURACY ) <EOL> println ( "<STR_LIT>" ) <EOL> println ( it . kGraph ) <EOL> it . init ( ) <EOL> var accuracy = it . evaluate ( dataset = test , batchSize = TEST_BATCH_SIZE ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> println ( "<STR_LIT>" ) <EOL> println ( it . kGraph ) <EOL> it . fit ( dataset = train , epochs = EPOCHS , batchSize = TRAINING_BATCH_SIZE ) <EOL> println ( "<STR_LIT>" ) <EOL> println ( it . kGraph ) <EOL> accuracy = it . evaluate ( dataset = test , batchSize = TEST_BATCH_SIZE ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> println ( it . kGraph ) <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> }

/**
 * This example shows how to do image classification from scratch using [modernLeNet], without leveraging pre-trained weights or a pre-made model.
 * We demonstrate the workflow on the Mnist classification dataset.
 *
 * It includes:
 * - dataset loading from S3
 * - model compilation
 * - model summary (including TensorFlow graph operands)
 * - model training
 * - model evaluation
 */


= modernLenetWithRegularizers ( )


fun analyze ( project : Project , configuration : CompilerConfiguration ) : Boolean ?

{ <EOL> val extensions = FirAnalysisHandlerExtension . getInstances ( project ) . filter { it . isApplicable ( configuration ) } <EOL> return if ( extensions . isEmpty ( ) ) null else extensions . all { it . doAnalysis ( configuration ) } <EOL> }

/**
 * Applies [FirAnalysisHandlerExtension] instances to a project
 * @receiver the project to analyze
 * @param configuration compiler configuration
 * @return [null] if no applicable extensions were found, [true] if all applicable extensions returned [true] from [doAnalysis],
 * [false] if any applicable extension returned [false]
 *
 * @see FirAnalysisHandlerExtension.isApplicable
 * @see FirAnalysisHandlerExtension.doAnalysis
 */


abstract fun isApplicable ( configuration : CompilerConfiguration ) : Boolean

/**
 * Checks whether [doAnalysis] should be called
 * @param configuration compiler configuration
 * @return true if [doAnalysis] should be called
 */


abstract fun doAnalysis ( configuration : CompilerConfiguration ) : Boolean

/**
 * Performs code analysis
 * @param configuration compiler configuration
 * @return [true] if analysis completed successfully, [false] otherwise.
 * There can be different causes of failure, an incorrect configuration for example.
 * A failure means that there's no reason to continue building the project.
 */


public fun DataFrame . Companion . readSqlTable ( dbConfig : DatabaseConfiguration , tableName : String , limit : Int = DEFAULT_LIMIT ) : AnyFrame

{ <EOL> DriverManager . getConnection ( dbConfig . url , dbConfig . user , dbConfig . password ) . use { connection -> <EOL> return readSqlTable ( connection , tableName , limit ) <EOL> } <EOL> }

/**
 * Reads data from an SQL table and converts it into a DataFrame.
 *
 * @param [dbConfig] the configuration for the database, including URL, user, and password.
 * @param [tableName] the name of the table to read data from.
 * @param [limit] the maximum number of rows to retrieve from the table.
 * @return the DataFrame containing the data from the SQL table.
 */


public fun DataFrame . Companion . readSqlTable ( connection : Connection , tableName : String , limit : Int = DEFAULT_LIMIT ) : AnyFrame

{ <EOL> var preparedQuery = "<STR_LIT>" <EOL> if ( limit > <NUM_LIT:0> ) preparedQuery += "<STR_LIT>" <EOL> val url = connection . metaData . url <EOL> val dbType = extractDBTypeFromUrl ( url ) <EOL> connection . createStatement ( ) . use { st -> <EOL> logger . debug { "<STR_LIT>" } <EOL> st . executeQuery ( preparedQuery ) . use { rs -> <EOL> val tableColumns = getTableColumnsMetadata ( rs ) <EOL> return fetchAndConvertDataFromResultSet ( tableColumns , rs , dbType , limit ) <EOL> } <EOL> } <EOL> }

/**
 * Reads data from an SQL table and converts it into a DataFrame.
 *
 * @param [connection] the database connection to read tables from.
 * @param [tableName] the name of the table to read data from.
 * @param [limit] the maximum number of rows to retrieve from the table.
 * @return the DataFrame containing the data from the SQL table.
 *
 * @see DriverManager.getConnection
 */


public fun DataFrame . Companion . readSqlQuery ( dbConfig : DatabaseConfiguration , sqlQuery : String , limit : Int = DEFAULT_LIMIT ) : AnyFrame

{ <EOL> DriverManager . getConnection ( dbConfig . url , dbConfig . user , dbConfig . password ) . use { connection -> <EOL> return readSqlQuery ( connection , sqlQuery , limit ) <EOL> } <EOL> }

/**
 * Converts the result of an SQL query to the DataFrame.
 *
 * NOTE: SQL query should start from SELECT and contain one query for reading data without any manipulation.
 * It should not contain `;` symbol.
 *
 * @param [dbConfig] the database configuration to connect to the database, including URL, user, and password.
 * @param [sqlQuery] the SQL query to execute.
 * @param [limit] the maximum number of rows to retrieve from the result of the SQL query execution.
 * @return the DataFrame containing the result of the SQL query.
 */


public fun DataFrame . Companion . readSqlQuery ( connection : Connection , sqlQuery : String , limit : Int = DEFAULT_LIMIT ) : AnyFrame

{ <EOL> require ( isValid ( sqlQuery ) ) { "<STR_LIT>" } <EOL> val url = connection . metaData . url <EOL> val dbType = extractDBTypeFromUrl ( url ) <EOL> var internalSqlQuery = sqlQuery <EOL> if ( limit > <NUM_LIT:0> ) internalSqlQuery += "<STR_LIT>" <EOL> logger . debug { "<STR_LIT>" } <EOL> connection . createStatement ( ) . use { st -> <EOL> st . executeQuery ( internalSqlQuery ) . use { rs -> <EOL> val tableColumns = getTableColumnsMetadata ( rs ) <EOL> return fetchAndConvertDataFromResultSet ( tableColumns , rs , dbType , DEFAULT_LIMIT ) <EOL> } <EOL> } <EOL> }

/**
 * Converts the result of an SQL query to the DataFrame.
 *
 * NOTE: SQL query should start from SELECT and contain one query for reading data without any manipulation.
 * It should not contain `;` symbol.
 *
 * @param [connection] the database connection to execute the SQL query.
 * @param [sqlQuery] the SQL query to execute.
 * @param [limit] the maximum number of rows to retrieve from the result of the SQL query execution.
 * @return the DataFrame containing the result of the SQL query.
 *
 * @see DriverManager.getConnection
 */


private fun isValid ( sqlQuery : String ) : Boolean

{ <EOL> val normalizedSqlQuery = sqlQuery . trim ( ) . uppercase ( ) <EOL> return normalizedSqlQuery . startsWith ( START_OF_READ_SQL_QUERY ) && <EOL> ! normalizedSqlQuery . contains ( MULTIPLE_SQL_QUERY_SEPARATOR ) <EOL> }

/** SQL-query is accepted only if it starts from SELECT */


public fun DataFrame . Companion . readResultSet ( resultSet : ResultSet , dbType : DbType , limit : Int = DEFAULT_LIMIT ) : AnyFrame

{ <EOL> val tableColumns = getTableColumnsMetadata ( resultSet ) <EOL> return fetchAndConvertDataFromResultSet ( tableColumns , resultSet , dbType , limit ) <EOL> }

/**
 * Reads the data from a [ResultSet] and converts it into a DataFrame.
 *
 * @param [resultSet] the [ResultSet] containing the data to read.
 * @param [dbType] the type of database that the [ResultSet] belongs to.
 * @param [limit] the maximum number of rows to read from the [ResultSet].
 * @return the DataFrame generated from the [ResultSet] data.
 */


public fun DataFrame . Companion . readResultSet ( resultSet : ResultSet , connection : Connection , limit : Int = DEFAULT_LIMIT ) : AnyFrame

{ <EOL> val url = connection . metaData . url <EOL> val dbType = extractDBTypeFromUrl ( url ) <EOL> return readResultSet ( resultSet , dbType , limit ) <EOL> }

/**
 * Reads the data from a [ResultSet] and converts it into a DataFrame.
 *
 * @param [resultSet] the [ResultSet] containing the data to read.
 * @param [connection] the connection to the database (it's required to extract the database type).
 * @param [limit] the maximum number of rows to read from the [ResultSet].
 * @return the DataFrame generated from the [ResultSet] data.
 */


public fun DataFrame . Companion . readAllSqlTables ( dbConfig : DatabaseConfiguration , catalogue : String ? = null , limit : Int = DEFAULT_LIMIT ) : List < AnyFrame >

{ <EOL> DriverManager . getConnection ( dbConfig . url , dbConfig . user , dbConfig . password ) . use { connection -> <EOL> return readAllSqlTables ( connection , catalogue , limit ) <EOL> } <EOL> }

/**
 * Reads all tables from the given database using the provided database configuration and limit.
 *
 * @param [dbConfig] the database configuration to connect to the database, including URL, user, and password.
 * @param [limit] the maximum number of rows to read from each table.
 * @return a list of [AnyFrame] objects representing the non-system tables from the database.
 */


public fun DataFrame . Companion . readAllSqlTables ( connection : Connection , catalogue : String ? = null , limit : Int = DEFAULT_LIMIT ) : List < AnyFrame >

{ <EOL> val metaData = connection . metaData <EOL> val url = connection . metaData . url <EOL> val dbType = extractDBTypeFromUrl ( url ) <EOL> val tables = metaData . getTables ( catalogue , null , null , arrayOf ( "<STR_LIT>" ) ) <EOL> val dataFrames = mutableListOf < AnyFrame > ( ) <EOL> while ( tables . next ( ) ) { <EOL> val table = dbType . buildTableMetadata ( tables ) <EOL> if ( ! dbType . isSystemTable ( table ) ) { <EOL> val tableName = if ( catalogue != null ) catalogue + "<STR_LIT:.>" + table . name else table . name <EOL> logger . debug { "<STR_LIT>" } <EOL> val dataFrame = readSqlTable ( connection , tableName , limit ) <EOL> dataFrames += dataFrame <EOL> logger . debug { "<STR_LIT>" } <EOL> } <EOL> } <EOL> return dataFrames <EOL> }

/**
 * Reads all non-system tables from a database and returns them as a list of data frames.
 *
 * @param [connection] the database connection to read tables from.
 * @param [limit] the maximum number of rows to read from each table.
 * @return a list of [AnyFrame] objects representing the non-system tables from the database.
 *
 * @see DriverManager.getConnection
 */


public fun DataFrame . Companion . getSchemaForSqlTable ( dbConfig : DatabaseConfiguration , tableName : String ) : DataFrameSchema

{ <EOL> DriverManager . getConnection ( dbConfig . url , dbConfig . user , dbConfig . password ) . use { connection -> <EOL> return getSchemaForSqlTable ( connection , tableName ) <EOL> } <EOL> }

/**
 * Retrieves the schema for an SQL table using the provided database configuration.
 *
 * @param [dbConfig] the database configuration to connect to the database, including URL, user, and password.
 * @param [tableName] the name of the SQL table for which to retrieve the schema.
 * @return the [DataFrameSchema] object representing the schema of the SQL table
 */


public fun DataFrame . Companion . getSchemaForSqlTable ( connection : Connection , tableName : String ) : DataFrameSchema

{ <EOL> val url = connection . metaData . url <EOL> val dbType = extractDBTypeFromUrl ( url ) <EOL> val preparedQuery = "<STR_LIT>" <EOL> connection . createStatement ( ) . use { st -> <EOL> st . executeQuery ( preparedQuery ) . use { rs -> <EOL> val tableColumns = getTableColumnsMetadata ( rs ) <EOL> return buildSchemaByTableColumns ( tableColumns , dbType ) <EOL> } <EOL> } <EOL> }

/**
 * Retrieves the schema for an SQL table using the provided database connection.
 *
 * @param [connection] the database connection.
 * @param [tableName] the name of the SQL table for which to retrieve the schema.
 * @return the schema of the SQL table as a [DataFrameSchema] object.
 *
 * @see DriverManager.getConnection
 */


public fun DataFrame . Companion . getSchemaForSqlQuery ( dbConfig : DatabaseConfiguration , sqlQuery : String ) : DataFrameSchema

{ <EOL> DriverManager . getConnection ( dbConfig . url , dbConfig . user , dbConfig . password ) . use { connection -> <EOL> return getSchemaForSqlQuery ( connection , sqlQuery ) <EOL> } <EOL> }

/**
 * Retrieves the schema of an SQL query result using the provided database configuration.
 *
 * @param [dbConfig] the database configuration to connect to the database, including URL, user, and password.
 * @param [sqlQuery] the SQL query to execute and retrieve the schema from.
 * @return the schema of the SQL query as a [DataFrameSchema] object.
 */


public fun DataFrame . Companion . getSchemaForSqlQuery ( connection : Connection , sqlQuery : String ) : DataFrameSchema

{ <EOL> val url = connection . metaData . url <EOL> val dbType = extractDBTypeFromUrl ( url ) <EOL> connection . createStatement ( ) . use { st -> <EOL> st . executeQuery ( sqlQuery ) . use { rs -> <EOL> val tableColumns = getTableColumnsMetadata ( rs ) <EOL> return buildSchemaByTableColumns ( tableColumns , dbType ) <EOL> } <EOL> } <EOL> }

/**
 * Retrieves the schema of an SQL query result using the provided database connection.
 *
 * @param [connection] the database connection.
 * @param [sqlQuery] the SQL query to execute and retrieve the schema from.
 * @return the schema of the SQL query as a [DataFrameSchema] object.
 *
 * @see DriverManager.getConnection
 */


public fun DataFrame . Companion . getSchemaForResultSet ( resultSet : ResultSet , dbType : DbType ) : DataFrameSchema

{ <EOL> val tableColumns = getTableColumnsMetadata ( resultSet ) <EOL> return buildSchemaByTableColumns ( tableColumns , dbType ) <EOL> }

/**
 * Retrieves the schema from [ResultSet].
 *
 * NOTE: This function will not close connection and result set and not retrieve data from the result set.
 *
 * @param [resultSet] the [ResultSet] obtained from executing a database query.
 * @param [dbType] the type of database that the [ResultSet] belongs to.
 * @return the schema of the [ResultSet] as a [DataFrameSchema] object.
 */


public fun DataFrame . Companion . getSchemaForResultSet ( resultSet : ResultSet , connection : Connection ) : DataFrameSchema

{ <EOL> val url = connection . metaData . url <EOL> val dbType = extractDBTypeFromUrl ( url ) <EOL> val tableColumns = getTableColumnsMetadata ( resultSet ) <EOL> return buildSchemaByTableColumns ( tableColumns , dbType ) <EOL> }

/**
 * Retrieves the schema from [ResultSet].
 *
 * NOTE: [connection] is required to extract the database type.
 * This function will not close connection and result set and not retrieve data from the result set.
 *
 * @param [resultSet] the [ResultSet] obtained from executing a database query.
 * @param [connection] the connection to the database (it's required to extract the database type).
 * @return the schema of the [ResultSet] as a [DataFrameSchema] object.
 */


public fun DataFrame . Companion . getSchemaForAllSqlTables ( dbConfig : DatabaseConfiguration ) : List < DataFrameSchema >

{ <EOL> DriverManager . getConnection ( dbConfig . url , dbConfig . user , dbConfig . password ) . use { connection -> <EOL> return getSchemaForAllSqlTables ( connection ) <EOL> } <EOL> }

/**
 * Retrieves the schema of all non-system tables in the database using the provided database configuration.
 *
 * @param [dbConfig] the database configuration to connect to the database, including URL, user, and password.
 * @return a list of [DataFrameSchema] objects representing the schema of each non-system table.
 */


public fun DataFrame . Companion . getSchemaForAllSqlTables ( connection : Connection ) : List < DataFrameSchema >

{ <EOL> val metaData = connection . metaData <EOL> val url = connection . metaData . url <EOL> val dbType = extractDBTypeFromUrl ( url ) <EOL> val tableTypes = arrayOf ( "<STR_LIT>" ) <EOL> val tables = metaData . getTables ( null , null , null , tableTypes ) <EOL> val dataFrameSchemas = mutableListOf < DataFrameSchema > ( ) <EOL> while ( tables . next ( ) ) { <EOL> val jdbcTable = dbType . buildTableMetadata ( tables ) <EOL> if ( ! dbType . isSystemTable ( jdbcTable ) ) { <EOL> val dataFrameSchema = getSchemaForSqlTable ( connection , jdbcTable . name ) <EOL> dataFrameSchemas += dataFrameSchema <EOL> } <EOL> } <EOL> return dataFrameSchemas <EOL> }

/**
 * Retrieves the schema of all non-system tables in the database using the provided database connection.
 *
 * @param [connection] the database connection.
 * @return a list of [DataFrameSchema] objects representing the schema of each non-system table.
 */


private fun buildSchemaByTableColumns ( tableColumns : MutableList < TableColumnMetadata > , dbType : DbType ) : DataFrameSchema

{ <EOL> val schemaColumns = tableColumns . associate { <EOL> Pair ( it . name , generateColumnSchemaValue ( dbType , it ) ) <EOL> } <EOL> return DataFrameSchemaImpl ( columns = schemaColumns ) <EOL> }

/**
 * Builds a DataFrame schema based on the given table columns.
 *
 * @param [tableColumns] a mutable map containing the table columns, where the key represents the column name
 * and the value represents the metadata of the column
 * @param [dbType] the type of database.
 * @return a [DataFrameSchema] object representing the schema built from the table columns.
 */


private fun getTableColumnsMetadata ( rs : ResultSet ) : MutableList < TableColumnMetadata >

{ <EOL> val metaData : ResultSetMetaData = rs . metaData <EOL> val numberOfColumns : Int = metaData . columnCount <EOL> val tableColumns = mutableListOf < TableColumnMetadata > ( ) <EOL> val columnNameCounter = mutableMapOf < String , Int > ( ) <EOL> val databaseMetaData : DatabaseMetaData = rs . statement . connection . metaData <EOL> val catalog : String ? = rs . statement . connection . catalog . takeUnless { it . isNullOrBlank ( ) } <EOL> val schema : String ? = rs . statement . connection . schema . takeUnless { it . isNullOrBlank ( ) } <EOL> for ( i in <NUM_LIT:1> until numberOfColumns + <NUM_LIT:1> ) { <EOL> val columnResultSet : ResultSet = <EOL> databaseMetaData . getColumns ( catalog , schema , metaData . getTableName ( i ) , metaData . getColumnName ( i ) ) <EOL> val isNullable = if ( columnResultSet . next ( ) ) { <EOL> columnResultSet . getString ( "<STR_LIT>" ) == "<STR_LIT>" <EOL> } else { <EOL> true <EOL> } <EOL> val name = manageColumnNameDuplication ( columnNameCounter , metaData . getColumnName ( i ) ) <EOL> val size = metaData . getColumnDisplaySize ( i ) <EOL> val type = metaData . getColumnTypeName ( i ) <EOL> val jdbcType = metaData . getColumnType ( i ) <EOL> val javaClassName = metaData . getColumnClassName ( i ) <EOL> tableColumns += TableColumnMetadata ( name , type , jdbcType , size , javaClassName , isNullable ) <EOL> } <EOL> return tableColumns <EOL> }

/**
 * Retrieves the metadata of the columns in the result set.
 *
 * @param rs the result set
 * @return a mutable list of [TableColumnMetadata] objects,
 * where each TableColumnMetadata object contains information such as the column type,
 * JDBC type, size, and name.
 */


private fun manageColumnNameDuplication ( columnNameCounter : MutableMap < String , Int > , originalName : String ) : String

{ <EOL> var name = originalName <EOL> val count = columnNameCounter [ originalName ] <EOL> if ( count != null ) { <EOL> var incrementedCount = count + <NUM_LIT:1> <EOL> while ( columnNameCounter . containsKey ( "<STR_LIT>" ) ) { <EOL> incrementedCount ++ <EOL> } <EOL> columnNameCounter [ originalName ] = incrementedCount <EOL> name = "<STR_LIT>" <EOL> } else { <EOL> columnNameCounter [ originalName ] = <NUM_LIT:0> <EOL> } <EOL> return name <EOL> }

/**
 * Manages the duplication of column names by appending a unique identifier to the original name if necessary.
 *
 * @param columnNameCounter a mutable map that keeps track of the count for each column name.
 * @param originalName the original name of the column to be managed.
 * @return the modified column name that is free from duplication.
 */


private fun fetchAndConvertDataFromResultSet ( tableColumns : MutableList < TableColumnMetadata > , rs : ResultSet , dbType : DbType , limit : Int ) : AnyFrame

{ <EOL> val data = List ( tableColumns . size ) { mutableListOf < Any ? > ( ) } <EOL> val kotlinTypesForSqlColumns = mutableMapOf < Int , KType > ( ) <EOL> List ( tableColumns . size ) { index -> <EOL> kotlinTypesForSqlColumns [ index ] = generateKType ( dbType , tableColumns [ index ] ) <EOL> } <EOL> var counter = <NUM_LIT:0> <EOL> if ( limit > <NUM_LIT:0> ) { <EOL> while ( counter < limit && rs . next ( ) ) { <EOL> extractNewRowFromResultSetAndAddToData ( tableColumns , data , rs , kotlinTypesForSqlColumns ) <EOL> counter ++ <EOL> } <EOL> } else { <EOL> while ( rs . next ( ) ) { <EOL> extractNewRowFromResultSetAndAddToData ( tableColumns , data , rs , kotlinTypesForSqlColumns ) <EOL> counter ++ <EOL> } <EOL> } <EOL> val dataFrame = data . mapIndexed { index , values -> <EOL> DataColumn . createValueColumn ( name = tableColumns [ index ] . name , values = values , type = kotlinTypesForSqlColumns [ index ] ! ! <EOL> ) <EOL> } . toDataFrame ( ) <EOL> logger . debug { "<STR_LIT>" } <EOL> return dataFrame <EOL> }

/**
 * Fetches and converts data from a ResultSet into a mutable map.
 *
 * @param [tableColumns] a list containing the column metadata for the table.
 * @param [rs] the ResultSet object containing the data to be fetched and converted.
 * @param [dbType] the type of the database.
 * @param [limit] the maximum number of rows to fetch and convert.
 * @return A mutable map containing the fetched and converted data.
 */


private fun generateKType ( dbType : DbType , tableColumnMetadata : TableColumnMetadata ) : KType

{ <EOL> return dbType . convertSqlTypeToKType ( tableColumnMetadata ) ? : makeCommonSqlToKTypeMapping ( tableColumnMetadata ) <EOL> }

/**
 * Generates a KType based on the given database type and table column metadata.
 *
 * @param dbType The database type.
 * @param tableColumnMetadata The table column metadata.
 *
 * @return The generated KType.
 */


private fun makeCommonSqlToKTypeMapping ( tableColumnMetadata : TableColumnMetadata ) : KType

{ <EOL> val jdbcTypeToKTypeMapping = mapOf ( Types . BIT to Boolean :: class , Types . TINYINT to Int :: class , Types . SMALLINT to Int :: class , Types . INTEGER to Int :: class , Types . BIGINT to Long :: class , Types . FLOAT to Float :: class , Types . REAL to Float :: class , Types . DOUBLE to Double :: class , Types . NUMERIC to BigDecimal :: class , Types . DECIMAL to BigDecimal :: class , Types . CHAR to Char :: class , Types . VARCHAR to String :: class , Types . LONGVARCHAR to String :: class , Types . DATE to Date :: class , Types . TIME to Time :: class , Types . TIMESTAMP to Timestamp :: class , Types . BINARY to ByteArray :: class , Types . VARBINARY to ByteArray :: class , Types . LONGVARBINARY to ByteArray :: class , Types . NULL to String :: class , Types . OTHER to Any :: class , Types . JAVA_OBJECT to Any :: class , Types . DISTINCT to Any :: class , Types . STRUCT to Any :: class , Types . ARRAY to Array < Any > :: class , Types . BLOB to Blob :: class , Types . CLOB to Clob :: class , Types . REF to Ref :: class , Types . DATALINK to Any :: class , Types . BOOLEAN to Boolean :: class , Types . ROWID to RowId :: class , Types . NCHAR to Char :: class , Types . NVARCHAR to String :: class , Types . LONGNVARCHAR to String :: class , Types . NCLOB to NClob :: class , Types . SQLXML to SQLXML :: class , Types . REF_CURSOR to Ref :: class , Types . TIME_WITH_TIMEZONE to Time :: class , Types . TIMESTAMP_WITH_TIMEZONE to Timestamp :: class ) <EOL> val kClass = jdbcTypeToKTypeMapping [ tableColumnMetadata . jdbcType ] ? : String :: class <EOL> return kClass . createType ( nullable = tableColumnMetadata . isNullable ) <EOL> }

/**
 * Creates a mapping between common SQL types and their corresponding KTypes.
 *
 * @param tableColumnMetadata The metadata of the table column.
 * @return The KType associated with the SQL type, or a default type if no mapping is found.
 */


fun CPointer < CPointed > . customExtension ( )

{ <EOL> println ( this . rawValue ) <EOL> }


{ <EOL> runImageRecognitionPrediction ( modelType = TFModels . CV . MobileNetV2 ( ) ) <EOL> }

/**
 * This example demonstrates the inference concept on MobileNetV2 model:
 * - Model configuration, model weights and labels are obtained from [TFModelHub].
 * - Weights are loaded from .h5 file, configuration is loaded from .json file.
 * - Model predicts on a few images located in resources.
 * - Special preprocessing (used in MobileNetV2 during training on ImageNet dataset) is applied to each image before prediction.
 */


= mobileNetV2Prediction ( )


private fun IrFunction . wasAlreadyCalled ( ) : Boolean

{ <EOL> val anyParameter = this . getLastOverridden ( ) . dispatchReceiverParameter ! ! . symbol <EOL> val callStack = callInterceptor . environment . callStack <EOL> if ( callStack . containsStateInMemory ( anyParameter ) && callStack . loadState ( anyParameter ) === state ) return true <EOL> return this == callInterceptor . environment . callStack . currentFrameOwner <EOL> }

/**
 * This check used to avoid cyclic calls. For example:
 * override fun toString(): String = super.toString()
 */


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . a ( href : String ? = null , target : String ? = null , classes : String ? = null , crossinline block : A . ( ) -> Unit = { } , ) : T

= A ( attributesMapOf ( "<STR_LIT>" , href , "<STR_LIT>" , target , "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . abbr ( classes : String ? = null , crossinline block : ABBR . ( ) -> Unit = { } ) : T

= ABBR ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )

/**
 * Abbreviated form (e.g., WWW, HTTP,etc.)
 */


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . address ( classes : String ? = null , crossinline block : ADDRESS . ( ) -> Unit = { } ) : T

= ADDRESS ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . area ( shape : AreaShape ? = null , alt : String ? = null , classes : String ? = null , crossinline block : AREA . ( ) -> Unit = { } , ) : T

= AREA ( attributesMapOf ( "<STR_LIT>" , shape ? . enumEncode ( ) , "<STR_LIT>" , alt , "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . article ( classes : String ? = null , crossinline block : ARTICLE . ( ) -> Unit = { } ) : T

= ARTICLE ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )

/**
 * Self-contained syndicatable or reusable composition
 */


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . aside ( classes : String ? = null , crossinline block : ASIDE . ( ) -> Unit = { } ) : T

= ASIDE ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )

/**
 * Sidebar for tangentially related content
 */


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . audio ( classes : String ? = null , crossinline block : AUDIO . ( ) -> Unit = { } ) : T

= AUDIO ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . b ( classes : String ? = null , crossinline block : B . ( ) -> Unit = { } ) : T

= B ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . base ( classes : String ? = null , crossinline block : BASE . ( ) -> Unit = { } ) : T

= BASE ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . bdi ( classes : String ? = null , crossinline block : BDI . ( ) -> Unit = { } ) : T

= BDI ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )

/**
 * Text directionality isolation
 */


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . bdo ( classes : String ? = null , crossinline block : BDO . ( ) -> Unit = { } ) : T

= BDO ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . blockQuote ( classes : String ? = null , crossinline block : BLOCKQUOTE . ( ) -> Unit = { } ) : T

= BLOCKQUOTE ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . body ( classes : String ? = null , crossinline block : BODY . ( ) -> Unit = { } ) : T

= BODY ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . br ( classes : String ? = null , crossinline block : BR . ( ) -> Unit = { } ) : T

= BR ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . button ( formEncType : ButtonFormEncType ? = null , formMethod : ButtonFormMethod ? = null , name : String ? = null , type : ButtonType ? = null , classes : String ? = null , crossinline block : BUTTON . ( ) -> Unit = { } , ) : T

= BUTTON ( attributesMapOf ( "<STR_LIT>" , formEncType ? . enumEncode ( ) , "<STR_LIT>" , formMethod ? . enumEncode ( ) , "<STR_LIT:name>" , name , "<STR_LIT:type>" , type ? . enumEncode ( ) , "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public fun < T , C : TagConsumer < T > > C . canvas ( classes : String ? = null , content : String = "<STR_LIT>" ) : T

= <EOL> CANVAS ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , { + content } )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . canvas ( classes : String ? = null , crossinline block : CANVAS . ( ) -> Unit = { } ) : T

= CANVAS ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . caption ( classes : String ? = null , crossinline block : CAPTION . ( ) -> Unit = { } ) : T

= CAPTION ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . cite ( classes : String ? = null , crossinline block : CITE . ( ) -> Unit = { } ) : T

= CITE ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . code ( classes : String ? = null , crossinline block : CODE . ( ) -> Unit = { } ) : T

= CODE ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . col ( classes : String ? = null , crossinline block : COL . ( ) -> Unit = { } ) : T

= COL ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . colGroup ( classes : String ? = null , crossinline block : COLGROUP . ( ) -> Unit = { } ) : T

= COLGROUP ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . dataList ( classes : String ? = null , crossinline block : DATALIST . ( ) -> Unit = { } ) : T

= DATALIST ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . dd ( classes : String ? = null , crossinline block : DD . ( ) -> Unit = { } ) : T

= DD ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . del ( classes : String ? = null , crossinline block : DEL . ( ) -> Unit = { } ) : T

= DEL ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . details ( classes : String ? = null , crossinline block : DETAILS . ( ) -> Unit = { } ) : T

= DETAILS ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )

/**
 * Disclosure control for hiding details
 */


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . dfn ( classes : String ? = null , crossinline block : DFN . ( ) -> Unit = { } ) : T

= DFN ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . dialog ( classes : String ? = null , crossinline block : DIALOG . ( ) -> Unit = { } ) : T

= DIALOG ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . div ( classes : String ? = null , crossinline block : DIV . ( ) -> Unit = { } ) : T

= DIV ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )

/**
 * Generic language/style container
 */


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . dl ( classes : String ? = null , crossinline block : DL . ( ) -> Unit = { } ) : T

= DL ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . dt ( classes : String ? = null , crossinline block : DT . ( ) -> Unit = { } ) : T

= DT ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . em ( classes : String ? = null , crossinline block : EM . ( ) -> Unit = { } ) : T

= EM ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . embed ( classes : String ? = null , crossinline block : EMBED . ( ) -> Unit = { } ) : T

= EMBED ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . fieldSet ( classes : String ? = null , crossinline block : FIELDSET . ( ) -> Unit = { } ) : T

= FIELDSET ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . figcaption ( classes : String ? = null , crossinline block : FIGCAPTION . ( ) -> Unit = { } ) : T

= FIGCAPTION ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . figure ( classes : String ? = null , crossinline block : FIGURE . ( ) -> Unit = { } ) : T

= FIGURE ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . footer ( classes : String ? = null , crossinline block : FOOTER . ( ) -> Unit = { } ) : T

= FOOTER ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . form ( action : String ? = null , encType : FormEncType ? = null , method : FormMethod ? = null , classes : String ? = null , crossinline block : FORM . ( ) -> Unit = { } , ) : T

= FORM ( attributesMapOf ( "<STR_LIT>" , action , "<STR_LIT>" , encType ? . enumEncode ( ) , "<STR_LIT>" , method ? . enumEncode ( ) , "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . h1 ( classes : String ? = null , crossinline block : H1 . ( ) -> Unit = { } ) : T

= H1 ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . h2 ( classes : String ? = null , crossinline block : H2 . ( ) -> Unit = { } ) : T

= H2 ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . h3 ( classes : String ? = null , crossinline block : H3 . ( ) -> Unit = { } ) : T

= H3 ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . h4 ( classes : String ? = null , crossinline block : H4 . ( ) -> Unit = { } ) : T

= H4 ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . h5 ( classes : String ? = null , crossinline block : H5 . ( ) -> Unit = { } ) : T

= H5 ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . h6 ( classes : String ? = null , crossinline block : H6 . ( ) -> Unit = { } ) : T

= H6 ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> @ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> @ Deprecated ( "<STR_LIT>" ) <EOL> public fun < T , C : TagConsumer < T > > C . head ( content : String = "<STR_LIT>" ) : T

= HEAD ( emptyMap , this ) <EOL> . visitAndFinalize ( this , { + content } )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . head ( crossinline block : HEAD . ( ) -> Unit = { } ) : T

= <EOL> HEAD ( emptyMap , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . `header` ( classes : String ? = null , crossinline block : HEADER . ( ) -> Unit = { } ) : T

= HEADER ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )

/**
 * Introductory or navigational aids for a page or section
 */


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . hr ( classes : String ? = null , crossinline block : HR . ( ) -> Unit = { } ) : T

= HR ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> @ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> @ Deprecated ( "<STR_LIT>" ) <EOL> public fun < T , C : TagConsumer < T > > C . html ( content : String = "<STR_LIT>" , namespace : String ? = null ) : T

= <EOL> HTML ( emptyMap , this , namespace ) <EOL> . visitAndFinalize ( this , { + content } )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . html ( namespace : String ? = null , crossinline block : HTML . ( ) -> Unit = { } ) : T

= HTML ( emptyMap , this , namespace ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . i ( classes : String ? = null , crossinline block : I . ( ) -> Unit = { } ) : T

= I ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public fun < T , C : TagConsumer < T > > C . iframe ( sandbox : IframeSandbox ? = null , classes : String ? = null , content : String = "<STR_LIT>" , ) : T

= IFRAME ( attributesMapOf ( "<STR_LIT>" , sandbox ? . enumEncode ( ) , "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , { + content } )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . iframe ( sandbox : IframeSandbox ? = null , classes : String ? = null , crossinline block : IFRAME . ( ) -> Unit = { } , ) : T

= IFRAME ( attributesMapOf ( "<STR_LIT>" , sandbox ? . enumEncode ( ) , "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . img ( alt : String ? = null , src : String ? = null , loading : ImgLoading ? = null , classes : String ? = null , crossinline block : IMG . ( ) -> Unit = { } , ) : T

= IMG ( attributesMapOf ( "<STR_LIT>" , alt , "<STR_LIT:src>" , src , "<STR_LIT>" , loading ? . enumEncode ( ) , "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . input ( type : InputType ? = null , formEncType : InputFormEncType ? = null , formMethod : InputFormMethod ? = null , name : String ? = null , classes : String ? = null , crossinline block : INPUT . ( ) -> Unit = { } , ) : T

= INPUT ( attributesMapOf ( "<STR_LIT:type>" , type ? . enumEncode ( ) , "<STR_LIT>" , formEncType ? . enumEncode ( ) , "<STR_LIT>" , formMethod ? . enumEncode ( ) , "<STR_LIT:name>" , name , "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . ins ( classes : String ? = null , crossinline block : INS . ( ) -> Unit = { } ) : T

= INS ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . kbd ( classes : String ? = null , crossinline block : KBD . ( ) -> Unit = { } ) : T

= KBD ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )

/**
 * Text to be entered by the user
 */


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . keyGen ( keyType : KeyGenKeyType ? = null , classes : String ? = null , crossinline block : KEYGEN . ( ) -> Unit = { } , ) : T

= KEYGEN ( attributesMapOf ( "<STR_LIT>" , keyType ? . enumEncode ( ) , "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )

/**
 * Cryptographic key-pair generator form control
 */


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . label ( classes : String ? = null , crossinline block : LABEL . ( ) -> Unit = { } ) : T

= LABEL ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . legend ( classes : String ? = null , crossinline block : LEGEND . ( ) -> Unit = { } ) : T

= LEGEND ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . li ( classes : String ? = null , crossinline block : LI . ( ) -> Unit = { } ) : T

= LI ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . link ( href : String ? = null , rel : String ? = null , type : String ? = null , crossinline block : LINK . ( ) -> Unit = { } , ) : T

= LINK ( attributesMapOf ( "<STR_LIT>" , href , "<STR_LIT>" , rel , "<STR_LIT:type>" , type ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . main ( classes : String ? = null , crossinline block : MAIN . ( ) -> Unit = { } ) : T

= MAIN ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )

/**
 * Container for the dominant contents of another element
 */


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . map ( name : String ? = null , classes : String ? = null , crossinline block : MAP . ( ) -> Unit = { } , ) : T

= MAP ( attributesMapOf ( "<STR_LIT:name>" , name , "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . mark ( classes : String ? = null , crossinline block : MARK . ( ) -> Unit = { } ) : T

= MARK ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . meta ( name : String ? = null , content : String ? = null , charset : String ? = null , crossinline block : META . ( ) -> Unit = { } , ) : T

= META ( attributesMapOf ( "<STR_LIT:name>" , name , "<STR_LIT>" , content , "<STR_LIT>" , charset ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . meter ( classes : String ? = null , crossinline block : METER . ( ) -> Unit = { } ) : T

= METER ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . nav ( classes : String ? = null , crossinline block : NAV . ( ) -> Unit = { } ) : T

= NAV ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )

/**
 * Section with navigational links
 */


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . noScript ( classes : String ? = null , crossinline block : NOSCRIPT . ( ) -> Unit = { } ) : T

= NOSCRIPT ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . htmlObject ( classes : String ? = null , crossinline block : OBJECT . ( ) -> Unit = { } ) : T

= OBJECT ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . ol ( classes : String ? = null , crossinline block : OL . ( ) -> Unit = { } ) : T

= OL ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . optGroup ( label : String ? = null , classes : String ? = null , crossinline block : OPTGROUP . ( ) -> Unit = { } , ) : T

= OPTGROUP ( attributesMapOf ( "<STR_LIT>" , label , "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public fun < T , C : TagConsumer < T > > C . option ( classes : String ? = null , content : String = "<STR_LIT>" ) : T

= <EOL> OPTION ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , { + content } )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . option ( classes : String ? = null , crossinline block : OPTION . ( ) -> Unit = { } ) : T

= OPTION ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . output ( classes : String ? = null , crossinline block : OUTPUT . ( ) -> Unit = { } ) : T

= OUTPUT ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . p ( classes : String ? = null , crossinline block : P . ( ) -> Unit = { } ) : T

= P ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . `param` ( name : String ? = null , `value` : String ? = null , crossinline block : PARAM . ( ) -> Unit = { } , ) : T

= PARAM ( attributesMapOf ( "<STR_LIT:name>" , name , "<STR_LIT:value>" , value ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . picture ( crossinline block : PICTURE . ( ) -> Unit = { } ) : T

= <EOL> PICTURE ( emptyMap , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . pre ( classes : String ? = null , crossinline block : PRE . ( ) -> Unit = { } ) : T

= PRE ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . progress ( classes : String ? = null , crossinline block : PROGRESS . ( ) -> Unit = { } ) : T

= PROGRESS ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . q ( classes : String ? = null , crossinline block : Q . ( ) -> Unit = { } ) : T

= Q ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . rp ( classes : String ? = null , crossinline block : RP . ( ) -> Unit = { } ) : T

= RP ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )

/**
 * Parenthesis for ruby annotation text
 */


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . rt ( classes : String ? = null , crossinline block : RT . ( ) -> Unit = { } ) : T

= RT ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . ruby ( classes : String ? = null , crossinline block : RUBY . ( ) -> Unit = { } ) : T

= RUBY ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . s ( classes : String ? = null , crossinline block : S . ( ) -> Unit = { } ) : T

= S ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . samp ( classes : String ? = null , crossinline block : SAMP . ( ) -> Unit = { } ) : T

= SAMP ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> @ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> @ Deprecated ( "<STR_LIT>" ) <EOL> public fun < T , C : TagConsumer < T > > C . script ( type : String ? = null , src : String ? = null , crossorigin : ScriptCrossorigin ? = null , content : String = "<STR_LIT>" , ) : T

= SCRIPT ( attributesMapOf ( "<STR_LIT:type>" , type , "<STR_LIT:src>" , src , "<STR_LIT>" , crossorigin ? . enumEncode ( ) ) , this ) <EOL> . visitAndFinalize ( this , { + content } )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . script ( type : String ? = null , src : String ? = null , crossorigin : ScriptCrossorigin ? = null , crossinline block : SCRIPT . ( ) -> Unit = { } , ) : T

= SCRIPT ( attributesMapOf ( "<STR_LIT:type>" , type , "<STR_LIT:src>" , src , "<STR_LIT>" , crossorigin ? . enumEncode ( ) ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . section ( classes : String ? = null , crossinline block : SECTION . ( ) -> Unit = { } ) : T

= SECTION ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )

/**
 * Generic document or application section
 */


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . select ( classes : String ? = null , crossinline block : SELECT . ( ) -> Unit = { } ) : T

= SELECT ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . small ( classes : String ? = null , crossinline block : SMALL . ( ) -> Unit = { } ) : T

= SMALL ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . source ( classes : String ? = null , crossinline block : SOURCE . ( ) -> Unit = { } ) : T

= SOURCE ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . span ( classes : String ? = null , crossinline block : SPAN . ( ) -> Unit = { } ) : T

= SPAN ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . strong ( classes : String ? = null , crossinline block : STRONG . ( ) -> Unit = { } ) : T

= STRONG ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> @ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> @ Deprecated ( "<STR_LIT>" ) <EOL> public fun < T , C : TagConsumer < T > > C . style ( type : String ? = null , content : String = "<STR_LIT>" ) : T

= <EOL> STYLE ( attributesMapOf ( "<STR_LIT:type>" , type ) , this ) <EOL> . visitAndFinalize ( this , { + content } )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . style ( type : String ? = null , crossinline block : STYLE . ( ) -> Unit = { } ) : T

= STYLE ( attributesMapOf ( "<STR_LIT:type>" , type ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . sub ( classes : String ? = null , crossinline block : SUB . ( ) -> Unit = { } ) : T

= SUB ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . summary ( classes : String ? = null , crossinline block : SUMMARY . ( ) -> Unit = { } ) : T

= SUMMARY ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . sup ( classes : String ? = null , crossinline block : SUP . ( ) -> Unit = { } ) : T

= SUP ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . table ( classes : String ? = null , crossinline block : TABLE . ( ) -> Unit = { } ) : T

= TABLE ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . tbody ( classes : String ? = null , crossinline block : TBODY . ( ) -> Unit = { } ) : T

= TBODY ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . td ( classes : String ? = null , crossinline block : TD . ( ) -> Unit = { } ) : T

= TD ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . template ( classes : String ? = null , crossinline block : TEMPLATE . ( ) -> Unit = { } ) : T

= TEMPLATE ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public fun < T , C : TagConsumer < T > > C . textArea ( rows : String ? = null , cols : String ? = null , wrap : TextAreaWrap ? = null , classes : String ? = null , content : String = "<STR_LIT>" , ) : T

= TEXTAREA ( attributesMapOf ( "<STR_LIT>" , rows , "<STR_LIT>" , cols , "<STR_LIT>" , wrap ? . enumEncode ( ) , "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , { + content } )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . textArea ( rows : String ? = null , cols : String ? = null , wrap : TextAreaWrap ? = null , classes : String ? = null , crossinline block : TEXTAREA . ( ) -> Unit = { } , ) : T

= TEXTAREA ( attributesMapOf ( "<STR_LIT>" , rows , "<STR_LIT>" , cols , "<STR_LIT>" , wrap ? . enumEncode ( ) , "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . tfoot ( classes : String ? = null , crossinline block : TFOOT . ( ) -> Unit = { } ) : T

= TFOOT ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . th ( scope : ThScope ? = null , classes : String ? = null , crossinline block : TH . ( ) -> Unit = { } , ) : T

= TH ( attributesMapOf ( "<STR_LIT>" , scope ? . enumEncode ( ) , "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . thead ( classes : String ? = null , crossinline block : THEAD . ( ) -> Unit = { } ) : T

= THEAD ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . time ( classes : String ? = null , crossinline block : TIME . ( ) -> Unit = { } ) : T

= TIME ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )

/**
 * Machine-readable equivalent of date- or time-related data
 */


@ HtmlTagMarker <EOL> public fun < T , C : TagConsumer < T > > C . title ( content : String = "<STR_LIT>" ) : T

= TITLE ( emptyMap , this ) <EOL> . visitAndFinalize ( this , { + content } )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . title ( crossinline block : TITLE . ( ) -> Unit = { } ) : T

= <EOL> TITLE ( emptyMap , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . tr ( classes : String ? = null , crossinline block : TR . ( ) -> Unit = { } ) : T

= TR ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . u ( classes : String ? = null , crossinline block : U . ( ) -> Unit = { } ) : T

= U ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . ul ( classes : String ? = null , crossinline block : UL . ( ) -> Unit = { } ) : T

= UL ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . htmlVar ( classes : String ? = null , crossinline block : VAR . ( ) -> Unit = { } ) : T

= VAR ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


@ HtmlTagMarker <EOL> public inline fun < T , C : TagConsumer < T > > C . video ( classes : String ? = null , crossinline block : VIDEO . ( ) -> Unit = { } ) : T

= VIDEO ( attributesMapOf ( "<STR_LIT:class>" , classes ) , this ) <EOL> . visitAndFinalize ( this , block )


= toStringInternalImpl ( ) ? : "<STR_LIT>"

/**
 * Returns a name of this main dispatcher for debugging purposes. This implementation returns
 * `Dispatchers.Main` or `Dispatchers.Main.immediate` if it is the same as the corresponding
 * reference in [Dispatchers] or a short class-name representation with address otherwise.
 */


@ InternalCoroutinesApi <EOL> protected fun toStringInternalImpl ( ) : String ?

{ <EOL> val main = Dispatchers . Main <EOL> if ( this === main ) return "<STR_LIT>" <EOL> val immediate = <EOL> try { main . immediate } <EOL> catch ( e : UnsupportedOperationException ) { null } <EOL> if ( this === immediate ) return "<STR_LIT>" <EOL> return null <EOL> }

/**
 * Internal method for more specific [toString] implementations. It returns non-null
 * string if this dispatcher is set in the platform as the main one.
 * @suppress
 */


fun testRunClassFileWithExtensionInDefaultPackage ( )

{ <EOL> val subDir = File ( "<STR_LIT>" ) . apply { mkdirs ( ) } <EOL> val testDir = File ( "<STR_LIT>" ) <EOL> kotlincInProcess ( "<STR_LIT>" , "<STR_LIT:-d>" , testDir . path ) <EOL> assertExists ( File ( "<STR_LIT>" ) ) <EOL> runProcess ( "<STR_LIT:kotlin>" , "<STR_LIT>" , workDirectory = tmpdir , expectedExitCode = <NUM_LIT:1> , expectedStderr = """<STR_LIT>""" . trimIndent ( ) ) <EOL> runProcess ( "<STR_LIT:kotlin>" , "<STR_LIT>" , expectedStdout = "<STR_LIT:ok>" , workDirectory = testDir ) <EOL> runProcess ( "<STR_LIT:kotlin>" , "<STR_LIT>" , expectedStdout = "<STR_LIT:ok>" , workDirectory = testDir ) <EOL> runProcess ( "<STR_LIT:kotlin>" , "<STR_LIT>" , expectedExitCode = <NUM_LIT:1> , expectedStderr = "<STR_LIT>" , workDirectory = subDir ) <EOL> }

/**
 * A class whose full qualified name is `DefaultPackageKt` and is located in path `$tmpdir/test/DefaultPackageKt.class`
 */


fun testRunClassFileWithExtensionNotInDefaultPackage ( )

{ <EOL> val subDir = File ( "<STR_LIT>" ) . apply { mkdirs ( ) } <EOL> val testDir = File ( "<STR_LIT>" ) <EOL> kotlincInProcess ( "<STR_LIT>" , "<STR_LIT:-d>" , tmpdir . path ) <EOL> assertExists ( File ( "<STR_LIT>" ) ) <EOL> runProcess ( "<STR_LIT:kotlin>" , "<STR_LIT>" , expectedStdout = "<STR_LIT>" , workDirectory = tmpdir ) <EOL> runProcess ( "<STR_LIT:kotlin>" , "<STR_LIT>" , expectedExitCode = <NUM_LIT:1> , expectedStderr = "<STR_LIT>" , workDirectory = tmpdir ) <EOL> runProcess ( "<STR_LIT:kotlin>" , "<STR_LIT>" , expectedStdout = "<STR_LIT>" , workDirectory = tmpdir ) <EOL> runProcess ( "<STR_LIT:kotlin>" , "<STR_LIT>" , workDirectory = testDir , expectedExitCode = <NUM_LIT:1> , expectedStderr = """<STR_LIT>""" . trimIndent ( ) ) <EOL> runProcess ( "<STR_LIT:kotlin>" , "<STR_LIT>" , workDirectory = testDir , expectedExitCode = <NUM_LIT:1> , expectedStderr = """<STR_LIT>""" . trimIndent ( ) ) <EOL> runProcess ( "<STR_LIT:kotlin>" , "<STR_LIT>" , expectedExitCode = <NUM_LIT:1> , expectedStderr = "<STR_LIT>" , workDirectory = subDir ) <EOL> }

/**
 * A class whose full qualified name is `test.HelloWorldKt` and is located in path `$tmpdir/test/HelloWorldKt.class`
 */


fun reset ( )

/**
 * Performs truly reset of the engine state.
 * */


fun saveGlobalState ( )

/**
 * Saves current state of global object.
 *
 * See also [restoreGlobalState]
 */


fun restoreGlobalState ( )

/**
 * Restores global object from the last saved state.
 *
 * See also [saveGlobalState]
 */


fun release ( )

/**
 * Release held resources.
 *
 * Must be called explicitly before an object is garbage collected to avoid leaking resources.
 */


private fun findCommonSuperTypeOrIntersectionType ( types : Collection < SimpleType > , mode : Mode ) : SimpleType ?

{ <EOL> if ( types . isEmpty ( ) ) return null <EOL> return types . reduce { left : SimpleType ? , right : SimpleType ? -> fold ( left , right , mode ) } <EOL> }

/**
 * intersection(ILT(types), PrimitiveType) = commonSuperType(ILT(types), PrimitiveType) =
 * PrimitiveType in types -> PrimitiveType
 * PrimitiveType !in types -> null
 *
 * intersection(ILT(types_1), ILT(types_2)) = ILT(types_1 union types_2)
 *
 * commonSuperType(ILT(types_1), ILT(types_2)) = ILT(types_1 intersect types_2)
 */


fun CompiledProject . assertTestResults ( @ TestDataFile assertionFileName : String , vararg testReportNames : String )

= assertTestResults ( resourcesRootFile . resolve ( assertionFileName ) , * testReportNames )

/**
 * @param assertionFileName path to xml with expected test results, relative to test resources root
 */


fun CompiledProject . getOutputForTask ( taskPath : String ) : String

= getOutputForTask ( taskPath , output )

/**
 * Filter output for specific task with given [taskPath]
 *
 * Requires using [LogLevel.DEBUG].
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> internal fun BaseContinuationImpl . getStackTraceElementImpl ( ) : StackTraceElement ?

{ <EOL> val debugMetadata = getDebugMetadataAnnotation ( ) ? : return null <EOL> checkDebugMetadataVersion ( COROUTINES_DEBUG_METADATA_VERSION , debugMetadata . version ) <EOL> val label = getLabel ( ) <EOL> val lineNumber = if ( label < <NUM_LIT:0> ) - <NUM_LIT:1> else debugMetadata . lineNumbers [ label ] <EOL> val moduleName = ModuleNameRetriever . getModuleName ( this ) <EOL> val moduleAndClass = if ( moduleName == null ) debugMetadata . className else "<STR_LIT>" <EOL> return StackTraceElement ( moduleAndClass , debugMetadata . methodName , debugMetadata . sourceFile , lineNumber ) <EOL> }

/**
 * Returns [StackTraceElement] containing file name and line number of current coroutine's suspension point.
 * The coroutine can be either running coroutine, that calls the function on its continuation and obtaining
 * the information about current file and line number, or, more likely, the function is called to produce accurate stack traces of
 * suspended coroutine.
 *
 * The result is `null` when debug metadata is not available.
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ JvmName ( "<STR_LIT>" ) <EOL> internal fun BaseContinuationImpl . getSpilledVariableFieldMapping ( ) : Array < String > ?

{ <EOL> val debugMetadata = getDebugMetadataAnnotation ( ) ? : return null <EOL> checkDebugMetadataVersion ( COROUTINES_DEBUG_METADATA_VERSION , debugMetadata . version ) <EOL> val res = arrayListOf < String > ( ) <EOL> val label = getLabel ( ) <EOL> for ( ( i , labelOfIndex ) in debugMetadata . indexToLabel . withIndex ( ) ) { <EOL> if ( labelOfIndex == label ) { <EOL> res . add ( debugMetadata . spilled [ i ] ) <EOL> res . add ( debugMetadata . localNames [ i ] ) <EOL> } <EOL> } <EOL> return res . toTypedArray ( ) <EOL> }

/**
 * Returns an array of spilled variable names and continuation's field names where the variable has been spilled.
 * The structure is the following:
 * - field names take 2*k'th indices
 * - corresponding variable names take (2*k + 1)'th indices.
 *
 * The function is for debugger to use, thus it returns simplest data type possible.
 * This function should only be called on suspended coroutines to get accurate mapping.
 *
 * The result is `null` when debug metadata is not available.
 */


fun resolveAndCheckFir ( session : FirSession , firFiles : List < FirFile > , diagnosticsReporter : BaseDiagnosticsCollector ) : ModuleCompilerAnalyzedOutput

{ <EOL> val ( scopeSession , fir ) = session . runResolution ( firFiles ) <EOL> session . runCheckers ( scopeSession , fir , diagnosticsReporter , MppCheckerKind . Common ) <EOL> return ModuleCompilerAnalyzedOutput ( session , scopeSession , fir ) <EOL> }

/**
 * This function runs only common checkers
 * Platform checkers should be run separately, after all parts of MPP structure will be resolved
 */


{ <EOL> val modelHub = <EOL> ONNXModelHub ( cacheDirectory = File ( "<STR_LIT>" ) ) <EOL> val model = ONNXModels . ObjectDetection . SSD . pretrainedModel ( modelHub ) <EOL> model . printSummary ( ) <EOL> model . use { detectionModel -> <EOL> println ( detectionModel ) <EOL> val imageFile = getFileFromResource ( "<STR_LIT>" ) <EOL> val detectedObjects = <EOL> detectionModel . detectObjects ( imageFile = imageFile , topK = <NUM_LIT> ) <EOL> detectedObjects . forEach { <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> }

/**
 * This examples demonstrates the light-weight inference API with [SSDObjectDetectionModel] on SSD model:
 * - Model is obtained from [ONNXModelHub].
 * - Model predicts rectangles for the detected objects on a few images located in resources.
 */


= ssdLightAPI ( )


{ <EOL> val ( train , test ) = mnist ( ) <EOL> lenet5Classic . use { <EOL> it . compile ( optimizer = Adam ( clipGradient = ClipGradientByValue ( <NUM_LIT> ) ) , loss = Losses . SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS , metric = Metrics . ACCURACY ) <EOL> it . logSummary ( ) <EOL> it . fit ( dataset = train , epochs = EPOCHS , batchSize = TRAINING_BATCH_SIZE ) <EOL> val accuracy = it . evaluate ( dataset = test , batchSize = TEST_BATCH_SIZE ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> }

/**
 * This example shows how to do image classification from scratch using [lenet5Classic], without leveraging pre-trained weights or a pre-made model.
 * We demonstrate the workflow on the Mnist classification dataset.
 *
 * It includes:
 * - dataset loading from S3
 * - model compilation
 * - model summary
 * - model training
 * - model evaluation
 */


= lenetClassic ( )


private fun FirNamedFunctionSymbol . computeGetterCompatibility ( ) : GetterCompatibilityResult

{ <EOL> val kotlinBaseAllowed = ! session . languageVersionSettings . supportsFeature ( ForbidSyntheticPropertiesWithoutBaseJavaGetter ) <EOL> var isHiddenEverywhereBesideSuperCalls = false <EOL> var isDeprecatedOverrideOfHidden = false <EOL> var result = Incompatible <EOL> val visited = mutableSetOf < MemberWithBaseScope < FirNamedFunctionSymbol > > ( ) <EOL> fun checkJavaOrigin ( symbol : FirNamedFunctionSymbol , scope : FirTypeScope , isOverridden : Boolean ) { <EOL> val hidden = symbol . hiddenStatusOfCall ( isSuperCall = isSuperCall , isCallToOverride = isOverridden ) <EOL> when ( hidden ) { <EOL> CallToPotentiallyHiddenSymbolResult . Hidden -> isHiddenEverywhereBesideSuperCalls = true <EOL> CallToPotentiallyHiddenSymbolResult . VisibleWithDeprecation -> isDeprecatedOverrideOfHidden = true <EOL> CallToPotentiallyHiddenSymbolResult . Visible -> { } <EOL> } <EOL> val overriddenWithScope = scope . getDirectOverriddenFunctionsWithBaseScope ( symbol ) <EOL> if ( symbol . origin == FirDeclarationOrigin . Enhancement ) { <EOL> val potentialResult = when { <EOL> overriddenWithScope . isEmpty ( ) -> HasJavaOrigin <EOL> kotlinBaseAllowed -> HasKotlinOrigin <EOL> else -> Incompatible <EOL> } <EOL> result = maxOf ( result , potentialResult ) <EOL> } <EOL> overriddenWithScope . forEach { <EOL> if ( ! visited . add ( it ) ) return@forEach <EOL> checkJavaOrigin ( it . member , it . baseScope , isOverridden = true ) <EOL> } <EOL> } <EOL> checkJavaOrigin ( this , baseScope , isOverridden = false ) <EOL> val syntheticGetterCompatibility = when { <EOL> isHiddenEverywhereBesideSuperCalls -> Incompatible <EOL> result != Incompatible -> result <EOL> ! kotlinBaseAllowed -> Incompatible <EOL> isJavaTypeOnThePath ( this . dispatchReceiverType ) -> HasKotlinOrigin <EOL> else -> Incompatible <EOL> } <EOL> return GetterCompatibilityResult ( syntheticGetterCompatibility , isDeprecatedOverrideOfHidden ) <EOL> }

/**
 * This method computes if getter method can be used as base for synthetic property based on overridden hierarchy
 * There are three kinds of compatibility:
 * - `Incompatible` (obvious)
 * - `HasJavaOrigin` indicates that this getter is based on root java function (ok to create property)
 * - `HasKotlinOrigin` shows that there is no base java getter overridden. Property will be created only with some LV (KT-64358)
 */


public fun ImageRecognitionModelBase < Bitmap > . predictObject ( imageProxy : ImageProxy ) : String

= <EOL> when ( this ) { <EOL> is CameraXCompatibleModel -> { <EOL> doWithRotation ( imageProxy . imageInfo . rotationDegrees ) { predictObject ( imageProxy . toBitmap ( ) ) } <EOL> } <EOL> else -> predictObject ( imageProxy . toBitmap ( applyRotation = true ) ) <EOL> }

/**
 * Predicts object for the given [imageProxy].
 * Internal preprocessing is updated to rotate image to match target orientation.
 * After prediction, internal preprocessing is restored to the original state.
 *
 * @param [imageProxy] Input image.
 *
 * @return The label of the recognized object with the highest probability.
 */


public fun ImageRecognitionModelBase < Bitmap > . predictTopKObjects ( imageProxy : ImageProxy , topK : Int = <NUM_LIT:5> ) : List < Pair < String , Float > >

= <EOL> when ( this ) { <EOL> is CameraXCompatibleModel -> { <EOL> doWithRotation ( imageProxy . imageInfo . rotationDegrees ) { predictTopKObjects ( imageProxy . toBitmap ( ) , topK ) } <EOL> } <EOL> else -> predictTopKObjects ( imageProxy . toBitmap ( applyRotation = true ) , topK ) <EOL> }

/**
 * Predicts [topK] objects for the given [imageProxy].
 * Internal preprocessing is updated to rotate image to match target orientation.
 * After prediction, internal preprocessing is restored to the original state.
 *
 * @param [imageProxy] Input image.
 * @param [topK] Number of top ranked predictions to return
 *
 * @return The list of pairs <label, probability> sorted from the most probable to the lowest probable.
 */


public fun ByteString . decodeToString ( charset : Charset ) : String

= getBackingArrayReference ( ) . toString ( charset )

/**
 * Decodes the content of a byte string to a string using given [charset].
 *
 * @param charset the charset to decode data into a string.
 */


public fun String . encodeToByteString ( charset : Charset ) : ByteString

= ByteString . wrap ( toByteArray ( charset ) )

/**
 * Encodes a string into a byte string using [charset].
 *
 * @param charset the encoding.
 */


public fun < T > alpha ( column : ColumnReference < T > , parameters : LetsPlotNonPositionalMappingParametersContinuous < T , Double > . ( ) -> Unit = { } ) : NonPositionalMapping < T , Double >

{ <EOL> return addNonPositionalMapping < T , Double > ( ALPHA , column . name ( ) , LetsPlotNonPositionalMappingParametersContinuous < T , Double > ( ) . apply ( parameters ) . also { <EOL> validateParameters ( it ) <EOL> } ) <EOL> }

/**
 * Maps the alpha aesthetic to a data column by [ColumnReference].
 *
 * @param column the data column to map to alpha.
 * @param parameters optional lambda to configure additional scale parameters.
 * @return the created [NonPositionalMapping].
 * @throws IllegalArgumentException if any mapped alpha value is not in the range [0.0, 1.0].
 */


public fun < T > alpha ( column : KProperty < T > , parameters : LetsPlotNonPositionalMappingParametersContinuous < T , Double > . ( ) -> Unit = { } ) : NonPositionalMapping < T , Double >

{ <EOL> return addNonPositionalMapping < T , Double > ( ALPHA , column . name , LetsPlotNonPositionalMappingParametersContinuous < T , Double > ( ) . apply ( parameters ) . also { <EOL> validateParameters ( it ) <EOL> } ) <EOL> }

/**
 * Maps the alpha aesthetic to a data column by [KProperty].
 *
 * @param column the data column to map to alpha.
 * @param parameters optional lambda to configure additional scale parameters.
 * @return the created [NonPositionalMapping].
 * @throws IllegalArgumentException if any mapped alpha value is not in the range [0.0, 1.0].
 */


public fun alpha ( column : String , parameters : LetsPlotNonPositionalMappingParametersContinuous < Any ? , Double > . ( ) -> Unit = { } ) : NonPositionalMapping < Any ? , Double >

{ <EOL> return addNonPositionalMapping < Any ? , Double > ( ALPHA , column , LetsPlotNonPositionalMappingParametersContinuous < Any ? , Double > ( ) . apply ( parameters ) . also { <EOL> validateParameters ( it ) <EOL> } ) <EOL> }

/**
 * Maps the alpha aesthetic to a data column by [String].
 *
 * @param column the data column to map to alpha.
 * @param parameters optional lambda to configure additional scale parameters.
 * @return the created [NonPositionalMapping].
 * @throws IllegalArgumentException if any mapped alpha value is not in the range [0.0, 1.0].
 */


public fun < T > alpha ( values : Iterable < T > , name : String ? = null , parameters : LetsPlotNonPositionalMappingParametersContinuous < T , Double > . ( ) -> Unit = { } ) : NonPositionalMapping < T , Double >

{ <EOL> return addNonPositionalMapping < T , Double > ( ALPHA , values . toList ( ) , name , LetsPlotNonPositionalMappingParametersContinuous < T , Double > ( ) . apply ( parameters ) . also { <EOL> validateParameters ( it ) <EOL> } ) <EOL> }

/**
 * Maps the alpha aesthetic to an iterable collection of discrete values.
 *
 * @param values an iterable collection containing the discrete values.
 * @param name optional name for this aesthetic mapping.
 * @param parameters optional lambda to configure additional scale parameters.
 * @return the created [NonPositionalMapping].
 * @throws IllegalArgumentException if any mapped alpha value is not in the range [0.0, 1.0].
 */


public fun < T > alpha ( values : DataColumn < T > , parameters : LetsPlotNonPositionalMappingParametersContinuous < T , Double > . ( ) -> Unit = { } ) : NonPositionalMapping < T , Double >

{ <EOL> return addNonPositionalMapping < T , Double > ( ALPHA , values , LetsPlotNonPositionalMappingParametersContinuous < T , Double > ( ) . apply ( parameters ) . also { <EOL> validateParameters ( it ) <EOL> } ) <EOL> }

/**
 * Maps the alpha aesthetic to a data column.
 *
 * @param values the data column to map to alpha.
 * @param parameters optional lambda to configure additional scale parameters.
 * @return the created [NonPositionalMapping].
 * @throws IllegalArgumentException if any mapped alpha value is not in the range [0.0, 1.0].
 */


fun createDetectedObjectsPanel ( bufferedImage : BufferedImage , detectedObjects : List < DetectedObject > ) : JPanel

= createImagePanel ( bufferedImage ) { <EOL> drawObjects ( detectedObjects , bufferedImage . width , bufferedImage . height ) <EOL> }

/**
 * Create a component with the given [bufferedImage] and [detectedObjects] drawn on top of it.
 */


fun createDetectedPosePanel ( bufferedImage : BufferedImage , detectedPose : DetectedPose ) : JPanel

= createImagePanel ( bufferedImage ) { <EOL> drawPose ( detectedPose , bufferedImage . width , bufferedImage . height ) <EOL> }

/**
 * Create a component with the given [bufferedImage] and [detectedPose] drawn on top of it.
 */


fun createMultipleDetectedPosesPanel ( bufferedImage : BufferedImage , multiPoseDetectionResult : MultiPoseDetectionResult ) : JPanel

= createImagePanel ( bufferedImage ) { <EOL> drawMultiplePoses ( multiPoseDetectionResult , bufferedImage . width , bufferedImage . height ) <EOL> }

/**
 * Create a component with the given [bufferedImage] and [multiPoseDetectionResult] drawn on top of it.
 */


fun createDetectedLandmarksPanel ( bufferedImage : BufferedImage , landmarks : List < Landmark > ) : JPanel

= createImagePanel ( bufferedImage ) { <EOL> drawLandmarks ( landmarks , bufferedImage . width , bufferedImage . height ) <EOL> }

/**
 * Create a component with the given [bufferedImage] and [landmarks] drawn on top of it.
 */