class_docstr: The MatMulHandler is a node handler which handles the sharding strategy generation for the matmul operation.
  According to https://pytorch.org/docs/stable/generated/torch.matmul.html, the operations will vary depending on
  the operands.
class_docstr_tok: ["The","MatMulHandler","is","a","node","handler","which","handles","the","sharding","strategy","generation","for","the","matmul","operation",".","According","to","https",":","\/\/pytorch.org\/docs\/stable\/generated\/torch.matmul.html",",","the","operations","will","vary","depending","on","the","operands","."]
docstr: We need to handle the input tensor for a matrix-matrix multiplication as the input
  tensor can be a 1D or 2D tensor. If it is a 1D tensor, 1 will be prepended to its shape
  (e.g. [4] -> [1, 4]).
docstr_tok: ["We","need","to","handle","the","input","tensor","for","a","matrix-matrix","multiplication","as","the","input","tensor","can","be","a","1D","or","2D","tensor",".","If","it","is","a","1D","tensor",",","1","will","be","prepended","to","its","shape","(","e.g",".","[","4","]","-",">","[","1",",","4","]",")","."]
code: def _get_logical_shape_for_mm(self):
      """
      We need to handle the input tensor for a matrix-matrix multiplication as the input
      tensor can be a 1D or 2D tensor. If it is a 1D tensor, 1 will be prepended to its shape
      (e.g. [4] -> [1, 4]).
      """
      if self.input_meta_data.dim() == 1:
          input_logical_shape = [1] + list(self.input_meta_data.shape)
          input_logical_shape = torch.Size(input_logical_shape)
      else:
          input_logical_shape = None
      return input_logical_shape, None, None
  
imports: import operator
  from abc import ABC, abstractmethod
  from copy import deepcopy
  from enum import Enum
  from functools import reduce
  from typing import Dict, List, Union
  import torch
  from colossalai.auto_parallel.tensor_shard.utils.broadcast import BroadcastType, get_broadcast_dim_info, get_broadcast_shape
  from colossalai.tensor.sharding_spec import ShardingSpecException
  from ..sharding_strategy import OperationData, OperationDataType, ShardingStrategy
  from ..utils import recover_sharding_spec_for_broadcast_shape
  from .node_handler import MetaInfoNodeHandler
  from .registry import operator_registry
  from .strategy import BatchedMatMulStrategyGenerator, DotProductStrategyGenerator, LinearProjectionStrategyGenerator, MatVecStrategyGenerator, StrategyGenerator
label_desc: Use image node_id 6 for calling the MatMulHandler obj's underlying member method code with example usage: obj._get_logical_shape_for_mm() and returns: input_logical_shape,  None,  None