Skip to content

Instantly share code, notes, and snippets.

View digantamisra98's full-sized avatar
🇩🇪
Stygian Autobahn Drift

Xa9aX ツ digantamisra98

🇩🇪
Stygian Autobahn Drift
View GitHub Profile
@digantamisra98
digantamisra98 / Mish.pdf
Last active August 19, 2019 17:24
Mish Activation Function Poster
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
'''
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
'''
Script provides functional interface for Mish activation function.
'''
# import pytorch
import torch
import torch.nn.functional as F
def mish(input):
'''
@digantamisra98
digantamisra98 / Mish_main.py
Created August 12, 2019 00:41
Basic PyTorch Sequential Model with Mish Activation Function
# 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
@digantamisra98
digantamisra98 / mish_keras.py
Created August 12, 2019 12:58
Mish Class Definition in Keras
# 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
## 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