You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classFlatten(Layer):
"""Flattens the input. Does not affect the batch size. # Example ```python model = Sequential() model.add(Convolution2D(64, 3, 3, border_mode='same', input_shape=(3, 32, 32))) # now: model.output_shape == (None, 64, 32, 32) model.add(Flatten()) # now: model.output_shape == (None, 65536) ``` """def__init__(self, **kwargs):
super(Flatten, self).__init__(**kwargs)
self.input_spec=InputSpec(min_ndim=3)
defcompute_output_shape(self, input_shape):
ifnotall(input_shape[1:]):
raiseValueError('The shape of the input to "Flatten" ''is not fully defined ''(got '+str(input_shape[1:]) +'. ''Make sure to pass a complete "input_shape" ''or "batch_input_shape" argument to the first ''layer in your model.')
return (input_shape[0], np.prod(input_shape[1:]))
defcall(self, inputs):
returnK.batch_flatten(inputs)
into C# using the same K backend already present in Keras Sharp.
The text was updated successfully, but these errors were encountered:
Updates GH-6: Implement the Flatten layer
Updates GH-5: Implement the Conv2D layer
Updates GH-4: Make the first example for the Sequential model pass
Updates GH-1: Contributing to Keras-Sharp
Note: Implementing the Flatten layer does not actually involve implement it from scratch.
What needs to be done is to navigate to https://github.com/fchollet/keras/tree/f65a56fb65062c8d14d215c9f4b1015b97cc5bf3/keras, find where the Flatten layer is implemented (in this case, core.py, line 452), and port its arguably simple code:
into C# using the same K backend already present in Keras Sharp.
The text was updated successfully, but these errors were encountered: