PatchEmbed constructor

PatchEmbed({
  1. required List<int> imgSize,
  2. int patchSize = 4,
  3. int inChannels = 3,
  4. int embedDim = 128,
})

Implementation

PatchEmbed({
  required List<int> imgSize,
  this.patchSize = 4,
  this.inChannels = 3,
  this.embedDim = 128,
}) {
  proj = Conv2d(inChannels, embedDim, patchSize, stride: patchSize);
  norm = LayerNorm(embedDim);
  numPatchesH = imgSize[0] ~/ patchSize;
  numPatchesW = imgSize[1] ~/ patchSize;
}