-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #156 from Aydinhamedi/Alpha-b
Alpha b
- Loading branch information
Showing
3 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from tensorflow.keras import layers, backend | ||
|
||
class FixedDropout(layers.Dropout): | ||
def _get_noise_shape(self, inputs): | ||
if self.noise_shape is None: | ||
return self.noise_shape | ||
|
||
symbolic_shape = backend.shape(inputs) | ||
noise_shape = [symbolic_shape[axis] if shape is None else shape | ||
for axis, shape in enumerate(self.noise_shape)] | ||
return tuple(noise_shape) | ||
|
||
def get_config(self): | ||
config = super().get_config() | ||
return config | ||
|
||
@classmethod | ||
def from_config(cls, config): | ||
return cls(**config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters