Skip to content

tensorflow Smish version #24

@tomaszjacek

Description

@tomaszjacek

Mr. Professor,

When I'm trying


@tf.function
def smish(input):
return input * tf.math.tanh(tf.math.log(1+tf.math.sigmoid(input)))

class Smish(layers.Layer):

def __init__(self, input):
    """
    Init method.
    """
    super().__init__()

def call(self, input):
    """
    Forward pass of the function.
    """
    return smish(input)

than in model declaration

self_conv2D_11 = Conv2D(16 , kernel_size=(3,3),strides=(1,1),padding = 'same')

activation_9 = Smish(conv2D_1)
conv2D_11 = self_conv2D_11(activation_9)

i got an error
TypeError: Inputs to a layer should be tensors. Got: <main.Smish object at 0x000001F82C4FE910>

Would you be so kind to give hint how to translate Smish to tensorflow ?

Thank you,
tj

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions