Skip to content
Nic Ma edited this page Mar 18, 2020 · 7 revisions

Layer design

This page is a work in progress. For now, please look at the layer design and layer factory design discussion pages for this topic.

Introduction

MONAI's layer design is essentially identical to pytorch, so if you are used to writing layers for pytorch you know how to write layers for MONAI. MONAI adds a single additional aspect to layer writing; the idea of layer factories so that dimension-agnostic networks can be built.

Pytorch conventions for dimensions

Pytorch appears to only have soft conventions on when a layer is dimension agnostic or not. As much as possible, MONAI adheres to these conventions:

  • Activation functions are not dimension-specific, unless they don't flatten the output
  • Convolutions are always dimension-specific
  • Pooling layers are always dimension-specific
  • Padding layers are always dimension-specific
  • Normalisation layers may be dimension-specific or dimension-agnostic
  • Recurrent layers are dimension-agnostic
Clone this wiki locally