class_docstr: The base class for all the policies. For each different model, it should have a different policy class,
  like BertPolicy for Bert Model or OPTPolicy for OPT model.
  
  Shardformer has provided many built-in sharding policies for the mainstream models. You can use the
  built-in policies by setting `policy = None`, which is already the default argument for `Shardformer.optimize`.
  If you want to define your own policy, you can inherit from this class and overwrite the methods you want to modify.
class_docstr_tok: ["The","base","class","for","all","the","policies",".","For","each","different","model",",","it","should","have","a","different","policy","class",",","like","BertPolicy","for","Bert","Model","or","OPTPolicy","for","OPT","model",".","Shardformer","has","provided","many","built-in","sharding","policies","for","the","mainstream","models",".","You","can","use","the","built-in","policies","by","setting","`","policy","=","None","`",",","which","is","already","the","default","argument","for","`","Shardformer.optimize","`",".","If","you","want","to","define","your","own","policy",",","you","can","inherit","from","this","class","and","overwrite","the","methods","you","want","to","modify","."]
docstr: Check if the shard config is valid for the model. Raise an exception if the config is invalid.
  This method is made abstractmethod with no default implementation because we want to the policy writer
  to take note of the feature supported by his/her model and policy.
docstr_tok: ["Check","if","the","shard","config","is","valid","for","the","model",".","Raise","an","exception","if","the","config","is","invalid",".","This","method","is","made","abstractmethod","with","no","default","implementation","because","we","want","to","the","policy","writer","to","take","note","of","the","feature","supported","by","his\/her","model","and","policy","."]
code: def config_sanity_check(self):
      """
      Check if the shard config is valid for the model. Raise an exception if the config is invalid.
      This method is made abstractmethod with no default implementation because we want to the policy writer
      to take note of the feature supported by his/her model and policy.
      """
  
imports: from abc import ABC, abstractmethod
  from dataclasses import dataclass
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import numpy
  import torch.nn
  from torch import Tensor
  from torch.nn import Module
  from colossalai.pipeline.stage_manager import PipelineStageManager
  from ..layer.normalization import BaseLayerNorm
  from ..layer.parallel_module import ParallelModule
  from ..shard.shard_config import ShardConfig
label_desc: Use image node_id 5 for calling the Policy obj's underlying member method code with example usage: obj.config_sanity_check() without return types