Skip to content

Commit 578c04e

Browse files
committed
[LAYERS] Import new files from 0.7.2
1 parent fe2937d commit 578c04e

File tree

12 files changed

+436
-0
lines changed

12 files changed

+436
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package io.brunk.tfjs.layers.backend
2+
3+
import scala.scalajs.js
4+
import js.annotation._
5+
import js.|
6+
7+
8+
@js.native
9+
@JSGlobalScope
10+
object State extends js.Object {
11+
def getNextUniqueTensorId(): Double = js.native
12+
def getUid(prefix: String = ???): String = js.native
13+
def getScalar(value: Double, dtype: DataType = ???): Scalar = js.native
14+
def disposeScalarCache(): Unit = js.native
15+
}
16+
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
package io.brunk.tfjs.layers
2+
3+
import scala.scalajs.js
4+
import js.annotation._
5+
import js.|
6+
7+
8+
@js.native
9+
@JSGlobal
10+
abstract class BaseCallback extends js.Object {
11+
var validationData: Tensor | js.Array[Tensor] = js.native
12+
var params: Params = js.native
13+
def setParams(params: Params): Unit = js.native
14+
def onEpochBegin(epoch: Double, logs: UnresolvedLogs = ???): Promise[Unit] = js.native
15+
def onEpochEnd(epoch: Double, logs: UnresolvedLogs = ???): Promise[Unit] = js.native
16+
def onBatchBegin(batch: Double, logs: UnresolvedLogs = ???): Promise[Unit] = js.native
17+
def onBatchEnd(batch: Double, logs: UnresolvedLogs = ???): Promise[Unit] = js.native
18+
def onTrainBegin(logs: UnresolvedLogs = ???): Promise[Unit] = js.native
19+
def onTrainEnd(logs: UnresolvedLogs = ???): Promise[Unit] = js.native
20+
def setModel(model: Container): Unit = js.native
21+
}
22+
23+
@js.native
24+
@JSGlobal
25+
class CallbackList protected () extends js.Object {
26+
def this(callbacks: js.Array[BaseCallback] = ???, queueLength: Double = ???) = this()
27+
var callbacks: js.Array[BaseCallback] = js.native
28+
var queueLength: Double = js.native
29+
def append(callback: BaseCallback): Unit = js.native
30+
def setParams(params: Params): Unit = js.native
31+
def setModel(model: Container): Unit = js.native
32+
def onEpochBegin(epoch: Double, logs: UnresolvedLogs = ???): Promise[Unit] = js.native
33+
def onEpochEnd(epoch: Double, logs: UnresolvedLogs = ???): Promise[Unit] = js.native
34+
def onBatchBegin(batch: Double, logs: UnresolvedLogs = ???): Promise[Unit] = js.native
35+
def onBatchEnd(batch: Double, logs: UnresolvedLogs = ???): Promise[Unit] = js.native
36+
def onTrainBegin(logs: UnresolvedLogs = ???): Promise[Unit] = js.native
37+
def onTrainEnd(logs: UnresolvedLogs = ???): Promise[Unit] = js.native
38+
}
39+
40+
@js.native
41+
@JSGlobal
42+
class BaseLogger extends BaseCallback {
43+
def onEpochBegin(epoch: Double, logs: UnresolvedLogs = ???): Promise[Unit] = js.native
44+
def onBatchEnd(batch: Double, logs: UnresolvedLogs = ???): Promise[Unit] = js.native
45+
def onEpochEnd(epoch: Double, logs: UnresolvedLogs = ???): Promise[Unit] = js.native
46+
}
47+
48+
@js.native
49+
@JSGlobal
50+
class History extends BaseCallback {
51+
var epoch: js.Array[Double] = js.native
52+
var history: History.History = js.native
53+
def onTrainBegin(logs: UnresolvedLogs = ???): Promise[Unit] = js.native
54+
def onEpochEnd(epoch: Double, logs: UnresolvedLogs = ???): Promise[Unit] = js.native
55+
def syncData(): Promise[Unit] = js.native
56+
}
57+
58+
object History {
59+
60+
@js.native
61+
trait History extends js.Object {
62+
@JSBracketAccess
63+
def apply(key: String): js.Array[Double | Tensor] = js.native
64+
@JSBracketAccess
65+
def update(key: String, v: js.Array[Double | Tensor]): Unit = js.native
66+
}
67+
}
68+
69+
@js.native
70+
trait CustomCallbackConfig extends js.Object {
71+
var onTrainBegin: js.Function1[Logs, Promise[Unit]] = js.native
72+
var onTrainEnd: js.Function1[Logs, Promise[Unit]] = js.native
73+
var onEpochBegin: js.Function2[Double, Logs, Promise[Unit]] = js.native
74+
var onEpochEnd: js.Function2[Double, Logs, Promise[Unit]] = js.native
75+
var onBatchBegin: js.Function2[Double, Logs, Promise[Unit]] = js.native
76+
var onBatchEnd: js.Function2[Double, Logs, Promise[Unit]] = js.native
77+
}
78+
79+
@js.native
80+
@JSGlobal
81+
class CustomCallback protected () extends BaseCallback {
82+
def this(config: CustomCallbackConfig) = this()
83+
protected def trainBegin: js.Function1[Logs, Promise[Unit]] = js.native
84+
protected def trainEnd: js.Function1[Logs, Promise[Unit]] = js.native
85+
protected def epochBegin: js.Function2[Double, Logs, Promise[Unit]] = js.native
86+
protected def epochEnd: js.Function2[Double, Logs, Promise[Unit]] = js.native
87+
protected def batchBegin: js.Function2[Double, Logs, Promise[Unit]] = js.native
88+
protected def batchEnd: js.Function2[Double, Logs, Promise[Unit]] = js.native
89+
def onEpochBegin(epoch: Double, logs: UnresolvedLogs = ???): Promise[Unit] = js.native
90+
def onEpochEnd(epoch: Double, logs: UnresolvedLogs = ???): Promise[Unit] = js.native
91+
def onBatchBegin(batch: Double, logs: UnresolvedLogs = ???): Promise[Unit] = js.native
92+
def onBatchEnd(batch: Double, logs: UnresolvedLogs = ???): Promise[Unit] = js.native
93+
def onTrainBegin(logs: UnresolvedLogs = ???): Promise[Unit] = js.native
94+
def onTrainEnd(logs: UnresolvedLogs = ???): Promise[Unit] = js.native
95+
}
96+
97+
@js.native
98+
@JSGlobalScope
99+
object Base_callbacks extends js.Object {
100+
type Params = js.Dictionary[Double | String | Boolean | js.Array[Double] | js.Array[String] | js.Array[Boolean]]
101+
def standardizeCallbacks(callbacks: BaseCallback | js.Array[BaseCallback] | CustomCallbackConfig | js.Array[CustomCallbackConfig]): js.Array[BaseCallback] = js.native
102+
}
103+
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
package io.brunk.tfjs.layers.engine
2+
3+
import scala.scalajs.js
4+
import js.annotation._
5+
import js.|
6+
7+
8+
@js.native
9+
trait ContainerConfig extends js.Object {
10+
var inputs: SymbolicTensor | js.Array[SymbolicTensor] = js.native
11+
var outputs: SymbolicTensor | js.Array[SymbolicTensor] = js.native
12+
var name: String = js.native
13+
}
14+
15+
@js.native
16+
@JSGlobal
17+
abstract class Container protected () extends Layer {
18+
def this(config: ContainerConfig) = this()
19+
var inputs: js.Array[SymbolicTensor] = js.native
20+
var outputs: js.Array[SymbolicTensor] = js.native
21+
var inputLayers: js.Array[Layer] = js.native
22+
var inputLayersNodeIndices: js.Array[Double] = js.native
23+
var inputLayersTensorIndices: js.Array[Double] = js.native
24+
var outputLayers: js.Array[Layer] = js.native
25+
var outputLayersNodeIndices: js.Array[Double] = js.native
26+
var outputLayersTensorIndices: js.Array[Double] = js.native
27+
var layers: js.Array[Layer] = js.native
28+
var layersByDepth: Container.LayersByDepth = js.native
29+
var nodesByDepth: Container.NodesByDepth = js.native
30+
var containerNodes: Set[String] = js.native
31+
var inputNames: js.Array[String] = js.native
32+
var outputNames: js.Array[String] = js.native
33+
var feedInputShapes: js.Array[Shape] = js.native
34+
protected var internalInputShapes: js.Array[Shape] = js.native
35+
protected var internalOutputShapes: js.Array[Shape] = js.native
36+
protected var feedInputNames: js.Array[String] = js.native
37+
protected var feedOutputNames: js.Array[String] = js.native
38+
def trainableWeights: js.Array[LayerVariable] = js.native
39+
def nonTrainableWeights: js.Array[LayerVariable] = js.native
40+
def weights: js.Array[LayerVariable] = js.native
41+
def loadWeights(weightsJSON: JsonDict | NamedTensorMap, skipMismatch: Boolean = ???, isNamedTensorMap: Boolean = ???): Unit = js.native
42+
def toJSON(unused: js.Any = ???, returnString: Boolean = ???): String | JsonDict = js.native
43+
def call(inputs: Tensor | js.Array[Tensor], kwargs: Kwargs): Tensor | js.Array[Tensor] = js.native
44+
def computeMask(inputs: Tensor | js.Array[Tensor], mask: Tensor | js.Array[Tensor] = ???): Tensor | js.Array[Tensor] = js.native
45+
def computeOutputShape(inputShape: Shape | js.Array[Shape]): Shape | js.Array[Shape] = js.native
46+
def runInternalGraph(inputs: js.Array[Tensor], masks: js.Array[Tensor] = ???): js.Tuple3[js.Array[Tensor], js.Array[Tensor], js.Array[Shape]] = js.native
47+
def getLayer(name: String = ???, index: Double = ???): Layer = js.native
48+
def calculateLosses(): js.Array[Scalar] = js.native
49+
def getConfig(): serialization.ConfigDict = js.native
50+
def stateful: Boolean = js.native
51+
}
52+
53+
object Container {
54+
55+
@js.native
56+
trait LayersByDepth extends js.Object {
57+
@JSBracketAccess
58+
def apply(depth: String): js.Array[Layer] = js.native
59+
@JSBracketAccess
60+
def update(depth: String, v: js.Array[Layer]): Unit = js.native
61+
}
62+
63+
@js.native
64+
trait NodesByDepth extends js.Object {
65+
@JSBracketAccess
66+
def apply(depth: String): js.Array[Node] = js.native
67+
@JSBracketAccess
68+
def update(depth: String, v: js.Array[Node]): Unit = js.native
69+
}
70+
def fromConfig[T <: serialization.Serializable](cls: serialization.SerializableConstructor[T], config: serialization.ConfigDict): T = js.native
71+
}
72+
73+
@js.native
74+
@JSGlobalScope
75+
object Container extends js.Object {
76+
def loadWeightsFromJson(weightsJSON: JsonDict, layers: js.Array[Layer], skipMismatch: Boolean = ???): Unit = js.native
77+
def loadWeightsFromNamedTensorMap(weights: NamedTensorMap, layers: js.Array[Layer]): Unit = js.native
78+
}
79+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package io.brunk.tfjs.layers.engine
2+
3+
import scala.scalajs.js
4+
import js.annotation._
5+
import js.|
6+
7+
8+
@js.native
9+
trait InputLayerConfig extends js.Object {
10+
var inputShape: Shape = js.native
11+
var batchSize: Double = js.native
12+
var batchInputShape: Shape = js.native
13+
var dtype: DataType = js.native
14+
var sparse: Boolean = js.native
15+
var name: String = js.native
16+
}
17+
18+
@js.native
19+
@JSGlobal
20+
class InputLayer protected () extends Layer {
21+
def this(config: InputLayerConfig) = this()
22+
var sparse: Boolean = js.native
23+
@JSName("apply")
24+
def apply(inputs: Tensor | js.Array[Tensor] | SymbolicTensor | js.Array[SymbolicTensor], kwargs: Kwargs = ???): Tensor | js.Array[Tensor] | SymbolicTensor = js.native
25+
def getConfig(): serialization.ConfigDict = js.native
26+
}
27+
28+
@js.native
29+
@JSGlobal
30+
object InputLayer extends js.Object {
31+
def className: String = js.native
32+
}
33+
34+
@js.native
35+
trait InputConfig extends js.Object {
36+
var shape: Shape = js.native
37+
var batchShape: Shape = js.native
38+
var name: String = js.native
39+
var dtype: DataType = js.native
40+
var sparse: Boolean = js.native
41+
}
42+
43+
@js.native
44+
@JSGlobalScope
45+
object Input_layer extends js.Object {
46+
def Input(config: InputConfig): SymbolicTensor = js.native
47+
}
48+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package io.brunk.tfjs.layers
2+
3+
import scala.scalajs.js
4+
import js.annotation._
5+
import js.|
6+
7+
8+
@js.native
9+
@JSGlobalScope
10+
object Exports_constraints extends js.Object {
11+
def maxNorm(config: MaxNormConfig): Constraint = js.native
12+
def unitNorm(config: UnitNormConfig): Constraint = js.native
13+
def nonNeg(): Constraint = js.native
14+
def minMaxNorm(config: MinMaxNormConfig): Constraint = js.native
15+
}
16+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package io.brunk.tfjs.layers
2+
3+
import scala.scalajs.js
4+
import js.annotation._
5+
import js.|
6+
7+
8+
@js.native
9+
@JSGlobalScope
10+
object Exports_initializers extends js.Object {
11+
def zeros(): Zeros = js.native
12+
def ones(): Initializer = js.native
13+
def constant(config: ConstantConfig): Initializer = js.native
14+
def randomUniform(config: RandomUniformConfig): Initializer = js.native
15+
def randomNormal(config: RandomNormalConfig): Initializer = js.native
16+
def truncatedNormal(config: TruncatedNormalConfig): Initializer = js.native
17+
def identity(config: IdentityConfig): Initializer = js.native
18+
def varianceScaling(config: VarianceScalingConfig): Initializer = js.native
19+
def glorotUniform(config: SeedOnlyInitializerConfig): Initializer = js.native
20+
def glorotNormal(config: SeedOnlyInitializerConfig): Initializer = js.native
21+
def heNormal(config: SeedOnlyInitializerConfig): Initializer = js.native
22+
def leCunNormal(config: SeedOnlyInitializerConfig): Initializer = js.native
23+
def orthogonal(config: OrthogonalConfig): Initializer = js.native
24+
}
25+
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package io.brunk.tfjs.layers
2+
3+
import scala.scalajs.js
4+
import js.annotation._
5+
import js.|
6+
7+
8+
@js.native
9+
@JSGlobalScope
10+
object Exports_layers extends js.Object {
11+
def inputLayer(config: InputLayerConfig): Layer = js.native
12+
def elu(config: ELULayerConfig = ???): Layer = js.native
13+
def leakyReLU(config: LeakyReLULayerConfig = ???): Layer = js.native
14+
def softmax(config: SoftmaxLayerConfig = ???): Layer = js.native
15+
def thresholdedReLU(config: ThresholdedReLULayerConfig = ???): Layer = js.native
16+
def conv1d(config: ConvLayerConfig): Layer = js.native
17+
def conv2d(config: ConvLayerConfig): Layer = js.native
18+
def conv2dTranspose(config: ConvLayerConfig): Layer = js.native
19+
def separableConv2d(config: SeparableConvLayerConfig): Layer = js.native
20+
def cropping2D(config: Cropping2DLayerConfig): Layer = js.native
21+
def upSampling2d(config: UpSampling2DLayerConfig): Layer = js.native
22+
def depthwiseConv2d(config: DepthwiseConv2DLayerConfig): Layer = js.native
23+
def activation(config: ActivationLayerConfig): Layer = js.native
24+
def dense(config: DenseLayerConfig): Layer = js.native
25+
def dropout(config: DropoutLayerConfig): Layer = js.native
26+
def flatten(config: LayerConfig = ???): Layer = js.native
27+
def repeatVector(config: RepeatVectorLayerConfig): Layer = js.native
28+
def reshape(config: ReshapeLayerConfig): Layer = js.native
29+
def embedding(config: EmbeddingLayerConfig): Layer = js.native
30+
def add(config: LayerConfig = ???): Layer = js.native
31+
def average(config: LayerConfig = ???): Layer = js.native
32+
def concatenate(config: ConcatenateLayerConfig = ???): Layer = js.native
33+
def maximum(config: LayerConfig = ???): Layer = js.native
34+
def minimum(config: LayerConfig = ???): Layer = js.native
35+
def multiply(config: LayerConfig = ???): Layer = js.native
36+
def batchNormalization(config: BatchNormalizationLayerConfig): Layer = js.native
37+
def zeroPadding2d(config: ZeroPadding2DLayerConfig = ???): Layer = js.native
38+
def averagePooling1d(config: Pooling1DLayerConfig): Layer = js.native
39+
def avgPool1d(config: Pooling1DLayerConfig): Layer = js.native
40+
def avgPooling1d(config: Pooling1DLayerConfig): Layer = js.native
41+
def averagePooling2d(config: Pooling2DLayerConfig): Layer = js.native
42+
def avgPool2d(config: Pooling2DLayerConfig): Layer = js.native
43+
def avgPooling2d(config: Pooling2DLayerConfig): Layer = js.native
44+
def globalAveragePooling1d(config: LayerConfig): Layer = js.native
45+
def globalAveragePooling2d(config: GlobalPooling2DLayerConfig): Layer = js.native
46+
def globalMaxPooling1d(config: LayerConfig): Layer = js.native
47+
def globalMaxPooling2d(config: GlobalPooling2DLayerConfig): Layer = js.native
48+
def maxPooling1d(config: Pooling1DLayerConfig): Layer = js.native
49+
def maxPooling2d(config: Pooling2DLayerConfig): Layer = js.native
50+
def gru(config: GRULayerConfig): Layer = js.native
51+
def gruCell(config: GRUCellLayerConfig): RNNCell = js.native
52+
def lstm(config: LSTMLayerConfig): Layer = js.native
53+
def lstmCell(config: LSTMCellLayerConfig): RNNCell = js.native
54+
def simpleRNN(config: SimpleRNNLayerConfig): Layer = js.native
55+
def simpleRNNCell(config: SimpleRNNCellLayerConfig): RNNCell = js.native
56+
def rnn(config: RNNLayerConfig): Layer = js.native
57+
def stackedRNNCells(config: StackedRNNCellsConfig): RNNCell = js.native
58+
def bidirectional(config: BidirectionalLayerConfig): Wrapper = js.native
59+
def timeDistributed(config: WrapperLayerConfig): Layer = js.native
60+
val globalMaxPool1d: globalMaxPooling1d.type = js.native
61+
val globalMaxPool2d: globalMaxPooling2d.type = js.native
62+
val maxPool1d: maxPooling1d.type = js.native
63+
val maxPool2d: maxPooling2d.type = js.native
64+
}
65+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package io.brunk.tfjs.layers
2+
3+
import scala.scalajs.js
4+
import js.annotation._
5+
import js.|
6+
7+
8+
@js.native
9+
@JSGlobalScope
10+
object Exports_metrics extends js.Object {
11+
def binaryAccuracy(yTrue: Tensor, yPred: Tensor): Tensor = js.native
12+
def binaryCrossentropy(yTrue: Tensor, yPred: Tensor): Tensor = js.native
13+
def categoricalAccuracy(yTrue: Tensor, yPred: Tensor): Tensor = js.native
14+
def categoricalCrossentropy(yTrue: Tensor, yPred: Tensor): Tensor = js.native
15+
def cosineProximity(yTrue: Tensor, yPred: Tensor): Tensor = js.native
16+
def meanAbsoluteError(yTrue: Tensor, yPred: Tensor): Tensor = js.native
17+
def meanAbsolutePercentageError(yTrue: Tensor, yPred: Tensor): Tensor = js.native
18+
def MAPE(yTrue: Tensor, yPred: Tensor): Tensor = js.native
19+
def mape(yTrue: Tensor, yPred: Tensor): Tensor = js.native
20+
def meanSquaredError(yTrue: Tensor, yPred: Tensor): Tensor = js.native
21+
def MSE(yTrue: Tensor, yPred: Tensor): Tensor = js.native
22+
def mse(yTrue: Tensor, yPred: Tensor): Tensor = js.native
23+
}
24+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package io.brunk.tfjs.layers
2+
3+
import scala.scalajs.js
4+
import js.annotation._
5+
import js.|
6+
7+
8+
@js.native
9+
@JSGlobalScope
10+
object Exports_regularizers extends js.Object {
11+
def l1l2(config: L1L2Config = ???): Regularizer = js.native
12+
def l1(config: L1Config = ???): Regularizer = js.native
13+
def l2(config: L2Config = ???): Regularizer = js.native
14+
}
15+

0 commit comments

Comments
 (0)