Regi Mathew
Regi Mathew

Reputation: 2873

Keras specification of y

I am trying to understand the following snippets from Keras documentation. What is the logic of specifying y as Dense statement followed by '(x)'? Not sure about the purpose of this statement.

# this is a logistic regression in Keras
x = Input(shape=(32,))
y = Dense(16, activation='softmax')(x)
model = Model(x, y)

Upvotes: 0

Views: 25

Answers (1)

Dr. Snoopy
Dr. Snoopy

Reputation: 56387

It is quite simple, in this case y is the output of a Dense layer with 16 units and a softmax activation, given the input x.

This structure is meant to be functional-like, so you can specify models with multiple inputs and outputs easily in code.

Upvotes: 2

Related Questions