public static int [ ] getInputShapeFromConfig ( Map < String , Object > layerConfig , KerasLayerConfiguration conf ) throws InvalidKerasConfigurationException { // TODO: validate this. shouldn't we also have INPUT_SHAPE checked? Map < String , Object > innerConfig = KerasLayerUtils . getInnerLayerConfigFromConfig ( layerConfig , conf ) ; if ( ! innerConfig . containsKey ( conf . getLAYER_FIELD_BATCH_INPUT_SHAPE ( ) ) ) return null ; List < Integer > batchInputShape = ( List < Integer > ) innerConfig . get ( conf . getLAYER_FIELD_BATCH_INPUT_SHAPE ( ) ) ; int [ ] inputShape = new int [ batchInputShape . size ( ) - 1 ] ; for ( int i = 1 ; i < batchInputShape . size ( ) ; i ++ ) { inputShape [ i - 1 ] = batchInputShape . get ( i ) != null ? batchInputShape . get ( i ) : 0 ; } return inputShape ; }
Get Keras input shape from Keras layer configuration .