@Override public void setNIn(InputType inputType, boolean override) { if (inputType == null || inputType.getType() != InputType.Type.RNN) { throw new IllegalStateException("Invalid input for 1D CNN layer (layer name = \"" + getLayerName() + "\"): expect RNN input type with size > 0. Got: " + inputType); } if (nIn <= 0 || override) { InputType.InputTypeRecurrent r = (InputType.InputTypeRecurrent) inputType; this.nIn = r.getSize(); } }
int tsLength = itr.getTimeSeriesLength();
break; case RNN: thisSize = ((InputType.InputTypeRecurrent) vertexInputs[i]).getSize(); type = InputType.Type.RNN; break; return InputType.feedForward(size); } else { int tsLength = ((InputType.InputTypeRecurrent) vertexInputs[0]).getTimeSeriesLength(); return InputType.recurrent(size, tsLength); return InputType.feedForward(-1); } else { int tsLength = ((InputType.InputTypeRecurrent) vertexInputs[0]).getTimeSeriesLength(); return InputType.recurrent(-1, tsLength);
break; case RNN: thisSize = ((InputType.InputTypeRecurrent) vertexInputs[i]).getSize(); type = InputType.Type.RNN; break;
break; case RNN: thisSize = ((InputType.InputTypeRecurrent) vertexInputs[i]).getSize(); tsLength = ((InputType.InputTypeRecurrent) vertexInputs[i]).getTimeSeriesLength(); type = InputType.Type.RNN; break;
break; case RNN: thisSize = ((InputType.InputTypeRecurrent) vertexInputs[i]).getSize(); type = InputType.Type.RNN; break;
break; case 2: myInputType = new InputType.InputTypeRecurrent(this.inputShape[1]); break; case 3:
if (collapseDimensions) { return InputType.feedForward(recurrent.getSize()); } else {
@Override public InputType getOutputType(int layerIndex, InputType... vertexInputs) throws InvalidInputTypeException { if (vertexInputs.length != 1) throw new InvalidInputTypeException("Invalid input type: cannot get last time step of more than 1 input"); if (vertexInputs[0].getType() != InputType.Type.RNN) { throw new InvalidInputTypeException( "Invalid input type: cannot get subset of non RNN input (got: " + vertexInputs[0] + ")"); } return InputType.feedForward(((InputType.InputTypeRecurrent) vertexInputs[0]).getSize()); }
@Override public InputType getOutputType(InputType inputType) { if (inputType == null || inputType.getType() != InputType.Type.RNN) { throw new IllegalStateException("Invalid input type: Expected input of type RNN, got " + inputType); } InputType.InputTypeRecurrent c = (InputType.InputTypeRecurrent) inputType; int expSize = inputHeight * inputWidth * numChannels; if (c.getSize() != expSize) { throw new IllegalStateException("Invalid input: expected RNN input of size " + expSize + " = (d=" + numChannels + " * w=" + inputWidth + " * h=" + inputHeight + "), got " + inputType); } return InputType.convolutional(inputHeight, inputWidth, numChannels); }
@Override public InputType getOutputType(int layerIndex, InputType inputType) { if (inputType == null || inputType.getType() != InputType.Type.RNN) { throw new IllegalStateException("Invalid input type for RnnOutputLayer (layer index = " + layerIndex + ", layer name=\"" + getLayerName() + "\"): Expected RNN input, got " + inputType); } InputType.InputTypeRecurrent itr = (InputType.InputTypeRecurrent) inputType; return InputType.recurrent(nOut, itr.getTimeSeriesLength()); }
@Override public InputType getOutputType(int layerIndex, InputType inputType) { if (inputType == null || inputType.getType() != InputType.Type.RNN) { throw new IllegalStateException("Invalid input for RNN layer (layer index = " + layerIndex + ", layer name = \"" + getLayerName() + "\"): expect RNN input type with size > 0. Got: " + inputType); } InputType.InputTypeRecurrent itr = (InputType.InputTypeRecurrent) inputType; return InputType.recurrent(nOut, itr.getTimeSeriesLength()); }
/** InputType for recurrent neural network (time series) data * @param size The size of the activations * @param timeSeriesLength Length of the input time series * @return */ public static InputType recurrent(int size, int timeSeriesLength) { return new InputTypeRecurrent(size, timeSeriesLength); }
@Override public void setNIn(InputType inputType, boolean override) { if (inputType == null || inputType.getType() != InputType.Type.RNN) { throw new IllegalStateException("Invalid input type for RnnOutputLayer (layer name=\"" + getLayerName() + "\"): Expected RNN input, got " + inputType); } if (nIn <= 0 || override) { InputType.InputTypeRecurrent r = (InputType.InputTypeRecurrent) inputType; this.nIn = r.getSize(); } }
@Override public InputType getOutputType(InputType inputType) { if (inputType == null || inputType.getType() != InputType.Type.RNN) { throw new IllegalStateException("Invalid input: expected input of type RNN, got " + inputType); } InputType.InputTypeRecurrent rnn = (InputType.InputTypeRecurrent) inputType; return InputType.feedForward(rnn.getSize()); }
/** InputType for recurrent neural network (time series) data * @param size The size of the activations * @return */ public static InputType recurrent(int size) { return new InputTypeRecurrent(size); }
@Override public void setNIn(InputType inputType, boolean override) { if (inputType == null || inputType.getType() != InputType.Type.RNN) { throw new IllegalStateException("Invalid input for RNN layer (layer name = \"" + getLayerName() + "\"): expect RNN input type with size > 0. Got: " + inputType); } if (nIn <= 0 || override) { InputType.InputTypeRecurrent r = (InputType.InputTypeRecurrent) inputType; this.nIn = r.getSize(); } }