• Docs >
  • Module code >
  • mmedit.models.backbones.encoder_decoders.simple_encoder_decoder
Shortcuts

Note

You are reading the documentation for MMEditing 0.x, which will soon be deprecated by the end of 2022. We recommend you upgrade to MMEditing 1.0 to enjoy fruitful new features and better performance brought by OpenMMLab 2.0. Check out the changelog, code and documentation of MMEditing 1.0 for more details.

Source code for mmedit.models.backbones.encoder_decoders.simple_encoder_decoder

# Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn

from mmedit.models.builder import build_component
from mmedit.models.registry import BACKBONES


[docs]@BACKBONES.register_module() class SimpleEncoderDecoder(nn.Module): """Simple encoder-decoder model from matting. Args: encoder (dict): Config of the encoder. decoder (dict): Config of the decoder. """ def __init__(self, encoder, decoder): super().__init__() self.encoder = build_component(encoder) if hasattr(self.encoder, 'out_channels'): decoder['in_channels'] = self.encoder.out_channels self.decoder = build_component(decoder) def init_weights(self, pretrained=None): self.encoder.init_weights(pretrained) self.decoder.init_weights()
[docs] def forward(self, *args, **kwargs): """Forward function. Returns: Tensor: The output tensor of the decoder. """ out = self.encoder(*args, **kwargs) out = self.decoder(out) return out
Read the Docs v: latest
Versions
latest
stable
1.x
v0.16.0
v0.15.2
v0.15.1
v0.15.0
v0.14.0
v0.13.0
v0.12.0
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.