code: def add_tensor_as_parameter(pb, tensor):
      
      p = pb.parameter.add()
      p.variable_name = tensor.name
      p.shape.dim.extend(tensor.dims)
      if tensor.data_type == TensorProto.FLOAT:
          # convert raw bytestream to floating points
          if tensor.raw_data:
              p.data.extend(np.fromstring(tensor.raw_data, dtype=np.float32))
          elif len(tensor.float_data) > 0:
              p.data.extend(tensor.float_data)
          else:
              raise ValueError("float data not found for {}".format(tensor.name))
      elif tensor.data_type == TensorProto.INT32:
          # convert raw bytestream to integer
          if tensor.raw_data:
              p.data.extend(np.fromstring(tensor.raw_data, dtype=np.int32))
          elif len(tensor.int32_data) > 0:
              p.data.extend(tensor.int32_data)
          else:
              raise ValueError("int32 data not found for {}".format(tensor.name))
      elif tensor.data_type == TensorProto.INT64:
          # convert raw bytestream to integer
          if tensor.raw_data:
              p.data.extend(np.fromstring(tensor.raw_data, dtype=np.int64))
          elif len(tensor.int64_data) > 0:
              p.data.extend(tensor.int64_data)
          else:
              raise ValueError("int64 data not found for {}".format(tensor.name))
      elif tensor.data_type == TensorProto.BOOL:
          if tensor.raw_data:
              p.data.extend(np.fromstring(tensor.raw_data, dtype=np.bool))
          else:
              raise ValueError("bool data not found for {}".format(tensor.name))
  
      else:
          raise ValueError("Unsupported tensor data type for {}: {}"
                           .format(tensor.name, tensor.data_type))
      p.need_grad = False
docs: Add given tensor as a parameter