Search in sources :

Example 1 with ReshapeLayer

use of com.simiacryptus.mindseye.layers.java.ReshapeLayer in project MindsEye by SimiaCryptus.

the class FullyConnectedLayer method explode.

/**
 * Explode pipeline network.
 *
 * @return the pipeline network
 */
@Nonnull
public Layer explode() {
    int inputVol = Tensor.length(inputDims);
    int outVol = Tensor.length(outputDims);
    @Nonnull PipelineNetwork network = new PipelineNetwork(1);
    network.wrap(new ReshapeLayer(1, 1, inputVol));
    @Nullable Tensor tensor = this.weights.reshapeCast(1, 1, inputVol * outVol);
    @Nonnull ConvolutionLayer convolutionLayer = new ConvolutionLayer(1, 1, inputVol, outVol).set(tensor).setBatchBands(getBatchBands());
    @Nonnull ExplodedConvolutionGrid grid = convolutionLayer.getExplodedNetwork();
    convolutionLayer.freeRef();
    tensor.freeRef();
    grid.add(network.getHead());
    grid.freeRef();
    network.wrap(new ReshapeLayer(outputDims));
    network.setName(getName());
    return network;
}
Also used : Tensor(com.simiacryptus.mindseye.lang.Tensor) Nonnull(javax.annotation.Nonnull) PipelineNetwork(com.simiacryptus.mindseye.network.PipelineNetwork) ReshapeLayer(com.simiacryptus.mindseye.layers.java.ReshapeLayer) Nullable(javax.annotation.Nullable) Nonnull(javax.annotation.Nonnull)

Aggregations

Tensor (com.simiacryptus.mindseye.lang.Tensor)1 ReshapeLayer (com.simiacryptus.mindseye.layers.java.ReshapeLayer)1 PipelineNetwork (com.simiacryptus.mindseye.network.PipelineNetwork)1 Nonnull (javax.annotation.Nonnull)1 Nullable (javax.annotation.Nullable)1