class_docstr: Where ``i = 1 ... C``, if ``x_i > 0``, return ``x_i`` , otherwise return ``alpha_i * x_i``.
  
  Parameters
  ----------
  x: tensor<[B, C, 1..3], T> (Required)
      * ``x`` must have rank 4, rank 3, or rank 5; that is, a shape of
        ``(B,C,H)``, ``(B,C,H,W)``, or ``(B,C,D,H,W)``.
  alpha: const tensor<[C], T>, (Required)
      * The length of ``alpha`` must match the second dimension of ``x`` (channel dimension).
  
  Returns
  -------
  tensor<[B, C, 1..3], T>
      * A tensor of the same shape as ``x``.
  
  Attributes
  ----------
  T: fp32, fp16
class_docstr_tok: ["Where","``","i","=","1","...","C","``",",","if","``","x_i",">","0","``",",","return","``","x_i","``",",","otherwise","return","``","alpha_i","*","x_i","``",".","Parameters","--","--","--","--","--","x",":","tensor","<","[","B",",","C",",","1","..","3","]",",","T",">","(","Required",")","*","``","x","``","must","have","rank","4",",","rank","3",",","or","rank","5",";","that","is",",","a","shape","of","``","(","B",",","C",",","H",")","``",",","``","(","B",",","C",",","H",",","W",")","``",",","or","``","(","B",",","C",",","D",",","H",",","W",")","``",".","alpha",":","const","tensor","<","[","C","]",",","T",">",",","(","Required",")","*","The","length","of","``","alpha","``","must","match","the","second","dimension","of","``","x","``","(","channel","dimension",")",".","Returns","--","--","--","-","tensor","<","[","B",",","C",",","1","..","3","]",",","T",">","*","A","tensor","of","the","same","shape","as","``","x","``",".","Attributes","--","--","--","--","--","T",":","fp32",",","fp16"]
code: def type_inference(self):
      if self.x.rank not in (3, 4, 5):
          raise ValueError(
              "prelu op: x must be rank 3 or 4 or 5, instead it is of rank {}".format(
                  len(self.x.shape)
              )
          )
      if len(self.alpha.val.shape) != 1:
          raise ValueError("alpha should be rank 1")
      if self.x.shape[1] != self.alpha.val.shape[0]:
          raise ValueError(
              f"Size of dimension 0 of alpha ({self.alpha.val.shape[0]}) should be "
              f"the same as the size of dimension 1 of x ({self.x.shape[1]})."
          )
      if self.x.rank in (3, 5):
          # check whether all alpha values are the same or not
          are_values_same = (
              np.where(
                  np.abs(self.alpha.val - self.alpha.val[0]) > 1e-5
              )[0].size
              == 0
          )
          if not are_values_same:
              raise ValueError(
                  "prelu op: rank 3 or rank 5 input is only supported when all the values of alpha are same,"
                  "which is not the case here"
              )
      return self.x.sym_type
  
imports: import math
  import numpy
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.mil.input_type import DefaultInputs, InputSpec, TensorInputType
  from coremltools.converters.mil.mil.operation import VALUE, Operation, precondition
  from coremltools.converters.mil.mil.ops.defs._op_reqs import register_op
  from .elementwise_unary import elementwise_unary
label_desc: Use image node_id 2 for calling the prelu obj's underlying member method code with example usage: obj.type_inference() and returns: self