This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Main extends App { | |
val zooModel: VGG16 = new VGG16() | |
val net: Model = zooModel.initPretrained(PretrainedType.IMAGENET) | |
val netAsCompGraph = net.asInstanceOf[ComputationGraph] | |
println(netAsCompGraph.summary()) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The output with cuDNN gpu backend is (for one channel, but the others are equal): | |
[[[[55.00, 82.00, 109.00, 136.00, 163.00, 190.00, 217.00, 244.00, 271.00, 298.00, 325.00, 352.00], | |
[82.00, 109.00, 136.00, 163.00, 190.00, 217.00, 244.00, 271.00, 298.00, 325.00, 352.00, 379.00], | |
[109.00, 136.00, 163.00, 190.00, 217.00, 244.00, 271.00, 298.00, 325.00, 352.00, 379.00, 406.00], | |
[136.00, 163.00, 190.00, 217.00, 244.00, 271.00, 298.00, 325.00, 352.00, 379.00, 406.00, 433.00], | |
[163.00, 190.00, 217.00, 244.00, 271.00, 298.00, 325.00, 352.00, 379.00, 406.00, 433.00, 460.00], | |
[190.00, 217.00, 244.00, 271.00, 298.00, 325.00, 352.00, 379.00, 406.00, 433.00, 460.00, 487.00], | |
[217.00, 244.00, 271.00, 298.00, 325.00, 352.00, 379.00, 406.00, 433.00, 460.00, 487.00, 514.00], | |
[244.00, 271.00, 298.00, 325.00, 352.00, 379.00, 406.00, 433.00, 460.00, 487.00, 514.00, 541.00], | |
[271.00, 298.00, 325.00, 35 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object cuDNNAtrousTest extends App { | |
val height = 24 | |
val width = 24 | |
val depth = 3 | |
var img = Nd4j.ones(1, depth, height, width) | |
for (i <- 0 until depth) { | |
for (j <- 0 until height) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val height = 8 | |
val width = 8 | |
val depth = 3 | |
var img = Nd4j.ones(1, depth, height, width) | |
for (i <- 0 until depth) { | |
for (j <- 0 until height) { | |
for (k <- 0 until width) { | |
img.put(Array(NDArrayIndex.point(0), NDArrayIndex.point(i), NDArrayIndex.point(j), NDArrayIndex.point(k)), j+k) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Exception in thread "main" java.lang.NoSuchMethodError: org.nd4j.linalg.learning.config.IUpdater.applySchedules(ID)V | |
at org.deeplearning4j.nn.conf.layers.LayerValidation.updaterValidation(LayerValidation.java:85) | |
at org.deeplearning4j.nn.conf.layers.LayerValidation.updaterValidation(LayerValidation.java:35) | |
at org.deeplearning4j.nn.conf.NeuralNetConfiguration$Builder.copyConfigToLayer(NeuralNetConfiguration.java:1378) | |
at org.deeplearning4j.nn.conf.NeuralNetConfiguration$Builder.configureLayer(NeuralNetConfiguration.java:1318) | |
at org.deeplearning4j.nn.conf.NeuralNetConfiguration$Builder.build(NeuralNetConfiguration.java:1301) | |
at org.deeplearning4j.nn.conf.ComputationGraphConfiguration$GraphBuilder.addLayer(ComputationGraphConfiguration.java:652) | |
at org.deeplearning4j.nn.conf.ComputationGraphConfiguration$GraphBuilder.addLayer(ComputationGraphConfiguration.java:636) | |
at org.deeplearning4j.nn.modelimport.keras.KerasModel.getComputationGraphConfiguration(KerasModel.java:322) | |
at org.deeplearning4j.nn.model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public INDArray getActivation(INDArray in, boolean training) { | |
switch (in.rank()){ | |
case 2: | |
Nd4j.getExecutioner().execAndReturn(new SoftMax(in)); | |
return in; | |
case 3: | |
//TODO We should consider the problem of selecting a different dimension as candidate for the softmax op | |
INDArray partial_result = Nd4j.zeros(in.shape()[0], in.shape()[2]); | |
for (int ind = 0; ind < in.shape()[1]; ind++ ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object TestSoftmaxActivation extends App { | |
val height = 5 | |
val width = 5 | |
val depth = 3 | |
//var img = Nd4j.ones(1, depth, height, width) | |
var array = Array(3.87, -0.31, -0.22, -0.42, -0.01, 5.79, -0.66, -0.20, -0.80, -0.03, 9.78, -0.23, -0.37, -0.51, -0.47, 5.76, -0.09, 0.40, -0.96, -0.78, -0.47, 4.05, -0.44, -0.37, -0.22, -0.14, -0.34, -0.62, 0.31, 9.78, 0.17, 0.50, -0.37, 0.02, -0.26, -0.61, 0.18, 0.03, 0.67, 9.78, -0.50, -0.62, 3.95, -0.71, -0.51, 0.07, -0.58, 9.78, -0.45, 0.12, 9.78, 0.31, 0.42, -0.27, 9.78, -0.42, -0.78, 0.56, -0.06, 9.78, -0.84, -0.41, -0.62, 4.03, -0.56, -0.29, -0.46, 0.06, 9.78, -0.27, 0.17, -1.04, -0.03, -0.48, -0.38) | |
println(array.length) | |
var img = Nd4j.create(Array(depth, height, width), array) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = np.array([[[2, 3, 1, 0, 10], [4, 5, 6, 7, 11], [8, 9, 10, 11, 12]], [[2, 3, 1, 0, 13], [4, 5, 6, 7, 14], [8, 9, 10, 12, 15]], [[2, 3, 1, 0, 16], [4, 5, 6, 7, 17], [8, 9, 10, 13, 18]]]) | |
threshold = 0.5 | |
w = np.random.rand(3, 3, 5) | |
mask2 = w > threshold | |
print(x) | |
print(mask2) | |
x = x[mask2] | |
print(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"class_name": "Model", | |
"config": { | |
"input_layers": [ | |
[ | |
"input_1", | |
0, | |
0 | |
] | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HDF5-DIAG: Error detected in HDF5 (1.10.0-patch1) thread 0: | |
#000: H5G.c line 474 in H5Gopen2(): unable to open group | |
major: Symbol table | |
minor: Can't open object | |
#001: H5Gint.c line 289 in H5G__open_name(): group not found | |
major: Symbol table | |
minor: Object not found | |
#002: H5Gloc.c line 430 in H5G_loc_find(): can't find object | |
major: Symbol table | |
minor: Object not found |
NewerOlder