This file contains hidden or 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 tensorflow as tf | |
from tensorflow.keras.layers import Layer, Conv2D, DepthwiseConv2D, BatchNormalization | |
class InvertedResidual(Layer): | |
def __init__(self, filters, strides, expansion_factor=6, trainable=True, | |
name=None, **kwargs): | |
super(InvertedResidual, self).__init__(trainable=trainable, name=name, **kwargs) | |
self.filters = filters | |
self.strides = strides | |
self.expansion_factor = expansion_factor # allowed to be decimal value |