LeNet

class paddle.vision.models. LeNet ( num_classes=10 ) [source]

LeNet model from “Gradient-based learning applied to document recognition”.

Parameters

num_classes (int, optional) – Output dim of last fc layer. If num_classes <= 0, last fc layer will not be defined. Default: 10.

Returns

Layer. An instance of LeNet model.

Examples

>>> import paddle
>>> from paddle.vision.models import LeNet

>>> model = LeNet()

>>> x = paddle.rand([1, 1, 28, 28])
>>> out = model(x)

>>> print(out.shape)
[1, 10]
forward ( inputs )

forward

Defines the computation performed at every call. Should be overridden by all subclasses.

Parameters
  • *inputs (tuple) – unpacked tuple arguments

  • **kwargs (dict) – unpacked dict arguments

Used in the guide/tutorials