From 2a197109ffa3e19fda116e0f9179da53ad3eb9d4 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Tue, 26 Jul 2022 21:51:51 +0200 Subject: [PATCH 01/10] Remove unnecessary usages or TensorFlowInferenceModel type --- .../jetbrains/kotlinx/dl/api/inference/InferenceModel.kt | 4 ++-- .../inference/imagerecognition/ImageRecognitionModel.kt | 6 ++---- .../kotlinx/dl/api/inference/keras/loaders/LoadersUtil.kt | 7 +++---- .../kotlinx/dl/api/inference/onnx/OnnxInferenceModel.kt | 3 +-- .../onnx/facealignment/Fan2D106FaceAlignmentModel.kt | 3 +-- 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/InferenceModel.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/InferenceModel.kt index 92dfd5578..8718df370 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/InferenceModel.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/InferenceModel.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. + * Copyright 2020-2022 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. */ @@ -52,7 +52,7 @@ public abstract class InferenceModel : AutoCloseable { copiedModelName: String? = null, saveOptimizerState: Boolean = false, copyWeights: Boolean = true - ): TensorFlowInferenceModel + ): InferenceModel /** diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/imagerecognition/ImageRecognitionModel.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/imagerecognition/ImageRecognitionModel.kt index 1284207bd..9a4e1ae96 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/imagerecognition/ImageRecognitionModel.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/imagerecognition/ImageRecognitionModel.kt @@ -7,10 +7,8 @@ package org.jetbrains.kotlinx.dl.api.inference.imagerecognition import org.jetbrains.kotlinx.dl.api.core.util.loadImageNetClassLabels import org.jetbrains.kotlinx.dl.api.inference.InferenceModel -import org.jetbrains.kotlinx.dl.api.inference.TensorFlowInferenceModel import org.jetbrains.kotlinx.dl.api.inference.keras.loaders.ModelType import org.jetbrains.kotlinx.dl.api.inference.keras.loaders.predictTopKImageNetLabels -import org.jetbrains.kotlinx.dl.dataset.image.ColorMode import org.jetbrains.kotlinx.dl.dataset.preprocessor.Preprocessing import org.jetbrains.kotlinx.dl.dataset.preprocessor.image.InterpolationType import org.jetbrains.kotlinx.dl.dataset.preprocessor.image.convert @@ -48,7 +46,7 @@ public class ImageRecognitionModel( copiedModelName: String?, saveOptimizerState: Boolean, copyWeights: Boolean - ): TensorFlowInferenceModel { + ): InferenceModel { TODO("Not yet implemented") } @@ -133,4 +131,4 @@ public class ImageRecognitionModel( val (inputData, _) = preprocessing(imageFile) return imageNetClassLabels[internalModel.predict(inputData)]!! } -} +} \ No newline at end of file diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/LoadersUtil.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/LoadersUtil.kt index d2b199672..95a207ae5 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/LoadersUtil.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/LoadersUtil.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. + * Copyright 2020-2022 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. */ @@ -10,7 +10,6 @@ import com.beust.klaxon.JsonObject import com.beust.klaxon.Parser import org.jetbrains.kotlinx.dl.api.core.shape.flattenFloats import org.jetbrains.kotlinx.dl.api.inference.InferenceModel -import org.jetbrains.kotlinx.dl.api.inference.TensorFlowInferenceModel /** * Common preprocessing functions for the Neural Networks trained on ImageNet and whose weights are available with the keras.application. @@ -154,7 +153,7 @@ public fun reshapeInput(inputData: FloatArray, imageShape: LongArray): Array, ): List> { @@ -203,4 +202,4 @@ public fun prepareImageNetHumanReadableClassLabels(): MutableMap { imageNetClassIndices[key.toInt()] = (classIndices[key] as JsonArray<*>)[1].toString() } return imageNetClassIndices -} +} \ No newline at end of file diff --git a/onnx/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/onnx/OnnxInferenceModel.kt b/onnx/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/onnx/OnnxInferenceModel.kt index 1acb1cf30..2d5bd0794 100644 --- a/onnx/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/onnx/OnnxInferenceModel.kt +++ b/onnx/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/onnx/OnnxInferenceModel.kt @@ -11,7 +11,6 @@ import mu.KotlinLogging import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape import org.jetbrains.kotlinx.dl.api.extension.argmax import org.jetbrains.kotlinx.dl.api.inference.InferenceModel -import org.jetbrains.kotlinx.dl.api.inference.TensorFlowInferenceModel import java.nio.* import java.util.* @@ -104,7 +103,7 @@ public open class OnnxInferenceModel : InferenceModel() { copiedModelName: String?, saveOptimizerState: Boolean, copyWeights: Boolean - ): TensorFlowInferenceModel { + ): InferenceModel { TODO("Not yet implemented") } diff --git a/onnx/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/onnx/facealignment/Fan2D106FaceAlignmentModel.kt b/onnx/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/onnx/facealignment/Fan2D106FaceAlignmentModel.kt index 100718278..675deb31e 100644 --- a/onnx/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/onnx/facealignment/Fan2D106FaceAlignmentModel.kt +++ b/onnx/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/onnx/facealignment/Fan2D106FaceAlignmentModel.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlinx.dl.api.inference.onnx.facealignment import org.jetbrains.kotlinx.dl.api.inference.InferenceModel -import org.jetbrains.kotlinx.dl.api.inference.TensorFlowInferenceModel import org.jetbrains.kotlinx.dl.api.inference.facealignment.Landmark import org.jetbrains.kotlinx.dl.api.inference.onnx.ONNXModels import org.jetbrains.kotlinx.dl.api.inference.onnx.OnnxInferenceModel @@ -44,7 +43,7 @@ public class Fan2D106FaceAlignmentModel(private val internalModel: OnnxInference copiedModelName: String?, saveOptimizerState: Boolean, copyWeights: Boolean - ): TensorFlowInferenceModel { + ): InferenceModel { TODO("Not yet implemented") } From 76d1e0ed2fa788a5421fd637bab5b64f11586f12 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Mon, 1 Aug 2022 14:59:06 +0200 Subject: [PATCH 02/10] Extract ModelType interface to a separate file --- .../api/inference/keras/loaders/ModelType.kt | 67 +++++++++++++++++++ .../api/inference/keras/loaders/TFModels.kt | 61 +---------------- 2 files changed, 68 insertions(+), 60 deletions(-) create mode 100644 api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/ModelType.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/ModelType.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/ModelType.kt new file mode 100644 index 000000000..825d4576e --- /dev/null +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/ModelType.kt @@ -0,0 +1,67 @@ +/* + * Copyright 2022 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. + * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. + */ + +package org.jetbrains.kotlinx.dl.api.inference.keras.loaders + +import org.jetbrains.kotlinx.dl.api.inference.InferenceModel +import org.jetbrains.kotlinx.dl.dataset.image.ColorMode +import org.jetbrains.kotlinx.dl.dataset.preprocessor.Preprocessing +import java.io.File + +/** + * Basic interface for models loaded from S3. + * @param T the type of the basic model for common functionality. + * @param U the type of the pre-trained model for usage in Easy API. + */ +public interface ModelType { + /** Relative path to model for local and S3 buckets storages. */ + public val modelRelativePath: String + + /** + * If true it means that the second dimension is related to number of channels in image has short notation as `NCWH`, + * otherwise, channels are at the last position and has a short notation as `NHWC`. + */ + public val channelsFirst: Boolean + + /** + * An expected channels order for the input image. + * Note: the wrong choice of this parameter can significantly impact the model's performance. + */ + public val inputColorMode: ColorMode + + /** + * Common preprocessing function for the Neural Networks trained on ImageNet and whose weights are available with the keras.application. + * + * It takes [data] as input with shape [tensorShape] and applied the specific preprocessing according chosen modelType. + * + * @param [tensorShape] Should be 3 dimensional array (HWC or CHW format) + */ + public fun preprocessInput(data: FloatArray, tensorShape: LongArray): FloatArray + + /** + * Common preprocessing function for the Neural Networks trained on ImageNet and whose weights are available with the keras.application. + * + * It takes preprocessing pipeline, invoke it and applied the specific preprocessing to the given data. + */ + public fun preprocessInput(imageFile: File, preprocessing: Preprocessing): FloatArray { + val (data, shape) = preprocessing(imageFile) + return preprocessInput( + data, + longArrayOf(shape.width!!, shape.height!!, shape.channels!!) + ) + } + + /** Returns the specially prepared pre-trained model of the type U. */ + public fun pretrainedModel(modelHub: ModelHub): U + + /** Loads the model, identified by this name, from the [modelHub]. */ + public fun model(modelHub: ModelHub): T { + return modelHub.loadModel(this) + } + + public fun preInit(): InferenceModel { + TODO() + } +} \ No newline at end of file diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModels.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModels.kt index d2553bf9b..e18141529 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModels.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModels.kt @@ -11,12 +11,9 @@ import org.jetbrains.kotlinx.dl.api.core.Sequential import org.jetbrains.kotlinx.dl.api.core.loss.Losses import org.jetbrains.kotlinx.dl.api.core.metric.Metrics import org.jetbrains.kotlinx.dl.api.core.optimizer.Adam -import org.jetbrains.kotlinx.dl.api.inference.InferenceModel import org.jetbrains.kotlinx.dl.api.inference.imagerecognition.ImageRecognitionModel import org.jetbrains.kotlinx.dl.api.inference.keras.loadWeights import org.jetbrains.kotlinx.dl.dataset.image.ColorMode -import org.jetbrains.kotlinx.dl.dataset.preprocessor.Preprocessing -import java.io.File /** * Supported models for inference and transfer learning, trained on ImageNet dataset. @@ -557,60 +554,4 @@ public object TFModels { return ImageRecognitionModel(model, modelType) } -} - -/** - * Basic interface for models loaded from S3. - * @param T the type of the basic model for common functionality. - * @param U the type of the pre-trained model for usage in Easy API. - */ -public interface ModelType { - /** Relative path to model for local and S3 buckets storages. */ - public val modelRelativePath: String - - /** - * If true it means that the second dimension is related to number of channels in image has short notation as `NCWH`, - * otherwise, channels are at the last position and has a short notation as `NHWC`. - */ - public val channelsFirst: Boolean - - /** - * An expected channels order for the input image. - * Note: the wrong choice of this parameter can significantly impact the model's performance. - */ - public val inputColorMode: ColorMode - - /** - * Common preprocessing function for the Neural Networks trained on ImageNet and whose weights are available with the keras.application. - * - * It takes [data] as input with shape [tensorShape] and applied the specific preprocessing according chosen modelType. - * - * @param [tensorShape] Should be 3 dimensional array (HWC or CHW format) - */ - public fun preprocessInput(data: FloatArray, tensorShape: LongArray): FloatArray - - /** - * Common preprocessing function for the Neural Networks trained on ImageNet and whose weights are available with the keras.application. - * - * It takes preprocessing pipeline, invoke it and applied the specific preprocessing to the given data. - */ - public fun preprocessInput(imageFile: File, preprocessing: Preprocessing): FloatArray { - val (data, shape) = preprocessing(imageFile) - return preprocessInput( - data, - longArrayOf(shape.width!!, shape.height!!, shape.channels!!) - ) - } - - /** Returns the specially prepared pre-trained model of the type U. */ - public fun pretrainedModel(modelHub: ModelHub): U - - /** Loads the model, identified by this name, from the [modelHub]. */ - public fun model(modelHub: ModelHub): T { - return modelHub.loadModel(this) - } - - public fun preInit(): InferenceModel { - TODO() - } -} +} \ No newline at end of file From b2e3c13312e4869ab1a5889cbdd1191c95971c29 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Mon, 1 Aug 2022 17:18:13 +0200 Subject: [PATCH 03/10] Move Metric implementations and conversion functions to the Metric.kt source file --- .../dl/api/core/GraphTrainableModel.kt | 8 +- .../kotlinx/dl/api/core/metric/Metric.kt | 148 +++++++++++++++++ .../kotlinx/dl/api/core/metric/Metrics.kt | 154 +----------------- 3 files changed, 153 insertions(+), 157 deletions(-) diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/GraphTrainableModel.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/GraphTrainableModel.kt index 38ba59106..8258f9657 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/GraphTrainableModel.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/GraphTrainableModel.kt @@ -142,7 +142,7 @@ public abstract class GraphTrainableModel(vararg layers: Layer) : TrainableModel } override fun compile(optimizer: Optimizer, loss: Losses, metric: Metrics) { - compile(optimizer, Losses.convert(loss), Metrics.convert(metric)) + compile(optimizer, Losses.convert(loss), Metric.convert(metric)) } override fun compile(optimizer: Optimizer, loss: LossFunction, metric: Metric) { @@ -208,7 +208,7 @@ public abstract class GraphTrainableModel(vararg layers: Layer) : TrainableModel } override fun compile(optimizer: Optimizer, loss: LossFunction, metric: Metrics) { - compile(optimizer, loss, Metrics.convert(metric)) + compile(optimizer, loss, Metric.convert(metric)) } /** Common method for building model static graph layer by layer via calling build() method on each layer in correct order. */ @@ -405,7 +405,7 @@ public abstract class GraphTrainableModel(vararg layers: Layer) : TrainableModel if (validationIsEnabled) { val evaluationResult = evaluate(validationDataset!!, validationBatchSize!!, listOf()) - val validationMetricValues = metrics.map { evaluationResult.metrics[Metrics.convertBack(it)] }.toList() + val validationMetricValues = metrics.map { evaluationResult.metrics[Metric.convertBack(it)] }.toList() // TODO: probably I should it by name, not by type val validationLossValue = evaluationResult.lossValue epochTrainingEvent.valLossValue = validationLossValue @@ -553,7 +553,7 @@ public abstract class GraphTrainableModel(vararg layers: Layer) : TrainableModel callbacks.forEach { it.onTestEnd(evaluationHistory) } val metricValues = mutableMapOf() // TODO: Metrics -> Metric class metrics.forEachIndexed { index, metric -> - metricValues[Metrics.convertBack(metric)] = avgMetricValue[index].toDouble() + metricValues[Metric.convertBack(metric)] = avgMetricValue[index].toDouble() } return EvaluationResult(avgLossValue, metricValues) diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/Metric.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/Metric.kt index b878b57bc..9ebaf920b 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/Metric.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/Metric.kt @@ -5,9 +5,15 @@ package org.jetbrains.kotlinx.dl.api.core.metric +import org.jetbrains.kotlinx.dl.api.core.loss.Losses import org.jetbrains.kotlinx.dl.api.core.loss.ReductionType +import org.jetbrains.kotlinx.dl.api.core.loss.allAxes +import org.jetbrains.kotlinx.dl.api.core.loss.safeMean +import org.jetbrains.kotlinx.dl.api.core.util.getDType import org.tensorflow.Operand import org.tensorflow.op.Ops +import org.tensorflow.op.core.ReduceSum +import org.tensorflow.op.math.Mean /** * Basic interface for all metric functions. @@ -29,4 +35,146 @@ public abstract class Metric( yTrue: Operand, numberOfLabels: Operand? ): Operand + + public companion object { + /** Converts enum value to subclass of [Metric]. */ + public fun convert(metricType: Metrics): Metric { + return when (metricType) { + Metrics.ACCURACY -> Accuracy() + Metrics.MAE -> MAE() + Metrics.MSE -> MSE() + Metrics.MSLE -> MSLE() + } + } + + /** Converts subclass of [Metric] to enum value. */ + public fun convertBack(metric: Metric): Metrics { + return when (metric) { + is Accuracy -> Metrics.ACCURACY + is org.jetbrains.kotlinx.dl.api.core.metric.MAE -> Metrics.MAE + is org.jetbrains.kotlinx.dl.api.core.metric.MSE -> Metrics.MSE + is org.jetbrains.kotlinx.dl.api.core.metric.MSLE -> Metrics.MSLE + else -> Metrics.ACCURACY + } + } + } +} + +/** + * @see [Metrics.ACCURACY] + */ +public class Accuracy : Metric(reductionType = ReductionType.SUM_OVER_BATCH_SIZE) { + override fun apply( + tf: Ops, + yPred: Operand, + yTrue: Operand, + numberOfLabels: Operand? + ): Operand { + val predicted: Operand = tf.math.argMax(yPred, tf.constant(1)) + val expected: Operand = tf.math.argMax(yTrue, tf.constant(1)) + + return tf.math.mean(tf.dtypes.cast(tf.math.equal(predicted, expected), getDType()), tf.constant(0)) + } +} + +/** + * @see [Losses.MSE] + */ +public class MSE(reductionType: ReductionType = ReductionType.SUM_OVER_BATCH_SIZE) : Metric(reductionType) { + override fun apply( + tf: Ops, + yPred: Operand, + yTrue: Operand, + numberOfLabels: Operand? + ): Operand { + val squaredError = tf.math.squaredDifference(yPred, yTrue) + return meanOfMetrics(tf, reductionType, squaredError, numberOfLabels, "Metric_MSE") + } +} + +/** + * @see [Losses.MAE] + */ +public class MAE(reductionType: ReductionType = ReductionType.SUM_OVER_BATCH_SIZE) : Metric(reductionType) { + override fun apply( + tf: Ops, + yPred: Operand, + yTrue: Operand, + numberOfLabels: Operand? + ): Operand { + val absoluteErrors = tf.math.abs(tf.math.sub(yPred, yTrue)) + return meanOfMetrics(tf, reductionType, absoluteErrors, numberOfLabels, "Metric_MAE") + } +} + +/** + * @see [Losses.MAPE] + */ +public class MAPE(reductionType: ReductionType = ReductionType.SUM_OVER_BATCH_SIZE) : Metric(reductionType) { + override fun apply( + tf: Ops, + yPred: Operand, + yTrue: Operand, + numberOfLabels: Operand? + ): Operand { + val epsilon = 1e-7f + + val diff = tf.math.abs( + tf.math.div( + tf.math.sub(yTrue, yPred), + tf.math.maximum(tf.math.abs(yTrue), tf.constant(epsilon)) + ) + ) + + return meanOfMetrics(tf, reductionType, tf.math.mul(diff, tf.constant(100f)), numberOfLabels, "Metric_MAPE") + } +} + +/** + * @see [Losses.MSLE] + */ +public class MSLE(reductionType: ReductionType = ReductionType.SUM_OVER_BATCH_SIZE) : Metric(reductionType) { + override fun apply( + tf: Ops, + yPred: Operand, + yTrue: Operand, + numberOfLabels: Operand? + ): Operand { + val epsilon = 1e-5f + + val firstLog = tf.math.log(tf.math.add(tf.math.maximum(yPred, tf.constant(epsilon)), tf.constant(1.0f))) + val secondLog = tf.math.log(tf.math.add(tf.math.maximum(yTrue, tf.constant(epsilon)), tf.constant(1.0f))) + + val loss = tf.math.squaredDifference(firstLog, secondLog) + + return meanOfMetrics(tf, reductionType, loss, numberOfLabels, "Metric_MSLE") + } +} + +internal fun meanOfMetrics( + tf: Ops, + reductionType: ReductionType, + metric: Operand, + numberOfLabels: Operand?, + metricName: String +): Operand { + val meanMetric = tf.math.mean(metric, tf.constant(-1), Mean.keepDims(false)) + + var totalMetric: Operand = tf.reduceSum( + meanMetric, + allAxes(tf, meanMetric), + ReduceSum.keepDims(false) + ) + + if (reductionType == ReductionType.SUM_OVER_BATCH_SIZE) { + check(numberOfLabels != null) { "Operand numberOfLosses must be not null." } + + totalMetric = safeMean( + tf, + metric, + numberOfLabels + ) + } + + return tf.withName(metricName).identity(totalMetric) } diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/Metrics.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/Metrics.kt index 355f8edbe..3e44607c9 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/Metrics.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/Metrics.kt @@ -5,16 +5,6 @@ package org.jetbrains.kotlinx.dl.api.core.metric -import org.jetbrains.kotlinx.dl.api.core.loss.Losses -import org.jetbrains.kotlinx.dl.api.core.loss.ReductionType -import org.jetbrains.kotlinx.dl.api.core.loss.allAxes -import org.jetbrains.kotlinx.dl.api.core.loss.safeMean -import org.jetbrains.kotlinx.dl.api.core.util.getDType -import org.tensorflow.Operand -import org.tensorflow.op.Ops -import org.tensorflow.op.core.ReduceSum -import org.tensorflow.op.math.Mean - /** * Metrics. */ @@ -46,146 +36,4 @@ public enum class Metrics { * `loss = square(log(y_true + 1.) - log(y_pred + 1.))` */ MSLE; - - public companion object { - /** Converts enum value to subclass of [Metric]. */ - public fun convert(metricType: Metrics): Metric { - return when (metricType) { - ACCURACY -> Accuracy() - MAE -> MAE() - MSE -> MSE() - MSLE -> MSLE() - } - } - - /** Converts subclass of [Metric] to enum value. */ - public fun convertBack(metric: Metric): Metrics { - return when (metric) { - is Accuracy -> ACCURACY - is org.jetbrains.kotlinx.dl.api.core.metric.MAE -> MAE - is org.jetbrains.kotlinx.dl.api.core.metric.MSE -> MSE - is org.jetbrains.kotlinx.dl.api.core.metric.MSLE -> MSLE - else -> ACCURACY - } - } - } -} - -/** - * @see [Metrics.ACCURACY] - */ -public class Accuracy : Metric(reductionType = ReductionType.SUM_OVER_BATCH_SIZE) { - override fun apply( - tf: Ops, - yPred: Operand, - yTrue: Operand, - numberOfLabels: Operand? - ): Operand { - val predicted: Operand = tf.math.argMax(yPred, tf.constant(1)) - val expected: Operand = tf.math.argMax(yTrue, tf.constant(1)) - - return tf.math.mean(tf.dtypes.cast(tf.math.equal(predicted, expected), getDType()), tf.constant(0)) - } -} - -/** - * @see [Losses.MSE] - */ -public class MSE(reductionType: ReductionType = ReductionType.SUM_OVER_BATCH_SIZE) : Metric(reductionType) { - override fun apply( - tf: Ops, - yPred: Operand, - yTrue: Operand, - numberOfLabels: Operand? - ): Operand { - val squaredError = tf.math.squaredDifference(yPred, yTrue) - return meanOfMetrics(tf, reductionType, squaredError, numberOfLabels, "Metric_MSE") - } -} - -/** - * @see [Losses.MAE] - */ -public class MAE(reductionType: ReductionType = ReductionType.SUM_OVER_BATCH_SIZE) : Metric(reductionType) { - override fun apply( - tf: Ops, - yPred: Operand, - yTrue: Operand, - numberOfLabels: Operand? - ): Operand { - val absoluteErrors = tf.math.abs(tf.math.sub(yPred, yTrue)) - return meanOfMetrics(tf, reductionType, absoluteErrors, numberOfLabels, "Metric_MAE") - } -} - -/** - * @see [Losses.MAPE] - */ -public class MAPE(reductionType: ReductionType = ReductionType.SUM_OVER_BATCH_SIZE) : Metric(reductionType) { - override fun apply( - tf: Ops, - yPred: Operand, - yTrue: Operand, - numberOfLabels: Operand? - ): Operand { - val epsilon = 1e-7f - - val diff = tf.math.abs( - tf.math.div( - tf.math.sub(yTrue, yPred), - tf.math.maximum(tf.math.abs(yTrue), tf.constant(epsilon)) - ) - ) - - return meanOfMetrics(tf, reductionType, tf.math.mul(diff, tf.constant(100f)), numberOfLabels, "Metric_MAPE") - } -} - -/** - * @see [Losses.MSLE] - */ -public class MSLE(reductionType: ReductionType = ReductionType.SUM_OVER_BATCH_SIZE) : Metric(reductionType) { - override fun apply( - tf: Ops, - yPred: Operand, - yTrue: Operand, - numberOfLabels: Operand? - ): Operand { - val epsilon = 1e-5f - - val firstLog = tf.math.log(tf.math.add(tf.math.maximum(yPred, tf.constant(epsilon)), tf.constant(1.0f))) - val secondLog = tf.math.log(tf.math.add(tf.math.maximum(yTrue, tf.constant(epsilon)), tf.constant(1.0f))) - - val loss = tf.math.squaredDifference(firstLog, secondLog) - - return meanOfMetrics(tf, reductionType, loss, numberOfLabels, "Metric_MSLE") - } -} - -internal fun meanOfMetrics( - tf: Ops, - reductionType: ReductionType, - metric: Operand, - numberOfLabels: Operand?, - metricName: String -): Operand { - val meanMetric = tf.math.mean(metric, tf.constant(-1), Mean.keepDims(false)) - - var totalMetric: Operand = tf.reduceSum( - meanMetric, - allAxes(tf, meanMetric), - ReduceSum.keepDims(false) - ) - - if (reductionType == ReductionType.SUM_OVER_BATCH_SIZE) { - check(numberOfLabels != null) { "Operand numberOfLosses must be not null." } - - totalMetric = safeMean( - tf, - metric, - numberOfLabels - ) - } - - return tf.withName(metricName).identity(totalMetric) -} +} \ No newline at end of file From 8cfa0869b7b2b30b94bf5a1efd5fc0052b6b3290 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Mon, 1 Aug 2022 18:12:54 +0200 Subject: [PATCH 04/10] Remove unnecessary conversions from Shape to TensorShape --- .../kotlinx/dl/api/core/layer/reshaping/Flatten.kt | 5 ++--- .../kotlinx/dl/api/core/shape/ShapeFunctions.kt | 10 +++------- .../dl/api/inference/TensorFlowInferenceModel.kt | 7 ++++--- .../kotlinx/dl/api/core/loss/BinaryCrossEntropyTest.kt | 6 +++--- .../jetbrains/kotlinx/dl/api/core/loss/HingeTest.kt | 10 +++++----- .../jetbrains/kotlinx/dl/api/core/loss/HuberTest.kt | 10 +++++----- .../jetbrains/kotlinx/dl/api/core/loss/LogCoshTest.kt | 10 +++++----- .../org/jetbrains/kotlinx/dl/api/core/loss/MAETest.kt | 10 +++++----- .../org/jetbrains/kotlinx/dl/api/core/loss/MAPETest.kt | 10 +++++----- .../org/jetbrains/kotlinx/dl/api/core/loss/MSETest.kt | 10 +++++----- .../org/jetbrains/kotlinx/dl/api/core/loss/MSLETest.kt | 10 +++++----- .../jetbrains/kotlinx/dl/api/core/loss/PoissonTest.kt | 10 +++++----- .../kotlinx/dl/api/core/loss/SquaredHingeTest.kt | 10 +++++----- .../kotlinx/dl/api/core/metric/AccuracyTest.kt | 10 +++++----- 14 files changed, 62 insertions(+), 66 deletions(-) diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Flatten.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Flatten.kt index 7b3dfc2c7..c59ffa421 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Flatten.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Flatten.kt @@ -6,7 +6,7 @@ package org.jetbrains.kotlinx.dl.api.core.layer.reshaping import org.jetbrains.kotlinx.dl.api.core.layer.Layer -import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.numElements import org.tensorflow.Operand import org.tensorflow.op.Ops import kotlin.math.abs @@ -24,8 +24,7 @@ public class Flatten(name: String = "") : Layer(name) { numberOfLosses: Operand? ): Operand { val inputShape = input.asOutput().shape() - val tensorShape = TensorShape(inputShape) - val amountOfNeuronsInFlattenLayer = (tensorShape.numElements() / abs(tensorShape.size(0))).toInt() + val amountOfNeuronsInFlattenLayer = (inputShape.numElements() / abs(inputShape.size(0))).toInt() val units = tf.constant(intArrayOf(-1, amountOfNeuronsInFlattenLayer)) return tf.reshape(input, units) } diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt index 89231f6df..5573c5c77 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt @@ -44,13 +44,9 @@ internal fun Shape.toLongArray(): LongArray { return shapeArray } -/** Extracts dimensions as [String] from [shape]. */ -internal fun shapeArrayToString(shape: Shape): String { - val shapeArray = IntArray(shape.numDimensions()) - for (i in shapeArray.indices) { - shapeArray[i] = shape.size(i).toInt() - } - return shapeArray.contentToString() +/** Extracts dimensions as a [String] from [Shape]. */ +internal fun Shape.contentToString(): String { + return toLongArray().contentToString() } /** Returns first dimension from all dimensions [dims]. */ diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/TensorFlowInferenceModel.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/TensorFlowInferenceModel.kt index 8704f94df..93aba16f7 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/TensorFlowInferenceModel.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/TensorFlowInferenceModel.kt @@ -8,6 +8,8 @@ package org.jetbrains.kotlinx.dl.api.inference import mu.KotlinLogging import org.jetbrains.kotlinx.dl.api.core.KGraph import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.contentToString +import org.jetbrains.kotlinx.dl.api.core.shape.numElements import org.jetbrains.kotlinx.dl.api.core.util.* import org.jetbrains.kotlinx.dl.api.extension.convertTensorToMultiDimArray import org.jetbrains.kotlinx.dl.api.inference.savedmodel.Input @@ -257,10 +259,9 @@ public open class TensorFlowInferenceModel : InferenceModel() { populateVariable(assignOpName, initializerName, data) - val tensorShape = TensorShape(variableShape) logger.debug { "Loading the variable $variableName data" } - logger.debug { "Variable dimensions are: ${tensorShape.dims().contentToString()}" } - logger.debug { "Number of elements: ${tensorShape.numElements()}" } + logger.debug { "Variable dimensions are: ${variableShape.contentToString()}" } + logger.debug { "Number of elements: ${variableShape.numElements()}" } } private fun populateVariable(assignOpName: String, initializerName: String, data: Any) { diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/BinaryCrossEntropyTest.kt b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/BinaryCrossEntropyTest.kt index e4e24a26d..cbd6fde83 100644 --- a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/BinaryCrossEntropyTest.kt +++ b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/BinaryCrossEntropyTest.kt @@ -1,11 +1,11 @@ /* - * Copyright 2020 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. + * Copyright 2020-2022 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. */ package org.jetbrains.kotlinx.dl.api.core.loss -import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.numElements import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.tensorflow.EagerSession @@ -25,7 +25,7 @@ internal class BinaryCrossEntropyTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 2))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 2))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(4f, numberOfLosses.asOutput().tensor().floatValue()) diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/HingeTest.kt b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/HingeTest.kt index fbf422888..94827b490 100644 --- a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/HingeTest.kt +++ b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/HingeTest.kt @@ -1,11 +1,11 @@ /* - * Copyright 2020 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. + * Copyright 2020-2022 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. */ package org.jetbrains.kotlinx.dl.api.core.loss -import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.numElements import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.tensorflow.EagerSession @@ -23,7 +23,7 @@ internal class HingeTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yTrue.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yTrue.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -49,7 +49,7 @@ internal class HingeTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -75,7 +75,7 @@ internal class HingeTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 4))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 4))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(8f, numberOfLosses.asOutput().tensor().floatValue()) diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/HuberTest.kt b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/HuberTest.kt index 59316fb76..d73dd6e89 100644 --- a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/HuberTest.kt +++ b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/HuberTest.kt @@ -1,11 +1,11 @@ /* - * Copyright 2020 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. + * Copyright 2020-2022 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. */ package org.jetbrains.kotlinx.dl.api.core.loss -import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.numElements import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.tensorflow.EagerSession @@ -23,7 +23,7 @@ internal class HuberTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yTrue.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yTrue.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -49,7 +49,7 @@ internal class HuberTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -75,7 +75,7 @@ internal class HuberTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/LogCoshTest.kt b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/LogCoshTest.kt index 8f43c1df2..42b5d6a19 100644 --- a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/LogCoshTest.kt +++ b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/LogCoshTest.kt @@ -1,11 +1,11 @@ /* - * Copyright 2020 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. + * Copyright 2020-2022 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. */ package org.jetbrains.kotlinx.dl.api.core.loss -import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.numElements import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.tensorflow.EagerSession @@ -23,7 +23,7 @@ internal class LogCoshTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yTrue.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yTrue.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -49,7 +49,7 @@ internal class LogCoshTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -75,7 +75,7 @@ internal class LogCoshTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MAETest.kt b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MAETest.kt index fe09a678c..b7476d1c4 100644 --- a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MAETest.kt +++ b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MAETest.kt @@ -1,11 +1,11 @@ /* - * Copyright 2020 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. + * Copyright 2020-2022 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. */ package org.jetbrains.kotlinx.dl.api.core.loss -import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.numElements import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.tensorflow.EagerSession @@ -23,7 +23,7 @@ internal class MAETest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yTrue.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yTrue.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -49,7 +49,7 @@ internal class MAETest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -75,7 +75,7 @@ internal class MAETest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MAPETest.kt b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MAPETest.kt index 6218d14f8..f8756e5fe 100644 --- a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MAPETest.kt +++ b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MAPETest.kt @@ -1,11 +1,11 @@ /* - * Copyright 2020 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. + * Copyright 2020-2022 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. */ package org.jetbrains.kotlinx.dl.api.core.loss -import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.numElements import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.tensorflow.EagerSession @@ -23,7 +23,7 @@ internal class MAPETest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yTrue.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yTrue.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -49,7 +49,7 @@ internal class MAPETest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -75,7 +75,7 @@ internal class MAPETest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MSETest.kt b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MSETest.kt index 9c572b7d4..f177198ed 100644 --- a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MSETest.kt +++ b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MSETest.kt @@ -1,11 +1,11 @@ /* - * Copyright 2020 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. + * Copyright 2020-2022 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. */ package org.jetbrains.kotlinx.dl.api.core.loss -import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.numElements import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.tensorflow.EagerSession @@ -23,7 +23,7 @@ internal class MSETest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yTrue.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yTrue.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -49,7 +49,7 @@ internal class MSETest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -75,7 +75,7 @@ internal class MSETest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MSLETest.kt b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MSLETest.kt index f28eeacad..7f0cc45e0 100644 --- a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MSLETest.kt +++ b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MSLETest.kt @@ -1,11 +1,11 @@ /* - * Copyright 2020 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. + * Copyright 2020-2022 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. */ package org.jetbrains.kotlinx.dl.api.core.loss -import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.numElements import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.tensorflow.EagerSession @@ -23,7 +23,7 @@ internal class MSLETest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yTrue.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yTrue.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -49,7 +49,7 @@ internal class MSLETest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -75,7 +75,7 @@ internal class MSLETest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/PoissonTest.kt b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/PoissonTest.kt index 90068a4ae..41521bc77 100644 --- a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/PoissonTest.kt +++ b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/PoissonTest.kt @@ -1,11 +1,11 @@ /* - * Copyright 2020 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. + * Copyright 2020-2022 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. */ package org.jetbrains.kotlinx.dl.api.core.loss -import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.numElements import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.tensorflow.EagerSession @@ -25,7 +25,7 @@ internal class PoissonTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yTrue.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yTrue.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -51,7 +51,7 @@ internal class PoissonTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -77,7 +77,7 @@ internal class PoissonTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/SquaredHingeTest.kt b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/SquaredHingeTest.kt index e2308a327..67aa2dd24 100644 --- a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/SquaredHingeTest.kt +++ b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/SquaredHingeTest.kt @@ -1,11 +1,11 @@ /* - * Copyright 2020 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. + * Copyright 2020-2022 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. */ package org.jetbrains.kotlinx.dl.api.core.loss -import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.numElements import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.tensorflow.EagerSession @@ -23,7 +23,7 @@ internal class SquaredHingeTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yTrue.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yTrue.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -49,7 +49,7 @@ internal class SquaredHingeTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -75,7 +75,7 @@ internal class SquaredHingeTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 4))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 4))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(8f, numberOfLosses.asOutput().tensor().floatValue()) diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/AccuracyTest.kt b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/AccuracyTest.kt index fdef80ad5..a01ee9232 100644 --- a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/AccuracyTest.kt +++ b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/AccuracyTest.kt @@ -1,11 +1,11 @@ /* - * Copyright 2020 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. + * Copyright 2020-2022 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. */ package org.jetbrains.kotlinx.dl.api.core.metric -import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.numElements import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.tensorflow.EagerSession @@ -23,7 +23,7 @@ internal class AccuracyTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yTrue.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yTrue.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -49,7 +49,7 @@ internal class AccuracyTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) @@ -74,7 +74,7 @@ internal class AccuracyTest { val yTrue: Operand = tf.reshape(tf.constant(yTrueArray), tf.constant(intArrayOf(2, 3))) val yPred: Operand = tf.reshape(tf.constant(yPredArray), tf.constant(intArrayOf(2, 3))) - val numberOfLosses = tf.constant(TensorShape(yPred.asOutput().shape()).numElements().toFloat()) + val numberOfLosses = tf.constant(yPred.asOutput().shape().numElements().toFloat()) assertEquals(6f, numberOfLosses.asOutput().tensor().floatValue()) From 5ee8b94f81e999738d81a947b6edf9a87ee89bde Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Mon, 1 Aug 2022 18:18:28 +0200 Subject: [PATCH 05/10] Cleanup ShapeFunctions --- .../dl/api/core/GraphTrainableModel.kt | 2 +- .../dl/api/core/shape/ShapeFunctions.kt | 107 ++++++++---------- ...ng_weights_from_old_keras_weight_format.kt | 2 +- 3 files changed, 50 insertions(+), 61 deletions(-) diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/GraphTrainableModel.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/GraphTrainableModel.kt index 8258f9657..7ba2c9c6a 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/GraphTrainableModel.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/GraphTrainableModel.kt @@ -796,7 +796,7 @@ public abstract class GraphTrainableModel(vararg layers: Layer) : TrainableModel return longArrayOf( batchSize.toLong(), - *tail(xTensorShape) + *xTensorShape.tail() ) } diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt index 5573c5c77..6e84df349 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt @@ -19,29 +19,17 @@ internal fun constArray(tf: Ops, vararg data: Int): Operand { /** Creates shape [Operand] from [Shape]. */ internal fun shapeOperand(tf: Ops, shape: Shape): Operand { - val shapeArray = IntArray(shape.numDimensions()) - for (i in shapeArray.indices) { - shapeArray[i] = shape.size(i).toInt() - } - return tf.constant(shapeArray) + return tf.constant(shape.toIntArray()) } /** Extracts dimensions as [IntArray] from [Shape]. */ internal fun Shape.toIntArray(): IntArray { - val shapeArray = IntArray(numDimensions()) - for (i in shapeArray.indices) { - shapeArray[i] = size(i).toInt() - } - return shapeArray + return IntArray(numDimensions()) { size(it).toInt() } } /** Extracts dimensions as [LongArray] from [Shape]. */ internal fun Shape.toLongArray(): LongArray { - val shapeArray = LongArray(numDimensions()) - for (i in shapeArray.indices) { - shapeArray[i] = size(i) - } - return shapeArray + return LongArray(numDimensions()) { size(it) } } /** Extracts dimensions as a [String] from [Shape]. */ @@ -49,58 +37,26 @@ internal fun Shape.contentToString(): String { return toLongArray().contentToString() } -/** Returns first dimension from all dimensions [dims]. */ -internal fun head(vararg dims: Long): Long { - return dims[0] +/** Returns first dimension */ +public fun Shape.head(): Long { + return size(0) } -/** Returns last dimensions (except first) from [dims]. */ -internal fun tail(vararg dims: Long): LongArray { - return dims.copyOfRange(1, dims.size) +/** Returns last dimensions (except first). */ +public fun Shape.tail(): LongArray { + return LongArray(numDimensions() - 1) { size(it + 1) } } -/** Returns last dimensions (except first) from [shape]. */ -public fun tail(shape: Shape): LongArray { - val shapeArray = LongArray(shape.numDimensions()) - for (i in shapeArray.indices) { - shapeArray[i] = shape.size(i) - } - return tail(*shapeArray) -} +/** Returns amount of elements in [Shape]. */ +internal fun Shape.numElements(): Long = numElementsInShape(toLongArray()) /** Creates [Shape] object from a few [Long] values in [dims]. */ internal fun shapeFromDims(vararg dims: Long): Shape { return Shape.make(head(*dims), *tail(*dims)) } -/** Returns amount of elements in Tensor with [shape]. */ -internal fun numElementsInShape(shape: LongArray): Long { - var prod = 1L - for (i in shape.indices) { - prod *= abs(shape[i]) - } - return prod -} - -/** Returns amount of elements in [Shape]. */ -internal fun Shape.numElements(): Long = numElementsInShape(toLongArray()) - -/** - * Flattens the given array of float values. - * @return flattened array - */ -public fun Array<*>.flattenFloats(): FloatArray { - val result = mutableListOf() - - fun flatten(array: Any?): Unit = when (array) { - is FloatArray -> array.forEach { result.add(it) } - is Array<*> -> array.forEach { flatten(it) } - else -> throw IllegalArgumentException("Cannot flatten object: '$array'") - } - - flatten(this) - - return result.toFloatArray() +internal fun Shape.copy(): Shape { + return Shape.make(head(), *tail()) } /** @@ -137,6 +93,39 @@ private fun getShapeOfArray(data: Array<*>): Shape { */ internal val Array<*>.shape: Shape get() = getShapeOfArray(this) -internal fun Shape.copy(): Shape { - return Shape.make(size(0), *tail(this)) +/** Returns first dimension from all dimensions [dims]. */ +internal fun head(vararg dims: Long): Long { + return dims[0] +} + +/** Returns last dimensions (except first) from [dims]. */ +internal fun tail(vararg dims: Long): LongArray { + return dims.copyOfRange(1, dims.size) +} + +/** Returns amount of elements in Tensor with [shape]. */ +internal fun numElementsInShape(shape: LongArray): Long { + var prod = 1L + for (i in shape.indices) { + prod *= abs(shape[i]) + } + return prod +} + +/** + * Flattens the given array of float values. + * @return flattened array + */ +public fun Array<*>.flattenFloats(): FloatArray { + val result = mutableListOf() + + fun flatten(array: Any?): Unit = when (array) { + is FloatArray -> array.forEach { result.add(it) } + is Array<*> -> array.forEach { flatten(it) } + else -> throw IllegalArgumentException("Cannot flatten object: '$array'") + } + + flatten(this) + + return result.toFloatArray() } \ No newline at end of file diff --git a/examples/src/main/kotlin/examples/transferlearning/modelhub/vgg16/Example_3_VGG16_loading_weights_from_old_keras_weight_format.kt b/examples/src/main/kotlin/examples/transferlearning/modelhub/vgg16/Example_3_VGG16_loading_weights_from_old_keras_weight_format.kt index 4c1185036..10c4e7a5b 100644 --- a/examples/src/main/kotlin/examples/transferlearning/modelhub/vgg16/Example_3_VGG16_loading_weights_from_old_keras_weight_format.kt +++ b/examples/src/main/kotlin/examples/transferlearning/modelhub/vgg16/Example_3_VGG16_loading_weights_from_old_keras_weight_format.kt @@ -172,7 +172,7 @@ fun main() { val xTensorShape = it.inputLayer.input.asOutput().shape() val tensorShape = longArrayOf( 1, - *tail(xTensorShape) + *xTensorShape.tail() ) val inputData = preprocessInput(floatArray, tensorShape, inputType = InputType.CAFFE) From c2d4bec2fd79e14f7871732f8b87714850ceaac9 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Mon, 1 Aug 2022 18:24:54 +0200 Subject: [PATCH 06/10] Remove dependency from TensorShape on Shape --- .../kotlinx/dl/api/core/layer/Layer.kt | 9 ++++---- .../layer/convolutional/Conv1DTranspose.kt | 4 ++-- .../layer/convolutional/Conv2DTranspose.kt | 4 ++-- .../layer/convolutional/Conv3DTranspose.kt | 4 ++-- .../dl/api/core/layer/merge/AbstractMerge.kt | 6 ++--- .../dl/api/core/layer/merge/Concatenate.kt | 6 ++--- .../dl/api/core/shape/ShapeFunctions.kt | 11 +++++++++ .../kotlinx/dl/api/core/shape/TensorShape.kt | 23 ++----------------- 8 files changed, 30 insertions(+), 37 deletions(-) diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Layer.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Layer.kt index f45e564a5..e63f02e32 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Layer.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Layer.kt @@ -7,6 +7,8 @@ package org.jetbrains.kotlinx.dl.api.core.layer import org.jetbrains.kotlinx.dl.api.core.GraphTrainableModel import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.tail +import org.jetbrains.kotlinx.dl.api.core.shape.toTensorShape import org.tensorflow.Operand import org.tensorflow.Shape import org.tensorflow.op.Ops @@ -99,11 +101,10 @@ internal fun LongArray.toIntArray(): IntArray { } internal fun Layer.setOutputShape(shape: Shape) { - val tensorShape = TensorShape(shape) - check(tensorShape.tail().all { elem -> elem > 0 }) + check(shape.tail().all { elem -> elem > 0 }) { - "The last dimensions (except first = -1) of shape of layer $name contains zero or negative dimension values: ${tensorShape}.\n" + + "The last dimensions (except first = -1) of shape of layer $name contains zero or negative dimension values: ${shape}.\n" + "Analyze your model architecture and layer output shapes carefully to discover a problem." } - outputShape = tensorShape + outputShape = shape.toTensorShape() } \ No newline at end of file diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv1DTranspose.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv1DTranspose.kt index ab695cbaa..8d93ae913 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv1DTranspose.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv1DTranspose.kt @@ -18,7 +18,7 @@ import org.jetbrains.kotlinx.dl.api.core.layer.convolutional.Conv1D.Companion.wi import org.jetbrains.kotlinx.dl.api.core.layer.requireArraySize import org.jetbrains.kotlinx.dl.api.core.layer.toLongList import org.jetbrains.kotlinx.dl.api.core.regularizer.Regularizer -import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.toTensorShape import org.tensorflow.Operand import org.tensorflow.op.Ops @@ -82,7 +82,7 @@ public class Conv1DTranspose( override val kernelSize: IntArray = intArrayOf(kernelLength) override fun convImplementation(tf: Ops, input: Operand): Operand { - val outputShape = TensorShape(computeOutputShape(input.asOutput().shape())) + val outputShape = computeOutputShape(input.asOutput().shape()).toTensorShape() // implementation of a 1D convolution with a 2D convolution return tf.withExpandedDimensions(input) { expandedInput -> // expand 1D convolution parameters to use them with a 2D convolution operation diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv2DTranspose.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv2DTranspose.kt index cb855bc65..ff06f865f 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv2DTranspose.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv2DTranspose.kt @@ -13,7 +13,7 @@ import org.jetbrains.kotlinx.dl.api.core.layer.NoGradients import org.jetbrains.kotlinx.dl.api.core.layer.requireArraySize import org.jetbrains.kotlinx.dl.api.core.layer.toLongList import org.jetbrains.kotlinx.dl.api.core.regularizer.Regularizer -import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.toTensorShape import org.tensorflow.Operand import org.tensorflow.op.Ops @@ -108,7 +108,7 @@ public class Conv2DTranspose( } override fun convImplementation(tf: Ops, input: Operand): Operand { - val outputShape = TensorShape(computeOutputShape(input.asOutput().shape())) + val outputShape = computeOutputShape(input.asOutput().shape()).toTensorShape() return tf.nn.conv2dBackpropInput( tf.shapeWithDynamicBatchSize(outputShape, input), kernel.variable, diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv3DTranspose.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv3DTranspose.kt index 4ae87235e..47773c22d 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv3DTranspose.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv3DTranspose.kt @@ -13,7 +13,7 @@ import org.jetbrains.kotlinx.dl.api.core.layer.NoGradients import org.jetbrains.kotlinx.dl.api.core.layer.requireArraySize import org.jetbrains.kotlinx.dl.api.core.layer.toLongList import org.jetbrains.kotlinx.dl.api.core.regularizer.Regularizer -import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.toTensorShape import org.tensorflow.Operand import org.tensorflow.op.Ops import org.tensorflow.op.nn.Conv3dBackpropInput @@ -107,7 +107,7 @@ public class Conv3DTranspose( override val outputPadding: IntArray? get() = null override fun convImplementation(tf: Ops, input: Operand): Operand { - val outputShape = TensorShape(computeOutputShape(input.asOutput().shape())) + val outputShape = computeOutputShape(input.asOutput().shape()).toTensorShape() val options = Conv3dBackpropInput.dilations(dilations.toLongList()).dataFormat("NDHWC") return tf.nn.conv3dBackpropInput( tf.shapeWithDynamicBatchSize(outputShape, input), diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/AbstractMerge.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/AbstractMerge.kt index f53587edf..753d22b06 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/AbstractMerge.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/AbstractMerge.kt @@ -6,7 +6,7 @@ package org.jetbrains.kotlinx.dl.api.core.layer.merge import org.jetbrains.kotlinx.dl.api.core.layer.Layer -import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.toTensorShape import org.tensorflow.Operand import org.tensorflow.Shape import org.tensorflow.op.Ops @@ -45,9 +45,9 @@ public abstract class AbstractMerge(public val layerTypeName: String, name: Stri /** Checks shapes of input operands. */ protected open fun checkInputShapes(inputShapes: List) { require(inputShapes.size > 1) { "The number of input layers should be more than 1." } - val firstInputShape = TensorShape(inputShapes.first()) + val firstInputShape = inputShapes.first().toTensorShape() for ((index, inputShape) in inputShapes.withIndex()) { - val currentInputShape = TensorShape(inputShape) + val currentInputShape = inputShape.toTensorShape() require(firstInputShape == currentInputShape) { "The shape of first input $firstInputShape should be equal to the shape $currentInputShape at input index $index." } diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Concatenate.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Concatenate.kt index b8638d73f..4bb952cb9 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Concatenate.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Concatenate.kt @@ -6,7 +6,7 @@ package org.jetbrains.kotlinx.dl.api.core.layer.merge import org.jetbrains.kotlinx.dl.api.core.layer.NoGradients -import org.jetbrains.kotlinx.dl.api.core.shape.TensorShape +import org.jetbrains.kotlinx.dl.api.core.shape.toTensorShape import org.tensorflow.Operand import org.tensorflow.Shape import org.tensorflow.op.Ops @@ -25,9 +25,9 @@ public class Concatenate( ) : AbstractMerge("ConcatenateLayer", name), NoGradients { override fun checkInputShapes(inputShapes: List) { require(inputShapes.size > 1) { "The number of input layers should be more than 1." } - val firstInputShape = TensorShape(inputShapes.first()) + val firstInputShape = inputShapes.first().toTensorShape() for ((index, inputShape) in inputShapes.withIndex()) { - val currentInputShape = TensorShape(inputShape) + val currentInputShape = inputShape.toTensorShape() require(firstInputShape.almostEqual(currentInputShape, except = axis)) { "A Concatenate layer requires inputs with matching shapes except for the concat axis $axis. " + "But shapes are the following: shape of first input is $firstInputShape and shape at index $index is $currentInputShape." diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt index 6e84df349..1a1a9da91 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt @@ -55,6 +55,17 @@ internal fun shapeFromDims(vararg dims: Long): Shape { return Shape.make(head(*dims), *tail(*dims)) } +/** Converts [TensorShape] to [Shape] object. */ +public fun TensorShape.toShape(): Shape { + val d = dims() + return Shape.make(head(*d), *tail(*d)) +} + +/** Converts [Shape] to [TensorShape] object. */ +public fun Shape.toTensorShape(): TensorShape { + return TensorShape(toLongArray()) +} + internal fun Shape.copy(): Shape { return Shape.make(head(), *tail()) } diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/TensorShape.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/TensorShape.kt index 34ade25c3..2025dbb56 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/TensorShape.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/TensorShape.kt @@ -1,16 +1,14 @@ /* - * Copyright 2020 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. + * Copyright 2020-2022 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. */ package org.jetbrains.kotlinx.dl.api.core.shape -import org.tensorflow.Shape import kotlin.math.abs /** - * Helper wrapper of [Shape] class with helper methods. - * + * Representation of the tensor shape class with helper methods. */ public class TensorShape() { private lateinit var dims: LongArray @@ -27,10 +25,6 @@ public class TensorShape() { } } - public constructor(shape: Shape) : this() { - dims = dimsFromShape(shape) - } - /** * Creates a new `TensorShape` with the given dimensions. * @@ -167,14 +161,6 @@ public class TensorShape() { return this } - private fun dimsFromShape(shape: Shape): LongArray { - val dims = LongArray(shape.numDimensions()) - for (i in 0 until shape.numDimensions()) { - dims[i] = shape.size(i) - } - return dims - } - private fun concatenate(first: LongArray, vararg last: Long): LongArray { val dims = LongArray(first.size + last.size) System.arraycopy(first, 0, dims, 0, first.size) @@ -192,11 +178,6 @@ public class TensorShape() { return dims.copyOfRange(1, dims.size) } - /** Converts to [Shape] object. */ - public fun toShape(): Shape { - return Shape.make(head(*dims), *tail(*dims)) - } - override fun toString(): String { return dims.contentToString().replace("-1", "None") } From 35ebbab1a8cd5a5050474a98ed004253bfde4d06 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Mon, 1 Aug 2022 18:37:53 +0200 Subject: [PATCH 07/10] Allow to get array shape as a TensorShape --- .../dl/api/core/shape/ShapeFunctions.kt | 26 ++-------------- .../kotlinx/dl/api/core/shape/TensorShape.kt | 31 +++++++++++++++++++ .../dl/dataset/onHeapDatasetExtensions.kt | 6 ++-- 3 files changed, 36 insertions(+), 27 deletions(-) diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt index 1a1a9da91..fa5b3e1d1 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt @@ -74,33 +74,11 @@ internal fun Shape.copy(): Shape { * Get shape of array of arrays (of arrays...) of Array of elems of any type. * If the most inner array does not have any elements its size is missed in result */ private fun getShapeOfArray(data: Array<*>): Shape { - fun appendPrimitiveArraySize(size: Int, acc: MutableList): LongArray { - acc += size.toLong() - return acc.toLongArray() - } - - tailrec fun collectDims(data: Array<*>, acc: MutableList): LongArray { - val firstElem = data[0] ?: return acc.toLongArray() - acc += data.size.toLong() - return when (firstElem) { - is Array<*> -> collectDims(firstElem, acc) - is BooleanArray -> appendPrimitiveArraySize(firstElem.size, acc) - is ByteArray -> appendPrimitiveArraySize(firstElem.size, acc) - is CharArray -> appendPrimitiveArraySize(firstElem.size, acc) - is ShortArray -> appendPrimitiveArraySize(firstElem.size, acc) - is IntArray -> appendPrimitiveArraySize(firstElem.size, acc) - is LongArray -> appendPrimitiveArraySize(firstElem.size, acc) - is FloatArray -> appendPrimitiveArraySize(firstElem.size, acc) - is DoubleArray -> appendPrimitiveArraySize(firstElem.size, acc) - else -> acc.toLongArray() - } - } - return shapeFromDims(*collectDims(data, mutableListOf())) + return shapeFromDims(*getDimsOfArray(data)) } /** - * Get shape of array of arrays (of arrays...) of Array of elems of any type. - * If the most inner array does not have any elements its size is missed in result + * @see tensorShape */ internal val Array<*>.shape: Shape get() = getShapeOfArray(this) diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/TensorShape.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/TensorShape.kt index 2025dbb56..d132ee03b 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/TensorShape.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/TensorShape.kt @@ -213,3 +213,34 @@ public class TensorShape() { return almostEqual } } + +internal fun getDimsOfArray(data: kotlin.Array<*>): LongArray { + fun appendPrimitiveArraySize(size: Int, acc: MutableList): LongArray { + acc += size.toLong() + return acc.toLongArray() + } + + tailrec fun collectDims(data: Array<*>, acc: MutableList): LongArray { + val firstElem = data[0] ?: return acc.toLongArray() + acc += data.size.toLong() + return when (firstElem) { + is Array<*> -> collectDims(firstElem, acc) + is BooleanArray -> appendPrimitiveArraySize(firstElem.size, acc) + is ByteArray -> appendPrimitiveArraySize(firstElem.size, acc) + is CharArray -> appendPrimitiveArraySize(firstElem.size, acc) + is ShortArray -> appendPrimitiveArraySize(firstElem.size, acc) + is IntArray -> appendPrimitiveArraySize(firstElem.size, acc) + is LongArray -> appendPrimitiveArraySize(firstElem.size, acc) + is FloatArray -> appendPrimitiveArraySize(firstElem.size, acc) + is DoubleArray -> appendPrimitiveArraySize(firstElem.size, acc) + else -> acc.toLongArray() + } + } + return collectDims(data, mutableListOf()) +} + +/** + * Get shape of array of arrays (of arrays...) of Array of elements of any type. + * If the most inner array does not have any elements its size is missed in result + */ +internal val Array<*>.tensorShape: TensorShape get() = TensorShape(getDimsOfArray(this)) \ No newline at end of file diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/dataset/onHeapDatasetExtensions.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/dataset/onHeapDatasetExtensions.kt index 1d49cb063..46a8f6c0b 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/dataset/onHeapDatasetExtensions.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/dataset/onHeapDatasetExtensions.kt @@ -1,11 +1,11 @@ /* - * Copyright 2020 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. + * Copyright 2020-2022 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. */ package org.jetbrains.kotlinx.dl.dataset -import org.jetbrains.kotlinx.dl.api.core.shape.shape +import org.jetbrains.kotlinx.dl.api.core.shape.tensorShape import kotlin.math.roundToInt @@ -23,7 +23,7 @@ public fun OnHeapDataset.fullToString(): String = buildStringRepr(x.contentDeepT * Builds intermediate [OnHeapDataset] string representation. */ public fun OnHeapDataset.buildStringRepr(xString: String, yString: String): String = - "OnHeapDataset(\nx ${x.shape} =\n${xString},\ny [${y.size}] =\n${yString}\n)" + "OnHeapDataset(\nx ${x.tensorShape} =\n${xString},\ny [${y.size}] =\n${yString}\n)" /** From 1fe55f3964fd07de19c7fb037da92058f08fd0dc Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Mon, 1 Aug 2022 18:45:41 +0200 Subject: [PATCH 08/10] Move flattenFloats function to a separate file --- .../dl/api/core/shape/ShapeFunctions.kt | 18 -------------- .../kotlinx/dl/api/core/util/ArrayUtil.kt | 24 +++++++++++++++++++ .../inference/keras/loaders/LoadersUtil.kt | 2 +- .../dl/api/core/layer/ConvLayerTest.kt | 2 +- .../kotlinx/dl/api/core/layer/LayerTest.kt | 2 +- 5 files changed, 27 insertions(+), 21 deletions(-) create mode 100644 api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/ArrayUtil.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt index fa5b3e1d1..8a7293999 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt @@ -99,22 +99,4 @@ internal fun numElementsInShape(shape: LongArray): Long { prod *= abs(shape[i]) } return prod -} - -/** - * Flattens the given array of float values. - * @return flattened array - */ -public fun Array<*>.flattenFloats(): FloatArray { - val result = mutableListOf() - - fun flatten(array: Any?): Unit = when (array) { - is FloatArray -> array.forEach { result.add(it) } - is Array<*> -> array.forEach { flatten(it) } - else -> throw IllegalArgumentException("Cannot flatten object: '$array'") - } - - flatten(this) - - return result.toFloatArray() } \ No newline at end of file diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/ArrayUtil.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/ArrayUtil.kt new file mode 100644 index 000000000..ca30602fd --- /dev/null +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/ArrayUtil.kt @@ -0,0 +1,24 @@ +/* + * Copyright 2022 JetBrains s.r.o. and Kotlin Deep Learning project contributors. All Rights Reserved. + * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. + */ + +package org.jetbrains.kotlinx.dl.api.core.util + +/** + * Flattens the given array of float values. + * @return flattened array + */ +public fun Array<*>.flattenFloats(): FloatArray { + val result = mutableListOf() + + fun flatten(array: Any?): Unit = when (array) { + is FloatArray -> array.forEach { result.add(it) } + is Array<*> -> array.forEach { flatten(it) } + else -> throw IllegalArgumentException("Cannot flatten object: '$array'") + } + + flatten(this) + + return result.toFloatArray() +} \ No newline at end of file diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/LoadersUtil.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/LoadersUtil.kt index 95a207ae5..94eac3f6e 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/LoadersUtil.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/LoadersUtil.kt @@ -8,7 +8,7 @@ package org.jetbrains.kotlinx.dl.api.inference.keras.loaders import com.beust.klaxon.JsonArray import com.beust.klaxon.JsonObject import com.beust.klaxon.Parser -import org.jetbrains.kotlinx.dl.api.core.shape.flattenFloats +import org.jetbrains.kotlinx.dl.api.core.util.flattenFloats import org.jetbrains.kotlinx.dl.api.inference.InferenceModel /** diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ConvLayerTest.kt b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ConvLayerTest.kt index 9bbe562ca..33b044cd3 100644 --- a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ConvLayerTest.kt +++ b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ConvLayerTest.kt @@ -6,9 +6,9 @@ package org.jetbrains.kotlinx.dl.api.core.layer import org.jetbrains.kotlinx.dl.api.core.activation.EPS -import org.jetbrains.kotlinx.dl.api.core.shape.flattenFloats import org.jetbrains.kotlinx.dl.api.core.shape.shape import org.jetbrains.kotlinx.dl.api.core.shape.toLongArray +import org.jetbrains.kotlinx.dl.api.core.util.flattenFloats import org.jetbrains.kotlinx.dl.api.extension.convertTensorToFlattenFloatArray import org.junit.jupiter.api.Assertions.assertArrayEquals import org.tensorflow.Graph diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/LayerTest.kt b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/LayerTest.kt index 6e141e545..6583ae2f4 100644 --- a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/LayerTest.kt +++ b/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/LayerTest.kt @@ -5,9 +5,9 @@ package org.jetbrains.kotlinx.dl.api.core.layer -import org.jetbrains.kotlinx.dl.api.core.shape.flattenFloats import org.jetbrains.kotlinx.dl.api.core.shape.shape import org.jetbrains.kotlinx.dl.api.core.shape.toLongArray +import org.jetbrains.kotlinx.dl.api.core.util.flattenFloats import org.jetbrains.kotlinx.dl.api.extension.convertTensorToFlattenFloatArray import org.junit.jupiter.api.Assertions.assertArrayEquals import org.tensorflow.* From a41a62fb20372530b86e26af5c0939ebaab4ebf4 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Mon, 1 Aug 2022 20:06:44 +0200 Subject: [PATCH 09/10] Use model storage url from the ModelHub property --- .../kotlinx/dl/api/inference/keras/loaders/TFModelHub.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModelHub.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModelHub.kt index 56b7fec66..ee5554377 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModelHub.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModelHub.kt @@ -225,7 +225,7 @@ public class TFModelHub(cacheDirectory: File) : ModelHub(cacheDirectory) { if (noTop) modelDirectory += "/notop" val relativeConfigPath = modelDirectory + MODEL_CONFIG_FILE_NAME - val configURL = AWS_S3_URL + modelDirectory + MODEL_CONFIG_FILE_NAME + val configURL = awsS3Url + modelDirectory + MODEL_CONFIG_FILE_NAME val dir = File(cacheDirectory.absolutePath + modelDirectory) if (!dir.exists()) Files.createDirectories(dir.toPath()) @@ -249,7 +249,7 @@ public class TFModelHub(cacheDirectory: File) : ModelHub(cacheDirectory) { if (noTop) modelDirectory += "/notop" val relativeWeightsPath = modelDirectory + WEIGHTS_FILE_NAME - val weightsURL = AWS_S3_URL + modelDirectory + WEIGHTS_FILE_NAME + val weightsURL = awsS3Url + modelDirectory + WEIGHTS_FILE_NAME val fileName = cacheDirectory.absolutePath + relativeWeightsPath val file = File(fileName) From 24f946249f68f9341cf6da576d3b1c80a8964555 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Wed, 27 Jul 2022 01:01:50 +0200 Subject: [PATCH 10/10] Extract tensorflow module --- api/build.gradle | 10 ------- .../kotlinx/dl/api/core/shape/TensorShape.kt | 9 ++++--- examples/build.gradle | 2 ++ settings.gradle | 5 ++-- tensorflow/build.gradle | 25 ++++++++++++++++++ .../kotlinx/dl/api/core/Functional.kt | 0 .../dl/api/core/GraphTrainableModel.kt | 0 .../jetbrains/kotlinx/dl/api/core/KGraph.kt | 0 .../kotlinx/dl/api/core/SavingFormat.kt | 0 .../kotlinx/dl/api/core/Sequential.kt | 0 .../kotlinx/dl/api/core/TrainableModel.kt | 0 .../kotlinx/dl/api/core/WritingMode.kt | 0 .../dl/api/core/activation/Activation.kt | 0 .../dl/api/core/activation/Activations.kt | 0 .../kotlinx/dl/api/core/callback/Callback.kt | 0 .../dl/api/core/callback/EarlyStopping.kt | 0 .../dl/api/core/callback/TerminateOnNaN.kt | 0 .../dl/api/core/callback/TimeStopping.kt | 0 .../core/dsl/GraphTrainableModelBuilder.kt | 0 .../IdentityDimensionalityException.kt | 0 .../exception/RepeatableLayerNameException.kt | 0 .../kotlinx/dl/api/core/history/History.kt | 0 .../dl/api/core/history/TrainingHistory.kt | 0 .../dl/api/core/initializer/Constant.kt | 0 .../dl/api/core/initializer/Identity.kt | 0 .../dl/api/core/initializer/Initializer.kt | 0 .../kotlinx/dl/api/core/initializer/Ones.kt | 0 .../dl/api/core/initializer/Orthogonal.kt | 0 .../ParametrizedTruncatedNormal.kt | 0 .../dl/api/core/initializer/RandomNormal.kt | 0 .../dl/api/core/initializer/RandomUniform.kt | 0 .../api/core/initializer/TruncatedNormal.kt | 0 .../api/core/initializer/VarianceScaling.kt | 0 .../kotlinx/dl/api/core/initializer/Zeros.kt | 0 .../kotlinx/dl/api/core/layer/KVariable.kt | 0 .../kotlinx/dl/api/core/layer/Layer.kt | 0 .../kotlinx/dl/api/core/layer/NoGradients.kt | 0 .../dl/api/core/layer/ParametrizedLayer.kt | 0 .../dl/api/core/layer/TrainableLayer.kt | 0 .../kotlinx/dl/api/core/layer/Weights.kt | 0 .../activation/AbstractActivationLayer.kt | 0 .../core/layer/activation/ActivationUtils.kt | 0 .../dl/api/core/layer/activation/ELU.kt | 0 .../dl/api/core/layer/activation/LeakyReLU.kt | 0 .../dl/api/core/layer/activation/PReLU.kt | 0 .../dl/api/core/layer/activation/ReLU.kt | 0 .../dl/api/core/layer/activation/Softmax.kt | 0 .../core/layer/activation/ThresholdedReLU.kt | 0 .../core/layer/convolutional/AbstractConv.kt | 0 .../dl/api/core/layer/convolutional/Conv1D.kt | 0 .../layer/convolutional/Conv1DTranspose.kt | 0 .../dl/api/core/layer/convolutional/Conv2D.kt | 0 .../layer/convolutional/Conv2DTranspose.kt | 0 .../dl/api/core/layer/convolutional/Conv3D.kt | 0 .../layer/convolutional/Conv3DTranspose.kt | 0 .../core/layer/convolutional/ConvPadding.kt | 0 .../core/layer/convolutional/ConvTranspose.kt | 0 .../layer/convolutional/DepthwiseConv2D.kt | 0 .../layer/convolutional/SeparableConv2D.kt | 0 .../dl/api/core/layer/core/ActivationLayer.kt | 0 .../kotlinx/dl/api/core/layer/core/Dense.kt | 0 .../kotlinx/dl/api/core/layer/core/Input.kt | 0 .../dl/api/core/layer/merge/AbstractMerge.kt | 0 .../kotlinx/dl/api/core/layer/merge/Add.kt | 0 .../dl/api/core/layer/merge/Average.kt | 0 .../dl/api/core/layer/merge/Concatenate.kt | 0 .../kotlinx/dl/api/core/layer/merge/Dot.kt | 0 .../dl/api/core/layer/merge/Maximum.kt | 0 .../dl/api/core/layer/merge/Minimum.kt | 0 .../dl/api/core/layer/merge/Multiply.kt | 0 .../dl/api/core/layer/merge/Subtract.kt | 0 .../api/core/layer/normalization/BatchNorm.kt | 0 .../dl/api/core/layer/pooling/AvgPool1D.kt | 0 .../dl/api/core/layer/pooling/AvgPool2D.kt | 0 .../dl/api/core/layer/pooling/AvgPool3D.kt | 0 .../api/core/layer/pooling/GlobalAvgPool1D.kt | 0 .../api/core/layer/pooling/GlobalAvgPool2D.kt | 0 .../api/core/layer/pooling/GlobalAvgPool3D.kt | 0 .../api/core/layer/pooling/GlobalMaxPool1D.kt | 0 .../api/core/layer/pooling/GlobalMaxPool2D.kt | 0 .../api/core/layer/pooling/GlobalMaxPool3D.kt | 0 .../dl/api/core/layer/pooling/MaxPool1D.kt | 0 .../dl/api/core/layer/pooling/MaxPool2D.kt | 0 .../dl/api/core/layer/pooling/MaxPool3D.kt | 0 .../api/core/layer/regularization/Dropout.kt | 0 .../core/layer/reshaping/AbstractCropping.kt | 0 .../layer/reshaping/AbstractUpSampling.kt | 0 .../layer/reshaping/AbstractZeroPadding.kt | 0 .../dl/api/core/layer/reshaping/Cropping1D.kt | 0 .../dl/api/core/layer/reshaping/Cropping2D.kt | 0 .../dl/api/core/layer/reshaping/Cropping3D.kt | 0 .../dl/api/core/layer/reshaping/Flatten.kt | 0 .../dl/api/core/layer/reshaping/Permute.kt | 0 .../api/core/layer/reshaping/RepeatVector.kt | 0 .../dl/api/core/layer/reshaping/Reshape.kt | 0 .../api/core/layer/reshaping/UpSampling1D.kt | 0 .../api/core/layer/reshaping/UpSampling2D.kt | 0 .../api/core/layer/reshaping/UpSampling3D.kt | 0 .../api/core/layer/reshaping/ZeroPadding1D.kt | 0 .../api/core/layer/reshaping/ZeroPadding2D.kt | 0 .../api/core/layer/reshaping/ZeroPadding3D.kt | 0 .../kotlinx/dl/api/core/loss/LossFunction.kt | 0 .../kotlinx/dl/api/core/loss/Losses.kt | 0 .../kotlinx/dl/api/core/loss/ReductionType.kt | 0 .../dl/api/core/metric/EvaluationResult.kt | 0 .../kotlinx/dl/api/core/metric/Metric.kt | 0 .../kotlinx/dl/api/core/model/resnet.kt | 0 .../kotlinx/dl/api/core/model/resnetLight.kt | 0 .../kotlinx/dl/api/core/model/vgg16.kt | 0 .../kotlinx/dl/api/core/model/vgg19.kt | 0 .../kotlinx/dl/api/core/optimizer/AdaDelta.kt | 0 .../kotlinx/dl/api/core/optimizer/AdaGrad.kt | 0 .../dl/api/core/optimizer/AdaGradDA.kt | 0 .../kotlinx/dl/api/core/optimizer/Adam.kt | 0 .../kotlinx/dl/api/core/optimizer/Adamax.kt | 0 .../kotlinx/dl/api/core/optimizer/Ftrl.kt | 0 .../kotlinx/dl/api/core/optimizer/Momentum.kt | 0 .../dl/api/core/optimizer/Optimizer.kt | 0 .../kotlinx/dl/api/core/optimizer/RMSProp.kt | 0 .../kotlinx/dl/api/core/optimizer/SGD.kt | 0 .../dl/api/core/optimizer/clipGradients.kt | 0 .../kotlinx/dl/api/core/regularizer/L2L1.kt | 0 .../dl/api/core/regularizer/Regularizer.kt | 0 .../kotlinx/dl/api/core/shape/ConvUtil.kt | 0 .../dl/api/core/shape/ShapeFunctions.kt | 0 .../kotlinx/dl/api/core/summary/Helpers.kt | 0 .../dl/api/core/summary/ModelSummary.kt | 0 .../kotlinx/dl/api/core/util/ContainerUtil.kt | 0 .../kotlinx/dl/api/core/util/GraphUtil.kt | 0 .../kotlinx/dl/api/core/util/ScannerUtil.kt | 0 .../jetbrains/kotlinx/dl/api/core/util/TF.kt | 0 .../kotlinx/dl/api/core/util/converters.kt | 0 .../dl/api/core/util/dtypeConversionUtil.kt | 0 .../dl/api/core/util/nameConventions.kt | 0 .../kotlinx/dl/api/core/util/stack.kt | 0 .../kotlinx/dl/api/core/util/tensorNames.kt | 0 .../api/extension/TensorExtensionFunctions.kt | 0 .../api/inference/TensorFlowInferenceModel.kt | 0 .../dl/api/inference/keras/HDF5Util.kt | 0 .../dl/api/inference/keras/KerasConstants.kt | 0 .../dl/api/inference/keras/ModelLoader.kt | 0 .../dl/api/inference/keras/ModelParser.kt | 0 .../dl/api/inference/keras/ModelSaver.kt | 0 .../dl/api/inference/keras/WeightLoader.kt | 0 .../dl/api/inference/keras/WeightMappings.kt | 0 .../keras/config/KerasInitializer.kt | 0 .../keras/config/KerasInitializerConfig.kt | 0 .../api/inference/keras/config/KerasLayer.kt | 0 .../api/inference/keras/config/KerasModel.kt | 0 .../keras/config/KerasModelConfig.kt | 0 .../inference/keras/config/KerasPadding.kt | 0 .../keras/config/KerasRegularizer.kt | 0 .../keras/config/KerasRegularizerConfig.kt | 0 .../api/inference/keras/config/LayerConfig.kt | 0 .../api/inference/keras/loaders/TFModelHub.kt | 4 --- .../api/inference/keras/loaders/TFModels.kt | 0 .../dl/api/inference/savedmodel/Input.kt | 0 .../dl/api/inference/savedmodel/Output.kt | 0 .../dl/api/inference/savedmodel/SavedModel.kt | 0 .../dl/dataset/preprocessor/Sharpen.kt | 0 .../dl/api/core/activation/ActivationTest.kt | 0 .../api/core/activation/ELUActivationTest.kt | 0 .../activation/ExponentialActivationTest.kt | 0 .../api/core/activation/GeluActivationTest.kt | 0 .../activation/HardShrinkActivationTest.kt | 0 .../activation/HardSigmoidActivationTest.kt | 0 .../core/activation/LinearActivationTest.kt | 0 .../core/activation/LishtActivationTest.kt | 0 .../activation/LogSoftmaxActivationTest.kt | 0 .../api/core/activation/MishActivationTest.kt | 0 .../core/activation/Relu6ActivationTest.kt | 0 .../api/core/activation/ReluActivationTest.kt | 0 .../api/core/activation/SeluActivationTest.kt | 0 .../core/activation/SigmoidActivationTest.kt | 0 .../core/activation/SnakeActivationTest.kt | 0 .../core/activation/SoftPlusActivationTest.kt | 0 .../activation/SoftShrinkActivationTest.kt | 0 .../core/activation/SoftSignActivationTest.kt | 0 .../core/activation/SoftmaxActivationTest.kt | 0 .../activation/SparsemaxActivationTest.kt | 0 .../core/activation/SwishActivationTest.kt | 0 .../api/core/activation/TanhActivationTest.kt | 0 .../activation/TanhShrinkActivationTest.kt | 0 .../dsl/GraphTrainableModelBuilderTest.kt | 0 .../dl/api/core/initializer/ConstantTest.kt | 0 .../api/core/initializer/GlorotNormalTest.kt | 0 .../api/core/initializer/GlorotUniformTest.kt | 0 .../dl/api/core/initializer/HeNormalTest.kt | 0 .../dl/api/core/initializer/HeUniformTest.kt | 0 .../dl/api/core/initializer/IdentityTest.kt | 0 .../api/core/initializer/LeCunNormalTest.kt | 0 .../api/core/initializer/LeCunUniformTest.kt | 0 .../dl/api/core/initializer/OnesTest.kt | 0 .../dl/api/core/initializer/OrthogonalTest.kt | 0 .../ParametrizedRandomNormalTest.kt | 0 .../api/core/initializer/RandomNormalTest.kt | 0 .../api/core/initializer/RandomUniformTest.kt | 0 .../core/initializer/TruncatedNormalTest.kt | 0 .../core/initializer/VarianceScalingTest.kt | 0 .../dl/api/core/initializer/ZerosTest.kt | 0 .../api/core/integration/IntegrationTest.kt | 0 .../dl/api/core/integration/SavedModelTest.kt | 0 .../core/integration/SequentialBasicTest.kt | 0 .../integration/SequentialInferenceTest.kt | 0 .../TensorFlowInferenceModelTest.kt | 0 .../TransferLearningFromKerasTest.kt | 0 .../dl/api/core/layer/ActivationLayerTest.kt | 0 .../dl/api/core/layer/AvgPool1DTest.kt | 0 .../dl/api/core/layer/AvgPool3DTest.kt | 0 .../kotlinx/dl/api/core/layer/Conv1DTest.kt | 0 .../dl/api/core/layer/Conv1DTransposeTest.kt | 0 .../kotlinx/dl/api/core/layer/Conv2DTest.kt | 0 .../dl/api/core/layer/Conv2DTransposeTest.kt | 0 .../kotlinx/dl/api/core/layer/Conv3DTest.kt | 0 .../dl/api/core/layer/Conv3DTransposeTest.kt | 0 .../dl/api/core/layer/ConvLayerTest.kt | 0 .../dl/api/core/layer/Cropping1DTest.kt | 0 .../dl/api/core/layer/Cropping2DTest.kt | 0 .../dl/api/core/layer/Cropping3DTest.kt | 0 .../kotlinx/dl/api/core/layer/ELUTest.kt | 0 .../dl/api/core/layer/GlobalAvgPool1DTest.kt | 0 .../dl/api/core/layer/GlobalAvgPool2DTest.kt | 0 .../dl/api/core/layer/GlobalAvgPool3DTest.kt | 0 .../dl/api/core/layer/GlobalMaxPool1DTest.kt | 0 .../dl/api/core/layer/GlobalMaxPool2DTest.kt | 0 .../dl/api/core/layer/GlobalMaxPool3DTest.kt | 0 .../kotlinx/dl/api/core/layer/LayerTest.kt | 0 .../dl/api/core/layer/LeakyReLUTest.kt | 0 .../dl/api/core/layer/MaxPool1DTest.kt | 0 .../dl/api/core/layer/MaxPool3DTest.kt | 0 .../kotlinx/dl/api/core/layer/PReLUTest.kt | 0 .../kotlinx/dl/api/core/layer/PermuteTest.kt | 0 .../kotlinx/dl/api/core/layer/ReLUTest.kt | 0 .../api/core/layer/RepeatVectorLayerTest.kt | 0 .../kotlinx/dl/api/core/layer/SoftmaxTest.kt | 0 .../dl/api/core/layer/ThresholdedReLUTest.kt | 0 .../dl/api/core/layer/UpSampling1DTest.kt | 0 .../dl/api/core/layer/UpSampling2DTest.kt | 0 .../dl/api/core/layer/UpSampling3DTest.kt | 0 .../dl/api/core/layer/ZeroPadding1DTest.kt | 0 .../dl/api/core/layer/ZeroPadding2DTest.kt | 0 .../dl/api/core/layer/ZeroPadding3DTest.kt | 0 .../api/core/layer/reshaping/ReshapeTest.kt | 0 .../api/core/loss/BinaryCrossEntropyTest.kt | 0 .../kotlinx/dl/api/core/loss/HingeTest.kt | 0 .../kotlinx/dl/api/core/loss/HuberTest.kt | 0 .../kotlinx/dl/api/core/loss/LogCoshTest.kt | 0 .../kotlinx/dl/api/core/loss/MAETest.kt | 0 .../kotlinx/dl/api/core/loss/MAPETest.kt | 0 .../kotlinx/dl/api/core/loss/MSETest.kt | 0 .../kotlinx/dl/api/core/loss/MSLETest.kt | 0 .../kotlinx/dl/api/core/loss/PoissonTest.kt | 0 .../dl/api/core/loss/SquaredHingeTest.kt | 0 .../dl/api/core/metric/AccuracyTest.kt | 0 .../kotlinx/dl/api/core/ml/RegressionTest.kt | 0 .../dl/api/core/models/FunctionalModelTest.kt | 0 .../core/models/SequentialCompilationTest.kt | 0 .../api/core/summary/SummaryHelpersTests.kt | 0 .../dl/api/core/util/TopologicalSortTest.kt | 0 .../keras/ActivationLayersImportExportTest.kt | 0 .../ConvolutionalLayersImportExportTest.kt | 0 .../keras/CoreLayersImportExportTest.kt | 0 .../keras/DropoutBatchNormImportExportTest.kt | 0 .../keras/InitializerImportExportTest.kt | 0 .../inference/keras/LayerImportExportTest.kt | 0 .../keras/MergeLayersImportExportTest.kt | 0 .../dl/api/inference/keras/ModelLoaderTest.kt | 0 .../inference/keras/PaddingConverterTest.kt | 0 .../keras/PoolingLayersImportExportTest.kt | 0 .../keras/ReshapingLayersImportExportTest.kt | 0 .../ModelLoader/initializer_identity.json | 0 .../python/Initializer Identity Export.ipynb | 0 .../inference/lenet/dropout/modelConfig.json | 0 .../dropout/python/LeNet with Dropout.ipynb | 0 .../inference/lenet/dropout/weights.h5 | Bin .../inference/lenet/mismatchModelConfig.json | 0 .../inference/lenet/mnist_weights_only.h5 | Bin .../inference/lenet/modelConfig.json | 0 ...on MNIST with different initializers.ipynb | 0 .../lenet/regularizers/mnist_weights_only.h5 | Bin .../lenet/regularizers/modelConfig.json | 0 ...ferent initializers and regularizers.ipynb | 0 .../mnist_weights_only.h5 | Bin .../unsupportedInitializers/modelConfig.json | 0 ... with different initializers (zeros).ipynb | 0 .../inference/lenet/wrongJson/model.json | 0 .../src/test/resources/logback.xml | 0 .../src/test/resources/savedmodel/Readme.md | 0 .../test/resources/savedmodel/saved_model.pb | Bin .../variables/variables.data-00000-of-00001 | Bin .../savedmodel/variables/variables.index | Bin visualization/build.gradle | 1 + 292 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 tensorflow/build.gradle rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/Functional.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/GraphTrainableModel.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/KGraph.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/SavingFormat.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/Sequential.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/TrainableModel.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/WritingMode.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/Activation.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/Activations.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/Callback.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/EarlyStopping.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/TerminateOnNaN.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/TimeStopping.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/dsl/GraphTrainableModelBuilder.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/exception/IdentityDimensionalityException.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/exception/RepeatableLayerNameException.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/history/History.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/history/TrainingHistory.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Constant.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Identity.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Initializer.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Ones.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Orthogonal.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ParametrizedTruncatedNormal.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomNormal.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomUniform.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/TruncatedNormal.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/VarianceScaling.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Zeros.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/KVariable.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Layer.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/NoGradients.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ParametrizedLayer.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/TrainableLayer.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Weights.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/AbstractActivationLayer.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ActivationUtils.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ELU.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/LeakyReLU.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/PReLU.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ReLU.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/Softmax.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ThresholdedReLU.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/AbstractConv.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv1D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv1DTranspose.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv2D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv2DTranspose.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv3D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv3DTranspose.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/ConvPadding.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/ConvTranspose.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/DepthwiseConv2D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/SeparableConv2D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/core/ActivationLayer.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/core/Dense.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/core/Input.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/AbstractMerge.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Add.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Average.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Concatenate.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Dot.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Maximum.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Minimum.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Multiply.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Subtract.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/normalization/BatchNorm.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool1D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool2D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool3D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalAvgPool1D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalAvgPool2D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalAvgPool3D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalMaxPool1D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalMaxPool2D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalMaxPool3D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/MaxPool1D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/MaxPool2D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/MaxPool3D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/regularization/Dropout.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/AbstractCropping.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/AbstractUpSampling.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/AbstractZeroPadding.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Cropping1D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Cropping2D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Cropping3D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Flatten.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Permute.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/RepeatVector.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Reshape.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/UpSampling1D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/UpSampling2D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/UpSampling3D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ZeroPadding1D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ZeroPadding2D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ZeroPadding3D.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/LossFunction.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/Losses.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/ReductionType.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/EvaluationResult.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/Metric.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/resnet.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/resnetLight.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/vgg16.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/vgg19.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/AdaDelta.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/AdaGrad.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/AdaGradDA.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Adam.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Adamax.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Ftrl.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Momentum.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Optimizer.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/RMSProp.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/SGD.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/clipGradients.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/regularizer/L2L1.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/regularizer/Regularizer.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ConvUtil.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/summary/Helpers.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/summary/ModelSummary.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/ContainerUtil.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/GraphUtil.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/ScannerUtil.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/TF.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/converters.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/dtypeConversionUtil.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/nameConventions.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/stack.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/tensorNames.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/extension/TensorExtensionFunctions.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/TensorFlowInferenceModel.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/HDF5Util.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/KerasConstants.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelLoader.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelParser.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelSaver.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/WeightLoader.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/WeightMappings.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasInitializer.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasInitializerConfig.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasLayer.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasModel.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasModelConfig.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasPadding.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasRegularizer.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasRegularizerConfig.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/LayerConfig.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModelHub.kt (99%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModels.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/savedmodel/Input.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/savedmodel/Output.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/savedmodel/SavedModel.kt (100%) rename {api => tensorflow}/src/main/kotlin/org/jetbrains/kotlinx/dl/dataset/preprocessor/Sharpen.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ELUActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ExponentialActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/GeluActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/HardShrinkActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/HardSigmoidActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/LinearActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/LishtActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/LogSoftmaxActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/MishActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/Relu6ActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ReluActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SeluActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SigmoidActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SnakeActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftPlusActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftShrinkActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftSignActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftmaxActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SparsemaxActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SwishActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/TanhActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/TanhShrinkActivationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/dsl/GraphTrainableModelBuilderTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ConstantTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/GlorotNormalTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/GlorotUniformTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/HeNormalTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/HeUniformTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/IdentityTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/LeCunNormalTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/LeCunUniformTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/OnesTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/OrthogonalTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ParametrizedRandomNormalTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomNormalTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomUniformTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/TruncatedNormalTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/VarianceScalingTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ZerosTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/IntegrationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/SavedModelTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/SequentialBasicTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/SequentialInferenceTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/TensorFlowInferenceModelTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/TransferLearningFromKerasTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ActivationLayerTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/AvgPool1DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/AvgPool3DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv1DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv1DTransposeTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv2DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv2DTransposeTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv3DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv3DTransposeTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ConvLayerTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Cropping1DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Cropping2DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Cropping3DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ELUTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalAvgPool1DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalAvgPool2DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalAvgPool3DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalMaxPool1DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalMaxPool2DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalMaxPool3DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/LayerTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/LeakyReLUTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/MaxPool1DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/MaxPool3DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/PReLUTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/PermuteTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ReLUTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/RepeatVectorLayerTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/SoftmaxTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ThresholdedReLUTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/UpSampling1DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/UpSampling2DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/UpSampling3DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ZeroPadding1DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ZeroPadding2DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ZeroPadding3DTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ReshapeTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/BinaryCrossEntropyTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/HingeTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/HuberTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/LogCoshTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MAETest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MAPETest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MSETest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MSLETest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/PoissonTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/SquaredHingeTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/AccuracyTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/ml/RegressionTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/models/FunctionalModelTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/models/SequentialCompilationTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/summary/SummaryHelpersTests.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/util/TopologicalSortTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ActivationLayersImportExportTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ConvolutionalLayersImportExportTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/CoreLayersImportExportTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/DropoutBatchNormImportExportTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/InitializerImportExportTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/LayerImportExportTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/MergeLayersImportExportTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelLoaderTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/PaddingConverterTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/PoolingLayersImportExportTest.kt (100%) rename {api => tensorflow}/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ReshapingLayersImportExportTest.kt (100%) rename {api => tensorflow}/src/test/resources/inference/keras/ModelLoader/initializer_identity.json (100%) rename {api => tensorflow}/src/test/resources/inference/keras/ModelLoader/python/Initializer Identity Export.ipynb (100%) rename {api => tensorflow}/src/test/resources/inference/lenet/dropout/modelConfig.json (100%) rename {api => tensorflow}/src/test/resources/inference/lenet/dropout/python/LeNet with Dropout.ipynb (100%) rename {api => tensorflow}/src/test/resources/inference/lenet/dropout/weights.h5 (100%) rename {api => tensorflow}/src/test/resources/inference/lenet/mismatchModelConfig.json (100%) rename {api => tensorflow}/src/test/resources/inference/lenet/mnist_weights_only.h5 (100%) rename {api => tensorflow}/src/test/resources/inference/lenet/modelConfig.json (100%) rename {api => tensorflow}/src/test/resources/inference/lenet/python/LeNet on MNIST with different initializers.ipynb (100%) rename {api => tensorflow}/src/test/resources/inference/lenet/regularizers/mnist_weights_only.h5 (100%) rename {api => tensorflow}/src/test/resources/inference/lenet/regularizers/modelConfig.json (100%) rename {api => tensorflow}/src/test/resources/inference/lenet/regularizers/python/DEMO-1 LeNet-5, MNIST to Kotlin DL with different initializers and regularizers.ipynb (100%) rename {api => tensorflow}/src/test/resources/inference/lenet/unsupportedInitializers/mnist_weights_only.h5 (100%) rename {api => tensorflow}/src/test/resources/inference/lenet/unsupportedInitializers/modelConfig.json (100%) rename {api => tensorflow}/src/test/resources/inference/lenet/unsupportedInitializers/python/LeNet on MNIST with different initializers (zeros).ipynb (100%) rename {api => tensorflow}/src/test/resources/inference/lenet/wrongJson/model.json (100%) rename {api => tensorflow}/src/test/resources/logback.xml (100%) rename {api => tensorflow}/src/test/resources/savedmodel/Readme.md (100%) rename {api => tensorflow}/src/test/resources/savedmodel/saved_model.pb (100%) rename {api => tensorflow}/src/test/resources/savedmodel/variables/variables.data-00000-of-00001 (100%) rename {api => tensorflow}/src/test/resources/savedmodel/variables/variables.index (100%) diff --git a/api/build.gradle b/api/build.gradle index 84ccc366f..673b52511 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -3,16 +3,10 @@ project.setDescription("This module contains the Kotlin API for building, traini dependencies { api project(":dataset") implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21' - api group: 'org.tensorflow', name: 'tensorflow', version: '1.15.0' api 'com.github.doyaaaaaken:kotlin-csv-jvm:0.7.3' // for csv parsing api 'io.github.microutils:kotlin-logging:2.1.21' // for logging api 'io.jhdf:jhdf:0.5.7' // for hdf5 parsing api 'com.beust:klaxon:5.5' - testImplementation 'ch.qos.logback:logback-classic:1.2.11' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' - testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2' - testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2' - testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2' } compileKotlin { @@ -27,10 +21,6 @@ kotlin { explicitApiWarning() } -test { - useJUnitPlatform() -} - task fatJar(type: Jar) { duplicatesStrategy = DuplicatesStrategy.INCLUDE diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/TensorShape.kt b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/TensorShape.kt index d132ee03b..105b567a7 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/TensorShape.kt +++ b/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/TensorShape.kt @@ -214,7 +214,11 @@ public class TensorShape() { } } -internal fun getDimsOfArray(data: kotlin.Array<*>): LongArray { +/** + * Get shape of array of arrays (of arrays...) of Array of elements of any type. + * If the most inner array does not have any elements its size is skipped in the result. + */ +public fun getDimsOfArray(data: kotlin.Array<*>): LongArray { fun appendPrimitiveArraySize(size: Int, acc: MutableList): LongArray { acc += size.toLong() return acc.toLongArray() @@ -240,7 +244,6 @@ internal fun getDimsOfArray(data: kotlin.Array<*>): LongArray { } /** - * Get shape of array of arrays (of arrays...) of Array of elements of any type. - * If the most inner array does not have any elements its size is missed in result + * @see getDimsOfArray */ internal val Array<*>.tensorShape: TensorShape get() = TensorShape(getDimsOfArray(this)) \ No newline at end of file diff --git a/examples/build.gradle b/examples/build.gradle index 7ad7c1aba..ea28d833a 100644 --- a/examples/build.gradle +++ b/examples/build.gradle @@ -1,6 +1,7 @@ dependencies { implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21' api project(":api") + api project(":tensorflow") api project(":dataset") api project(":visualization") api project(":onnx") @@ -25,6 +26,7 @@ if (publishedArtifactsVersion != null && !publishedArtifactsVersion.isBlank()) { configurations.all { resolutionStrategy.dependencySubstitution { substitute project(":api") using module("org.jetbrains.kotlinx:kotlin-deeplearning-api:$publishedArtifactsVersion") because "testing published artifacts" + substitute project(":tensorflow") using module("org.jetbrains.kotlinx:kotlin-deeplearning-tensorflow:$publishedArtifactsVersion") because "testing published artifacts" substitute project(":dataset") using module("org.jetbrains.kotlinx:kotlin-deeplearning-dataset:$publishedArtifactsVersion") because "testing published artifacts" substitute project(":visualization") using module("org.jetbrains.kotlinx:kotlin-deeplearning-visualization:$publishedArtifactsVersion") because "testing published artifacts" substitute project(":onnx") using module("org.jetbrains.kotlinx:kotlin-deeplearning-onnx:$publishedArtifactsVersion") because "testing published artifacts" diff --git a/settings.gradle b/settings.gradle index df2671d9b..623b9376e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,8 +1,7 @@ rootProject.name = 'KotlinDL' include("api") +include("tensorflow") include("visualization") include("examples") include("dataset") -include("onnx") - - +include("onnx") \ No newline at end of file diff --git a/tensorflow/build.gradle b/tensorflow/build.gradle new file mode 100644 index 000000000..e402478be --- /dev/null +++ b/tensorflow/build.gradle @@ -0,0 +1,25 @@ +project.setDescription("This module contains the Kotlin API for building, training, and evaluating TensorFlow models.") + +dependencies { + api project(":dataset") + api project(":api") + implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21' + api group: 'org.tensorflow', name: 'tensorflow', version: '1.15.0' + testImplementation 'ch.qos.logback:logback-classic:1.2.11' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' + testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2' + testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2' + testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2' +} + +compileKotlin { + kotlinOptions.jvmTarget = "1.8" +} + +compileTestKotlin { + kotlinOptions.jvmTarget = "1.8" +} + +kotlin { + explicitApiWarning() +} diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/Functional.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/Functional.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/Functional.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/Functional.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/GraphTrainableModel.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/GraphTrainableModel.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/GraphTrainableModel.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/GraphTrainableModel.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/KGraph.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/KGraph.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/KGraph.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/KGraph.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/SavingFormat.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/SavingFormat.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/SavingFormat.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/SavingFormat.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/Sequential.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/Sequential.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/Sequential.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/Sequential.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/TrainableModel.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/TrainableModel.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/TrainableModel.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/TrainableModel.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/WritingMode.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/WritingMode.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/WritingMode.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/WritingMode.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/Activation.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/Activation.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/Activation.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/Activation.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/Activations.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/Activations.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/Activations.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/Activations.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/Callback.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/Callback.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/Callback.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/Callback.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/EarlyStopping.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/EarlyStopping.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/EarlyStopping.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/EarlyStopping.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/TerminateOnNaN.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/TerminateOnNaN.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/TerminateOnNaN.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/TerminateOnNaN.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/TimeStopping.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/TimeStopping.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/TimeStopping.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/callback/TimeStopping.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/dsl/GraphTrainableModelBuilder.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/dsl/GraphTrainableModelBuilder.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/dsl/GraphTrainableModelBuilder.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/dsl/GraphTrainableModelBuilder.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/exception/IdentityDimensionalityException.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/exception/IdentityDimensionalityException.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/exception/IdentityDimensionalityException.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/exception/IdentityDimensionalityException.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/exception/RepeatableLayerNameException.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/exception/RepeatableLayerNameException.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/exception/RepeatableLayerNameException.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/exception/RepeatableLayerNameException.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/history/History.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/history/History.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/history/History.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/history/History.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/history/TrainingHistory.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/history/TrainingHistory.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/history/TrainingHistory.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/history/TrainingHistory.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Constant.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Constant.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Constant.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Constant.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Identity.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Identity.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Identity.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Identity.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Initializer.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Initializer.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Initializer.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Initializer.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Ones.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Ones.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Ones.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Ones.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Orthogonal.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Orthogonal.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Orthogonal.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Orthogonal.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ParametrizedTruncatedNormal.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ParametrizedTruncatedNormal.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ParametrizedTruncatedNormal.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ParametrizedTruncatedNormal.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomNormal.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomNormal.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomNormal.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomNormal.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomUniform.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomUniform.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomUniform.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomUniform.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/TruncatedNormal.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/TruncatedNormal.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/TruncatedNormal.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/TruncatedNormal.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/VarianceScaling.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/VarianceScaling.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/VarianceScaling.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/VarianceScaling.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Zeros.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Zeros.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Zeros.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/Zeros.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/KVariable.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/KVariable.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/KVariable.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/KVariable.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Layer.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Layer.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Layer.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Layer.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/NoGradients.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/NoGradients.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/NoGradients.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/NoGradients.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ParametrizedLayer.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ParametrizedLayer.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ParametrizedLayer.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ParametrizedLayer.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/TrainableLayer.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/TrainableLayer.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/TrainableLayer.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/TrainableLayer.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Weights.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Weights.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Weights.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Weights.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/AbstractActivationLayer.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/AbstractActivationLayer.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/AbstractActivationLayer.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/AbstractActivationLayer.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ActivationUtils.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ActivationUtils.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ActivationUtils.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ActivationUtils.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ELU.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ELU.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ELU.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ELU.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/LeakyReLU.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/LeakyReLU.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/LeakyReLU.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/LeakyReLU.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/PReLU.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/PReLU.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/PReLU.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/PReLU.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ReLU.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ReLU.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ReLU.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ReLU.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/Softmax.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/Softmax.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/Softmax.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/Softmax.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ThresholdedReLU.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ThresholdedReLU.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ThresholdedReLU.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/activation/ThresholdedReLU.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/AbstractConv.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/AbstractConv.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/AbstractConv.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/AbstractConv.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv1D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv1D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv1D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv1D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv1DTranspose.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv1DTranspose.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv1DTranspose.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv1DTranspose.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv2D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv2D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv2D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv2D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv2DTranspose.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv2DTranspose.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv2DTranspose.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv2DTranspose.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv3D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv3D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv3D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv3D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv3DTranspose.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv3DTranspose.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv3DTranspose.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/Conv3DTranspose.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/ConvPadding.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/ConvPadding.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/ConvPadding.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/ConvPadding.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/ConvTranspose.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/ConvTranspose.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/ConvTranspose.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/ConvTranspose.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/DepthwiseConv2D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/DepthwiseConv2D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/DepthwiseConv2D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/DepthwiseConv2D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/SeparableConv2D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/SeparableConv2D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/SeparableConv2D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/convolutional/SeparableConv2D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/core/ActivationLayer.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/core/ActivationLayer.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/core/ActivationLayer.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/core/ActivationLayer.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/core/Dense.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/core/Dense.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/core/Dense.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/core/Dense.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/core/Input.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/core/Input.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/core/Input.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/core/Input.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/AbstractMerge.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/AbstractMerge.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/AbstractMerge.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/AbstractMerge.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Add.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Add.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Add.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Add.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Average.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Average.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Average.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Average.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Concatenate.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Concatenate.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Concatenate.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Concatenate.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Dot.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Dot.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Dot.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Dot.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Maximum.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Maximum.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Maximum.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Maximum.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Minimum.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Minimum.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Minimum.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Minimum.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Multiply.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Multiply.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Multiply.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Multiply.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Subtract.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Subtract.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Subtract.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/merge/Subtract.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/normalization/BatchNorm.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/normalization/BatchNorm.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/normalization/BatchNorm.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/normalization/BatchNorm.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool1D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool1D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool1D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool1D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool2D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool2D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool2D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool2D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool3D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool3D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool3D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/AvgPool3D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalAvgPool1D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalAvgPool1D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalAvgPool1D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalAvgPool1D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalAvgPool2D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalAvgPool2D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalAvgPool2D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalAvgPool2D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalAvgPool3D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalAvgPool3D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalAvgPool3D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalAvgPool3D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalMaxPool1D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalMaxPool1D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalMaxPool1D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalMaxPool1D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalMaxPool2D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalMaxPool2D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalMaxPool2D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalMaxPool2D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalMaxPool3D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalMaxPool3D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalMaxPool3D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/GlobalMaxPool3D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/MaxPool1D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/MaxPool1D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/MaxPool1D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/MaxPool1D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/MaxPool2D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/MaxPool2D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/MaxPool2D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/MaxPool2D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/MaxPool3D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/MaxPool3D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/MaxPool3D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/pooling/MaxPool3D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/regularization/Dropout.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/regularization/Dropout.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/regularization/Dropout.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/regularization/Dropout.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/AbstractCropping.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/AbstractCropping.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/AbstractCropping.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/AbstractCropping.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/AbstractUpSampling.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/AbstractUpSampling.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/AbstractUpSampling.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/AbstractUpSampling.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/AbstractZeroPadding.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/AbstractZeroPadding.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/AbstractZeroPadding.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/AbstractZeroPadding.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Cropping1D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Cropping1D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Cropping1D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Cropping1D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Cropping2D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Cropping2D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Cropping2D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Cropping2D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Cropping3D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Cropping3D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Cropping3D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Cropping3D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Flatten.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Flatten.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Flatten.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Flatten.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Permute.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Permute.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Permute.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Permute.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/RepeatVector.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/RepeatVector.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/RepeatVector.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/RepeatVector.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Reshape.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Reshape.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Reshape.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/Reshape.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/UpSampling1D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/UpSampling1D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/UpSampling1D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/UpSampling1D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/UpSampling2D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/UpSampling2D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/UpSampling2D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/UpSampling2D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/UpSampling3D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/UpSampling3D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/UpSampling3D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/UpSampling3D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ZeroPadding1D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ZeroPadding1D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ZeroPadding1D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ZeroPadding1D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ZeroPadding2D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ZeroPadding2D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ZeroPadding2D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ZeroPadding2D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ZeroPadding3D.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ZeroPadding3D.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ZeroPadding3D.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ZeroPadding3D.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/LossFunction.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/LossFunction.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/LossFunction.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/LossFunction.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/Losses.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/Losses.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/Losses.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/Losses.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/ReductionType.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/ReductionType.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/ReductionType.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/ReductionType.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/EvaluationResult.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/EvaluationResult.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/EvaluationResult.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/EvaluationResult.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/Metric.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/Metric.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/Metric.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/Metric.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/resnet.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/resnet.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/resnet.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/resnet.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/resnetLight.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/resnetLight.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/resnetLight.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/resnetLight.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/vgg16.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/vgg16.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/vgg16.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/vgg16.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/vgg19.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/vgg19.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/vgg19.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/model/vgg19.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/AdaDelta.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/AdaDelta.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/AdaDelta.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/AdaDelta.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/AdaGrad.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/AdaGrad.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/AdaGrad.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/AdaGrad.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/AdaGradDA.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/AdaGradDA.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/AdaGradDA.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/AdaGradDA.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Adam.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Adam.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Adam.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Adam.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Adamax.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Adamax.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Adamax.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Adamax.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Ftrl.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Ftrl.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Ftrl.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Ftrl.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Momentum.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Momentum.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Momentum.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Momentum.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Optimizer.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Optimizer.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Optimizer.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/Optimizer.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/RMSProp.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/RMSProp.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/RMSProp.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/RMSProp.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/SGD.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/SGD.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/SGD.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/SGD.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/clipGradients.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/clipGradients.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/clipGradients.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/optimizer/clipGradients.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/regularizer/L2L1.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/regularizer/L2L1.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/regularizer/L2L1.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/regularizer/L2L1.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/regularizer/Regularizer.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/regularizer/Regularizer.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/regularizer/Regularizer.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/regularizer/Regularizer.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ConvUtil.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ConvUtil.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ConvUtil.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ConvUtil.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/shape/ShapeFunctions.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/summary/Helpers.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/summary/Helpers.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/summary/Helpers.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/summary/Helpers.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/summary/ModelSummary.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/summary/ModelSummary.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/summary/ModelSummary.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/summary/ModelSummary.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/ContainerUtil.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/ContainerUtil.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/ContainerUtil.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/ContainerUtil.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/GraphUtil.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/GraphUtil.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/GraphUtil.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/GraphUtil.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/ScannerUtil.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/ScannerUtil.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/ScannerUtil.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/ScannerUtil.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/TF.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/TF.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/TF.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/TF.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/converters.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/converters.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/converters.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/converters.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/dtypeConversionUtil.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/dtypeConversionUtil.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/dtypeConversionUtil.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/dtypeConversionUtil.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/nameConventions.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/nameConventions.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/nameConventions.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/nameConventions.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/stack.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/stack.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/stack.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/stack.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/tensorNames.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/tensorNames.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/tensorNames.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/core/util/tensorNames.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/extension/TensorExtensionFunctions.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/extension/TensorExtensionFunctions.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/extension/TensorExtensionFunctions.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/extension/TensorExtensionFunctions.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/TensorFlowInferenceModel.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/TensorFlowInferenceModel.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/TensorFlowInferenceModel.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/TensorFlowInferenceModel.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/HDF5Util.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/HDF5Util.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/HDF5Util.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/HDF5Util.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/KerasConstants.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/KerasConstants.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/KerasConstants.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/KerasConstants.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelLoader.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelLoader.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelLoader.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelLoader.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelParser.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelParser.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelParser.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelParser.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelSaver.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelSaver.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelSaver.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelSaver.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/WeightLoader.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/WeightLoader.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/WeightLoader.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/WeightLoader.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/WeightMappings.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/WeightMappings.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/WeightMappings.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/WeightMappings.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasInitializer.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasInitializer.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasInitializer.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasInitializer.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasInitializerConfig.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasInitializerConfig.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasInitializerConfig.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasInitializerConfig.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasLayer.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasLayer.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasLayer.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasLayer.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasModel.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasModel.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasModel.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasModel.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasModelConfig.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasModelConfig.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasModelConfig.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasModelConfig.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasPadding.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasPadding.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasPadding.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasPadding.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasRegularizer.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasRegularizer.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasRegularizer.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasRegularizer.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasRegularizerConfig.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasRegularizerConfig.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasRegularizerConfig.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/KerasRegularizerConfig.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/LayerConfig.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/LayerConfig.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/LayerConfig.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/config/LayerConfig.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModelHub.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModelHub.kt similarity index 99% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModelHub.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModelHub.kt index ee5554377..13fd8f1ac 100644 --- a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModelHub.kt +++ b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModelHub.kt @@ -263,7 +263,3 @@ public class TFModelHub(cacheDirectory: File) : ModelHub(cacheDirectory) { return HdfFile(File(fileName)) } } - - - - diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModels.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModels.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModels.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/loaders/TFModels.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/savedmodel/Input.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/savedmodel/Input.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/savedmodel/Input.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/savedmodel/Input.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/savedmodel/Output.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/savedmodel/Output.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/savedmodel/Output.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/savedmodel/Output.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/savedmodel/SavedModel.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/savedmodel/SavedModel.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/savedmodel/SavedModel.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/api/inference/savedmodel/SavedModel.kt diff --git a/api/src/main/kotlin/org/jetbrains/kotlinx/dl/dataset/preprocessor/Sharpen.kt b/tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/dataset/preprocessor/Sharpen.kt similarity index 100% rename from api/src/main/kotlin/org/jetbrains/kotlinx/dl/dataset/preprocessor/Sharpen.kt rename to tensorflow/src/main/kotlin/org/jetbrains/kotlinx/dl/dataset/preprocessor/Sharpen.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ELUActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ELUActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ELUActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ELUActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ExponentialActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ExponentialActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ExponentialActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ExponentialActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/GeluActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/GeluActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/GeluActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/GeluActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/HardShrinkActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/HardShrinkActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/HardShrinkActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/HardShrinkActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/HardSigmoidActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/HardSigmoidActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/HardSigmoidActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/HardSigmoidActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/LinearActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/LinearActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/LinearActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/LinearActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/LishtActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/LishtActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/LishtActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/LishtActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/LogSoftmaxActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/LogSoftmaxActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/LogSoftmaxActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/LogSoftmaxActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/MishActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/MishActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/MishActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/MishActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/Relu6ActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/Relu6ActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/Relu6ActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/Relu6ActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ReluActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ReluActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ReluActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/ReluActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SeluActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SeluActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SeluActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SeluActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SigmoidActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SigmoidActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SigmoidActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SigmoidActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SnakeActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SnakeActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SnakeActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SnakeActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftPlusActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftPlusActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftPlusActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftPlusActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftShrinkActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftShrinkActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftShrinkActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftShrinkActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftSignActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftSignActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftSignActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftSignActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftmaxActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftmaxActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftmaxActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SoftmaxActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SparsemaxActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SparsemaxActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SparsemaxActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SparsemaxActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SwishActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SwishActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SwishActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/SwishActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/TanhActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/TanhActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/TanhActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/TanhActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/TanhShrinkActivationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/TanhShrinkActivationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/TanhShrinkActivationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/activation/TanhShrinkActivationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/dsl/GraphTrainableModelBuilderTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/dsl/GraphTrainableModelBuilderTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/dsl/GraphTrainableModelBuilderTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/dsl/GraphTrainableModelBuilderTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ConstantTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ConstantTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ConstantTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ConstantTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/GlorotNormalTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/GlorotNormalTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/GlorotNormalTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/GlorotNormalTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/GlorotUniformTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/GlorotUniformTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/GlorotUniformTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/GlorotUniformTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/HeNormalTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/HeNormalTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/HeNormalTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/HeNormalTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/HeUniformTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/HeUniformTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/HeUniformTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/HeUniformTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/IdentityTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/IdentityTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/IdentityTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/IdentityTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/LeCunNormalTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/LeCunNormalTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/LeCunNormalTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/LeCunNormalTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/LeCunUniformTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/LeCunUniformTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/LeCunUniformTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/LeCunUniformTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/OnesTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/OnesTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/OnesTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/OnesTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/OrthogonalTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/OrthogonalTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/OrthogonalTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/OrthogonalTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ParametrizedRandomNormalTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ParametrizedRandomNormalTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ParametrizedRandomNormalTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ParametrizedRandomNormalTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomNormalTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomNormalTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomNormalTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomNormalTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomUniformTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomUniformTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomUniformTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/RandomUniformTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/TruncatedNormalTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/TruncatedNormalTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/TruncatedNormalTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/TruncatedNormalTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/VarianceScalingTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/VarianceScalingTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/VarianceScalingTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/VarianceScalingTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ZerosTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ZerosTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ZerosTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/initializer/ZerosTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/IntegrationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/IntegrationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/IntegrationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/IntegrationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/SavedModelTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/SavedModelTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/SavedModelTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/SavedModelTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/SequentialBasicTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/SequentialBasicTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/SequentialBasicTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/SequentialBasicTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/SequentialInferenceTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/SequentialInferenceTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/SequentialInferenceTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/SequentialInferenceTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/TensorFlowInferenceModelTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/TensorFlowInferenceModelTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/TensorFlowInferenceModelTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/TensorFlowInferenceModelTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/TransferLearningFromKerasTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/TransferLearningFromKerasTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/TransferLearningFromKerasTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/integration/TransferLearningFromKerasTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ActivationLayerTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ActivationLayerTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ActivationLayerTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ActivationLayerTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/AvgPool1DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/AvgPool1DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/AvgPool1DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/AvgPool1DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/AvgPool3DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/AvgPool3DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/AvgPool3DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/AvgPool3DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv1DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv1DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv1DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv1DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv1DTransposeTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv1DTransposeTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv1DTransposeTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv1DTransposeTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv2DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv2DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv2DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv2DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv2DTransposeTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv2DTransposeTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv2DTransposeTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv2DTransposeTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv3DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv3DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv3DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv3DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv3DTransposeTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv3DTransposeTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv3DTransposeTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Conv3DTransposeTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ConvLayerTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ConvLayerTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ConvLayerTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ConvLayerTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Cropping1DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Cropping1DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Cropping1DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Cropping1DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Cropping2DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Cropping2DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Cropping2DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Cropping2DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Cropping3DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Cropping3DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Cropping3DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/Cropping3DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ELUTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ELUTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ELUTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ELUTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalAvgPool1DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalAvgPool1DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalAvgPool1DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalAvgPool1DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalAvgPool2DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalAvgPool2DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalAvgPool2DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalAvgPool2DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalAvgPool3DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalAvgPool3DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalAvgPool3DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalAvgPool3DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalMaxPool1DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalMaxPool1DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalMaxPool1DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalMaxPool1DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalMaxPool2DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalMaxPool2DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalMaxPool2DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalMaxPool2DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalMaxPool3DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalMaxPool3DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalMaxPool3DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/GlobalMaxPool3DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/LayerTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/LayerTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/LayerTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/LayerTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/LeakyReLUTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/LeakyReLUTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/LeakyReLUTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/LeakyReLUTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/MaxPool1DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/MaxPool1DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/MaxPool1DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/MaxPool1DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/MaxPool3DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/MaxPool3DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/MaxPool3DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/MaxPool3DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/PReLUTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/PReLUTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/PReLUTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/PReLUTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/PermuteTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/PermuteTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/PermuteTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/PermuteTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ReLUTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ReLUTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ReLUTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ReLUTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/RepeatVectorLayerTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/RepeatVectorLayerTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/RepeatVectorLayerTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/RepeatVectorLayerTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/SoftmaxTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/SoftmaxTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/SoftmaxTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/SoftmaxTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ThresholdedReLUTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ThresholdedReLUTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ThresholdedReLUTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ThresholdedReLUTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/UpSampling1DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/UpSampling1DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/UpSampling1DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/UpSampling1DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/UpSampling2DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/UpSampling2DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/UpSampling2DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/UpSampling2DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/UpSampling3DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/UpSampling3DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/UpSampling3DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/UpSampling3DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ZeroPadding1DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ZeroPadding1DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ZeroPadding1DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ZeroPadding1DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ZeroPadding2DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ZeroPadding2DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ZeroPadding2DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ZeroPadding2DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ZeroPadding3DTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ZeroPadding3DTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ZeroPadding3DTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/ZeroPadding3DTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ReshapeTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ReshapeTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ReshapeTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/layer/reshaping/ReshapeTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/BinaryCrossEntropyTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/BinaryCrossEntropyTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/BinaryCrossEntropyTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/BinaryCrossEntropyTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/HingeTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/HingeTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/HingeTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/HingeTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/HuberTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/HuberTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/HuberTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/HuberTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/LogCoshTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/LogCoshTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/LogCoshTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/LogCoshTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MAETest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MAETest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MAETest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MAETest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MAPETest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MAPETest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MAPETest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MAPETest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MSETest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MSETest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MSETest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MSETest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MSLETest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MSLETest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MSLETest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/MSLETest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/PoissonTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/PoissonTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/PoissonTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/PoissonTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/SquaredHingeTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/SquaredHingeTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/SquaredHingeTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/loss/SquaredHingeTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/AccuracyTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/AccuracyTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/AccuracyTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/metric/AccuracyTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/ml/RegressionTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/ml/RegressionTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/ml/RegressionTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/ml/RegressionTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/models/FunctionalModelTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/models/FunctionalModelTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/models/FunctionalModelTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/models/FunctionalModelTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/models/SequentialCompilationTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/models/SequentialCompilationTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/models/SequentialCompilationTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/models/SequentialCompilationTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/summary/SummaryHelpersTests.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/summary/SummaryHelpersTests.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/summary/SummaryHelpersTests.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/summary/SummaryHelpersTests.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/util/TopologicalSortTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/util/TopologicalSortTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/util/TopologicalSortTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/core/util/TopologicalSortTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ActivationLayersImportExportTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ActivationLayersImportExportTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ActivationLayersImportExportTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ActivationLayersImportExportTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ConvolutionalLayersImportExportTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ConvolutionalLayersImportExportTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ConvolutionalLayersImportExportTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ConvolutionalLayersImportExportTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/CoreLayersImportExportTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/CoreLayersImportExportTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/CoreLayersImportExportTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/CoreLayersImportExportTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/DropoutBatchNormImportExportTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/DropoutBatchNormImportExportTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/DropoutBatchNormImportExportTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/DropoutBatchNormImportExportTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/InitializerImportExportTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/InitializerImportExportTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/InitializerImportExportTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/InitializerImportExportTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/LayerImportExportTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/LayerImportExportTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/LayerImportExportTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/LayerImportExportTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/MergeLayersImportExportTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/MergeLayersImportExportTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/MergeLayersImportExportTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/MergeLayersImportExportTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelLoaderTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelLoaderTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelLoaderTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ModelLoaderTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/PaddingConverterTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/PaddingConverterTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/PaddingConverterTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/PaddingConverterTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/PoolingLayersImportExportTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/PoolingLayersImportExportTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/PoolingLayersImportExportTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/PoolingLayersImportExportTest.kt diff --git a/api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ReshapingLayersImportExportTest.kt b/tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ReshapingLayersImportExportTest.kt similarity index 100% rename from api/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ReshapingLayersImportExportTest.kt rename to tensorflow/src/test/kotlin/org/jetbrains/kotlinx/dl/api/inference/keras/ReshapingLayersImportExportTest.kt diff --git a/api/src/test/resources/inference/keras/ModelLoader/initializer_identity.json b/tensorflow/src/test/resources/inference/keras/ModelLoader/initializer_identity.json similarity index 100% rename from api/src/test/resources/inference/keras/ModelLoader/initializer_identity.json rename to tensorflow/src/test/resources/inference/keras/ModelLoader/initializer_identity.json diff --git a/api/src/test/resources/inference/keras/ModelLoader/python/Initializer Identity Export.ipynb b/tensorflow/src/test/resources/inference/keras/ModelLoader/python/Initializer Identity Export.ipynb similarity index 100% rename from api/src/test/resources/inference/keras/ModelLoader/python/Initializer Identity Export.ipynb rename to tensorflow/src/test/resources/inference/keras/ModelLoader/python/Initializer Identity Export.ipynb diff --git a/api/src/test/resources/inference/lenet/dropout/modelConfig.json b/tensorflow/src/test/resources/inference/lenet/dropout/modelConfig.json similarity index 100% rename from api/src/test/resources/inference/lenet/dropout/modelConfig.json rename to tensorflow/src/test/resources/inference/lenet/dropout/modelConfig.json diff --git a/api/src/test/resources/inference/lenet/dropout/python/LeNet with Dropout.ipynb b/tensorflow/src/test/resources/inference/lenet/dropout/python/LeNet with Dropout.ipynb similarity index 100% rename from api/src/test/resources/inference/lenet/dropout/python/LeNet with Dropout.ipynb rename to tensorflow/src/test/resources/inference/lenet/dropout/python/LeNet with Dropout.ipynb diff --git a/api/src/test/resources/inference/lenet/dropout/weights.h5 b/tensorflow/src/test/resources/inference/lenet/dropout/weights.h5 similarity index 100% rename from api/src/test/resources/inference/lenet/dropout/weights.h5 rename to tensorflow/src/test/resources/inference/lenet/dropout/weights.h5 diff --git a/api/src/test/resources/inference/lenet/mismatchModelConfig.json b/tensorflow/src/test/resources/inference/lenet/mismatchModelConfig.json similarity index 100% rename from api/src/test/resources/inference/lenet/mismatchModelConfig.json rename to tensorflow/src/test/resources/inference/lenet/mismatchModelConfig.json diff --git a/api/src/test/resources/inference/lenet/mnist_weights_only.h5 b/tensorflow/src/test/resources/inference/lenet/mnist_weights_only.h5 similarity index 100% rename from api/src/test/resources/inference/lenet/mnist_weights_only.h5 rename to tensorflow/src/test/resources/inference/lenet/mnist_weights_only.h5 diff --git a/api/src/test/resources/inference/lenet/modelConfig.json b/tensorflow/src/test/resources/inference/lenet/modelConfig.json similarity index 100% rename from api/src/test/resources/inference/lenet/modelConfig.json rename to tensorflow/src/test/resources/inference/lenet/modelConfig.json diff --git a/api/src/test/resources/inference/lenet/python/LeNet on MNIST with different initializers.ipynb b/tensorflow/src/test/resources/inference/lenet/python/LeNet on MNIST with different initializers.ipynb similarity index 100% rename from api/src/test/resources/inference/lenet/python/LeNet on MNIST with different initializers.ipynb rename to tensorflow/src/test/resources/inference/lenet/python/LeNet on MNIST with different initializers.ipynb diff --git a/api/src/test/resources/inference/lenet/regularizers/mnist_weights_only.h5 b/tensorflow/src/test/resources/inference/lenet/regularizers/mnist_weights_only.h5 similarity index 100% rename from api/src/test/resources/inference/lenet/regularizers/mnist_weights_only.h5 rename to tensorflow/src/test/resources/inference/lenet/regularizers/mnist_weights_only.h5 diff --git a/api/src/test/resources/inference/lenet/regularizers/modelConfig.json b/tensorflow/src/test/resources/inference/lenet/regularizers/modelConfig.json similarity index 100% rename from api/src/test/resources/inference/lenet/regularizers/modelConfig.json rename to tensorflow/src/test/resources/inference/lenet/regularizers/modelConfig.json diff --git a/api/src/test/resources/inference/lenet/regularizers/python/DEMO-1 LeNet-5, MNIST to Kotlin DL with different initializers and regularizers.ipynb b/tensorflow/src/test/resources/inference/lenet/regularizers/python/DEMO-1 LeNet-5, MNIST to Kotlin DL with different initializers and regularizers.ipynb similarity index 100% rename from api/src/test/resources/inference/lenet/regularizers/python/DEMO-1 LeNet-5, MNIST to Kotlin DL with different initializers and regularizers.ipynb rename to tensorflow/src/test/resources/inference/lenet/regularizers/python/DEMO-1 LeNet-5, MNIST to Kotlin DL with different initializers and regularizers.ipynb diff --git a/api/src/test/resources/inference/lenet/unsupportedInitializers/mnist_weights_only.h5 b/tensorflow/src/test/resources/inference/lenet/unsupportedInitializers/mnist_weights_only.h5 similarity index 100% rename from api/src/test/resources/inference/lenet/unsupportedInitializers/mnist_weights_only.h5 rename to tensorflow/src/test/resources/inference/lenet/unsupportedInitializers/mnist_weights_only.h5 diff --git a/api/src/test/resources/inference/lenet/unsupportedInitializers/modelConfig.json b/tensorflow/src/test/resources/inference/lenet/unsupportedInitializers/modelConfig.json similarity index 100% rename from api/src/test/resources/inference/lenet/unsupportedInitializers/modelConfig.json rename to tensorflow/src/test/resources/inference/lenet/unsupportedInitializers/modelConfig.json diff --git a/api/src/test/resources/inference/lenet/unsupportedInitializers/python/LeNet on MNIST with different initializers (zeros).ipynb b/tensorflow/src/test/resources/inference/lenet/unsupportedInitializers/python/LeNet on MNIST with different initializers (zeros).ipynb similarity index 100% rename from api/src/test/resources/inference/lenet/unsupportedInitializers/python/LeNet on MNIST with different initializers (zeros).ipynb rename to tensorflow/src/test/resources/inference/lenet/unsupportedInitializers/python/LeNet on MNIST with different initializers (zeros).ipynb diff --git a/api/src/test/resources/inference/lenet/wrongJson/model.json b/tensorflow/src/test/resources/inference/lenet/wrongJson/model.json similarity index 100% rename from api/src/test/resources/inference/lenet/wrongJson/model.json rename to tensorflow/src/test/resources/inference/lenet/wrongJson/model.json diff --git a/api/src/test/resources/logback.xml b/tensorflow/src/test/resources/logback.xml similarity index 100% rename from api/src/test/resources/logback.xml rename to tensorflow/src/test/resources/logback.xml diff --git a/api/src/test/resources/savedmodel/Readme.md b/tensorflow/src/test/resources/savedmodel/Readme.md similarity index 100% rename from api/src/test/resources/savedmodel/Readme.md rename to tensorflow/src/test/resources/savedmodel/Readme.md diff --git a/api/src/test/resources/savedmodel/saved_model.pb b/tensorflow/src/test/resources/savedmodel/saved_model.pb similarity index 100% rename from api/src/test/resources/savedmodel/saved_model.pb rename to tensorflow/src/test/resources/savedmodel/saved_model.pb diff --git a/api/src/test/resources/savedmodel/variables/variables.data-00000-of-00001 b/tensorflow/src/test/resources/savedmodel/variables/variables.data-00000-of-00001 similarity index 100% rename from api/src/test/resources/savedmodel/variables/variables.data-00000-of-00001 rename to tensorflow/src/test/resources/savedmodel/variables/variables.data-00000-of-00001 diff --git a/api/src/test/resources/savedmodel/variables/variables.index b/tensorflow/src/test/resources/savedmodel/variables/variables.index similarity index 100% rename from api/src/test/resources/savedmodel/variables/variables.index rename to tensorflow/src/test/resources/savedmodel/variables/variables.index diff --git a/visualization/build.gradle b/visualization/build.gradle index 0e55e3c8c..367eb95df 100644 --- a/visualization/build.gradle +++ b/visualization/build.gradle @@ -3,6 +3,7 @@ project.setDescription("This module contains the Kotlin API for visualization of dependencies { implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21' api project(":api") + api project(":tensorflow") } dependencies {