class_docstr: Class implementing the GEMM strategy in PyTorch for tree-base models.
docstr: Args:
      tree_parameters: The parameters defining the tree structure
      n_features: The number of features input to the model
      classes: The classes used for classification. None if implementing a regression model
      n_classes: The total number of used classes
docstr_tok: ["Args",":","tree_parameters",":","The","parameters","defining","the","tree","structure","n_features",":","The","number","of","features","input","to","the","model","classes",":","The","classes","used","for","classification",".","None","if","implementing","a","regression","model","n_classes",":","The","total","number","of","used","classes"]
code: def __init__(
      self,
      logical_operator,
      tree_parameters,
      n_features,
      classes,
      n_classes=None,
      extra_config={},
      **kwargs,
  ):
      """
      Args:
          tree_parameters: The parameters defining the tree structure
          n_features: The number of features input to the model
          classes: The classes used for classification. None if implementing a regression model
          n_classes: The total number of used classes
      """
      # If n_classes is not provided we induce it from tree parameters. Multioutput regression targets are also treated as separate classes.
      n_classes = (
          n_classes
          if n_classes is not None
          else tree_parameters[0][0][2].shape[0]
      )
      super(GEMMTreeImpl, self).__init__(
          logical_operator,
          tree_parameters,
          n_features,
          classes,
          n_classes,
          extra_config=extra_config,
          **kwargs,
      )
  
      # Initialize the actual model.
      hidden_one_size = 0
      hidden_two_size = 0
      hidden_three_size = self.n_classes
  
      for weight, bias in tree_parameters:
          hidden_one_size = max(hidden_one_size, weight[0].shape[0])
          hidden_two_size = max(hidden_two_size, weight[1].shape[0])
  
      n_trees = len(tree_parameters)
      weight_1 = np.zeros((n_trees, hidden_one_size, n_features))
      bias_1 = np.zeros((n_trees, hidden_one_size), dtype=np.float64)
      weight_2 = np.zeros((n_trees, hidden_two_size, hidden_one_size))
      bias_2 = np.zeros((n_trees, hidden_two_size))
      weight_3 = np.zeros(
          (n_trees, hidden_three_size, hidden_two_size),
          dtype=np.float64,
      )
  
      for i, (weight, bias) in enumerate(tree_parameters):
          if len(weight[0]) > 0:
              weight_1[
                  i, 0 : weight[0].shape[0], 0 : weight[0].shape[1]
              ] = weight[0]
              bias_1[i, 0 : bias[0].shape[0]] = bias[0]
              weight_2[
                  i, 0 : weight[1].shape[0], 0 : weight[1].shape[1]
              ] = weight[1]
              bias_2[i, 0 : bias[1].shape[0]] = bias[1]
              weight_3[
                  i, 0 : weight[2].shape[0], 0 : weight[2].shape[1]
              ] = weight[2]
  
      self.n_trees = n_trees
      self.n_features = n_features
      self.hidden_one_size = hidden_one_size
      self.hidden_two_size = hidden_two_size
      self.hidden_three_size = hidden_three_size
  
      self.weight_1 = torch.nn.Parameter(
          torch.from_numpy(
              weight_1.reshape(-1, self.n_features).astype("float32")
          )
          .detach()
          .clone()
      )
      self.bias_1 = torch.nn.Parameter(
          torch.from_numpy(
              bias_1.reshape(-1, 1).astype(self.tree_op_precision_dtype)
          )
          .detach()
          .clone()
      )
  
      self.weight_2 = torch.nn.Parameter(
          torch.from_numpy(weight_2.astype("float32")).detach().clone()
      )
      self.bias_2 = torch.nn.Parameter(
          torch.from_numpy(bias_2.reshape(-1, 1).astype("float32"))
          .detach()
          .clone()
      )
  
      self.weight_3 = torch.nn.Parameter(
          torch.from_numpy(
              weight_3.astype(self.tree_op_precision_dtype)
          )
          .detach()
          .clone()
      )
  
imports: from abc import abstractmethod
  from enum import Enum
  import numpy
  import torch
  from .None import constants
  from ._physical_operator import PhysicalOperator
  from .None import _tree_commons
label_desc: Use image node_id 1 to create a new GEMMTreeImpl object from inherited base classes: AbstractPyTorchTreeImpl with example: obj = GEMMTreeImpl(logical_operator, tree_parameters, n_features, classes, n_classes, extra_config)