Skip to content

Commit 030582e

Browse files
committed
Pre-Release 1.4.2 (Beta 3)
- Refined `GenericNeuralStack` class and hierarchy
1 parent a961c69 commit 030582e

File tree

4 files changed

+5
-28
lines changed

4 files changed

+5
-28
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ packageDescription := "DynaML is a scala library/repl for implementing and worki
1212
"which can be extended easily to implement advanced models for small and large scale applications.\n\n"+
1313
"But the library can also be used as an educational/research tool for data analysis."
1414

15-
val mainVersion = "v1.4.2-beta.2"
15+
val mainVersion = "v1.4.2-beta.3"
1616

1717
val dataDirectory = settingKey[File]("The directory holding the data files for running example scripts")
1818

dynaml-core/src/main/scala-2.11/io/github/mandar2812/dynaml/models/neuralnets/GenericNeuralStack.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import scala.collection.GenTraversableLike
1212
* */
1313
class GenericNeuralStack[
1414
P, I, Layer <: NeuralLayer[P, I, I],
15-
T[Layer] <: Traversable[Layer] with GenTraversableLike[Layer, T[Layer]]
15+
T[L] <: Traversable[L] with GenTraversableLike[L, T[L]]
1616
](elements: T[Layer]) extends NeuralGraph[T[Layer], I, I] {
1717

1818
self =>
@@ -55,7 +55,7 @@ T[Layer] <: Traversable[Layer] with GenTraversableLike[Layer, T[Layer]]
5555
* */
5656
def ++[
5757
L <: NeuralLayer[P, I, I],
58-
G[L] <: Traversable[L] with GenTraversableLike[L, G[L]]](
58+
G[L1] <: Traversable[L1] with GenTraversableLike[L1, G[L1]]](
5959
otherStack: GenericNeuralStack[P, I, L, G])
6060
: GenericNeuralStack[P, I, NeuralLayer[P, I, I], T] = new GenericNeuralStack[P, I, NeuralLayer[P, I, I], T](
6161
(self.g.map((l: Layer) => l.asInstanceOf[NeuralLayer[P, I, I]]) ++

dynaml-core/src/main/scala-2.11/io/github/mandar2812/dynaml/models/neuralnets/LazyNeuralStack.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class LazyNeuralStack[P, I](elements: Stream[NeuralLayer[P, I, I]]) extends
2525
**/
2626
override def ++[
2727
L <: NeuralLayer[P, I, I],
28-
G[L] <: Traversable[L] with GenTraversableLike[L, G[L]]](
28+
G[L1] <: Traversable[L1] with GenTraversableLike[L1, G[L1]]](
2929
otherStack: GenericNeuralStack[P, I, L, G]) =
3030
new LazyNeuralStack[P, I](self.g ++ otherStack._layers.asInstanceOf[Stream[NeuralLayer[P, I, I]]])
3131

dynaml-core/src/main/scala-2.11/io/github/mandar2812/dynaml/models/neuralnets/NeuralStack.scala

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,6 @@ class NeuralStack[P, I](elements: Seq[NeuralLayer[P, I, I]])
1717

1818
val layerParameters: Seq[P] = g.map(_.parameters)
1919

20-
override def _layers = g
21-
22-
/**
23-
* Do a forward pass through the network outputting all the intermediate.
24-
* layer activations.
25-
* */
26-
override def forwardPropagate(x: I): Seq[I] = g.scanLeft(x)((h, layer) => layer.forward(h))
27-
28-
/**
29-
* Do a forward pass through the network outputting only the output layer activations.
30-
* */
31-
override val forwardPass: (I) => I = (x: I) => g.foldLeft(x)((h, layer) => layer.forward(h))
32-
33-
/**
34-
* Batch version of [[forwardPropagate()]]
35-
* */
36-
override def forwardPropagateBatch[T <: Traversable[I]](d: T): Seq[T] = g.scanLeft(d)((h, layer) => layer.forward(h))
37-
38-
/**
39-
* Batch version of [[forwardPass()]]
40-
* */
41-
override def forwardPassBatch[T <: Traversable[I]](d: T): T = g.foldLeft(d)((h, layer) => layer.forward(h))
42-
4320
/**
4421
* Slice the stack according to a range.
4522
* */
@@ -52,7 +29,7 @@ class NeuralStack[P, I](elements: Seq[NeuralLayer[P, I, I]])
5229
**/
5330
override def ++[
5431
L <: NeuralLayer[P, I, I],
55-
G[L] <: Traversable[L] with GenTraversableLike[L, G[L]]](
32+
G[L1] <: Traversable[L1] with GenTraversableLike[L1, G[L1]]](
5633
otherStack: GenericNeuralStack[P, I, L, G]) =
5734
new NeuralStack(self.g ++ otherStack._layers.asInstanceOf[Seq[NeuralLayer[P, I, I]]])
5835

0 commit comments

Comments
 (0)