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
## Import Necessary Modules | |
from __future__ import print_function | |
import keras | |
from keras.layers import Dense, Conv2D, BatchNormalization, Activation | |
from keras.layers import AveragePooling2D, Input, Flatten | |
from keras.optimizers import Adam | |
from keras.callbacks import ModelCheckpoint, LearningRateScheduler | |
from keras.callbacks import ReduceLROnPlateau | |
from keras.preprocessing.image import ImageDataGenerator | |
from keras.regularizers import l2 |
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
# Keras Implementation of Mish Activation Function. | |
# Import Necessary Modules. | |
from __future__ import absolute_import | |
from __future__ import division | |
from __future__ import print_function | |
from keras.engine.base_layer import Layer | |
from keras import backend as K |
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
# Import Necessary Modules | |
from mish import Mish | |
import torch | |
from torch import nn | |
from collections import OrderedDict | |
# Initialize the activation function | |
activation_function = Mish() | |
#Define the Torch Model using nn.sequential |
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
''' | |
Script provides functional interface for Mish activation function. | |
''' | |
# import pytorch | |
import torch | |
import torch.nn.functional as F | |
def mish(input): | |
''' |
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
''' | |
Applies the mish function element-wise: | |
mish(x) = x * tanh(softplus(x)) = x * tanh(ln(1 + exp(x))) | |
''' | |
# import pytorch | |
from torch import nn | |
# import activation functions | |
import functional as Func |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.