Mlp (vision/esvit_swin_backbone.py)

OpenClaw-RL · Megatron-LM/megatron/legacy/model/vision/esvit_swin_backbone.py · python · Apache-2.0
ai, tag:knn-classified

Defines MLP and window utilities for Swin Transformer vision models.

# Source: https://github.com/Gen-Verse/OpenClaw-RL | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
# Copyright (c) 2021 Microsoft
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# --------------------------------------------------------
# Modified by Chunyuan Li (chunyl@microsoft.com)
# Swin Transformer
# --------------------------------------------------------

import os
import logging
import torch
import torch.nn as nn
import torch.nn.functional as F
from functools import partial
import torch.distributed as dist
from torch.nn.init import trunc_normal_
from megatron.legacy.model.transformer import DropPa

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key