forked from ThoughtWorksInc/DeepLearning.scala
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
140 lines (112 loc) · 4.44 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
parallelExecution in Global := false
includeFilter in unmanagedSources := (includeFilter in unmanagedSources).value && new SimpleFileFilter(_.isFile)
lazy val DeepLearning = project
lazy val `plugins-Layers` = project.dependsOn(DeepLearning, `plugins-Differentiables`)
lazy val `plugins-Weights` = project.dependsOn(DeepLearning, `plugins-Differentiables`)
lazy val `plugins-Names` = project.dependsOn(`plugins-Differentiables`)
lazy val `plugins-Logging` = project.dependsOn(`plugins-Differentiables`)
lazy val `plugins-Operators` = project
lazy val `plugins-HLists` = project.dependsOn(DeepLearning)
lazy val `plugins-Products` = project.dependsOn(`plugins-HLists`)
lazy val `plugins-FloatLiterals` = project.dependsOn(`DeepLearning`)
lazy val `plugins-FloatWeights` = project.dependsOn(`plugins-Weights`)
lazy val `plugins-FloatLayers` =
project.dependsOn(
`plugins-Layers`,
`plugins-Operators`,
`plugins-FloatLiterals` % Test
)
lazy val `plugins-CumulativeFloatLayers` =
project.dependsOn(
DeepLearning % "test->test",
`plugins-FloatLayers`,
`plugins-FloatLiterals` % Test,
`plugins-FloatWeights` % Test,
`plugins-Products` % Test
)
lazy val `plugins-TensorLiterals` = project.dependsOn(`DeepLearning`, ProjectRef(file("Compute.scala"), "Tensors"))
lazy val `plugins-TensorWeights` = project.dependsOn(`plugins-Weights`, ProjectRef(file("Compute.scala"), "Tensors"))
lazy val `plugins-TensorLayers` =
project.dependsOn(
`plugins-Layers`,
`plugins-Operators`,
`plugins-TensorWeights` % Test,
`plugins-TensorLiterals` % Test,
ProjectRef(file("Compute.scala"), "Tensors")
)
lazy val `plugins-CumulativeTensorLayers` =
project.dependsOn(
DeepLearning % "test->test",
`plugins-TensorLayers`,
`plugins-Logging` % Test,
`plugins-TensorLiterals` % Test,
`plugins-TensorWeights` % Test
)
lazy val FloatRegex = """(?i:float)""".r
def copyAndReplace(floatProject: Project) = Def.task {
for {
floatFile <- (unmanagedSources in Compile in floatProject).value
floatDirectory <- (unmanagedSourceDirectories in Compile in floatProject).value
relativeFile <- floatFile.relativeTo(floatDirectory)
} yield {
val floatSource = IO.read(floatFile, scala.io.Codec.UTF8.charSet)
val doubleSource = FloatRegex.replaceAllIn(floatSource, { m =>
m.matched match {
case "Float" => "Double"
case "float" => "double"
}
})
val outputFile = (sourceManaged in Compile).value / relativeFile.getPath
IO.write(outputFile, doubleSource, scala.io.Codec.UTF8.charSet)
outputFile
}
}
lazy val `plugins-DoubleWeights` =
project
.dependsOn(`plugins-Weights`)
.settings(sourceGenerators in Compile += copyAndReplace(`plugins-FloatWeights`).taskValue)
lazy val `plugins-DoubleLiterals` =
project
.dependsOn(`DeepLearning`)
.settings(sourceGenerators in Compile += copyAndReplace(`plugins-FloatLiterals`).taskValue)
lazy val `plugins-DoubleLayers` =
project
.dependsOn(`plugins-Layers`, `plugins-Operators`)
.settings(sourceGenerators in Compile += copyAndReplace(`plugins-FloatLayers`).taskValue)
lazy val `plugins-CumulativeDoubleLayers` =
project
.dependsOn(`plugins-DoubleLayers`, `plugins-Operators`)
.settings(sourceGenerators in Compile += copyAndReplace(`plugins-CumulativeFloatLayers`).taskValue)
lazy val `plugins-Builtins` =
project.dependsOn(
`plugins-Products`,
`plugins-HLists`,
`plugins-Layers`,
`plugins-Weights`,
`plugins-Logging`,
`plugins-Names`,
`plugins-Operators`,
`plugins-FloatLiterals`,
`plugins-FloatWeights`,
`plugins-FloatLayers`,
`plugins-CumulativeFloatLayers`,
`plugins-DoubleLiterals`,
`plugins-DoubleWeights`,
`plugins-DoubleLayers`,
`plugins-CumulativeDoubleLayers`,
`plugins-TensorLiterals`,
`plugins-TensorWeights`,
`plugins-TensorLayers`,
`plugins-CumulativeTensorLayers`,
DeepLearning % "test->test"
)
lazy val `plugins-Differentiables` = project
publishArtifact := false
enablePlugins(StandaloneUnidoc, TravisUnidocTitle)
unidocProjectFilter in ScalaUnidoc in unidoc := inAggregates(LocalRootProject)
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.3")
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)
scalacOptions += "-Xexperimental"
scalacOptions += "-Ypartial-unification"
organization in ThisBuild := "com.thoughtworks.deeplearning"
crossScalaVersions in Global := Seq("2.11.12", "2.12.4")