All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.deeplearning4j.arbiter.layers.Bidirectional Maven / Gradle / Ivy

There is a newer version: 1.0.0-beta7
Show newest version
package org.deeplearning4j.arbiter.layers;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.deeplearning4j.arbiter.optimize.api.ParameterSpace;
import org.deeplearning4j.nn.conf.layers.Layer;

import java.util.List;

/**
 * Bidirectional layer wrapper. Can be used wrap an existing layer space, in the same way that
 * {@link org.deeplearning4j.nn.conf.layers.recurrent.Bidirectional} wraps a DL4J layer
 *
 * @author Alex Black
 */
@NoArgsConstructor  //JSON
@Data
public class Bidirectional extends LayerSpace {

    protected LayerSpace layerSpace;

    public Bidirectional(LayerSpace layerSpace){
        this.layerSpace = layerSpace;
    }

    @Override
    public Layer getValue(double[] parameterValues) {
        Layer underlying = layerSpace.getValue(parameterValues);
        return new org.deeplearning4j.nn.conf.layers.recurrent.Bidirectional(underlying);
    }

    @Override
    public int numParameters() {
        return layerSpace.numParameters();
    }

    @Override
    public List collectLeaves() {
        return layerSpace.collectLeaves();
    }

    @Override
    public boolean isLeaf() {
        return layerSpace.isLeaf();
    }

    @Override
    public void setIndices(int... indices) {
        layerSpace.setIndices(indices);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy