class_docstr: Reference S3 model data created by KNN estimator.
  
  Calling :meth:`~sagemaker.model.Model.deploy` creates an Endpoint
  and returns :class:`KNNPredictor`.
class_docstr_tok: ["Reference","S3","model","data","created","by","KNN","estimator",".","Calling",":","meth",":","`","~sagemaker.model.Model.deploy","`","creates","an","Endpoint","and","returns",":","class",":","`","KNNPredictor","`","."]
docstr: Function to initialize KNNModel.
  
  Args:
      model_data (str or PipelineVariable): The S3 location of a SageMaker model data
          ``.tar.gz`` file.
      role (str): An AWS IAM role (either name or full ARN). The Amazon
          SageMaker training jobs and APIs that create Amazon SageMaker
          endpoints use this role to access training data and model
          artifacts. After the endpoint is created, the inference code
          might use the IAM role, if it needs to access an AWS resource.
      sagemaker_session (sagemaker.session.Session): Session object which
          manages interactions with Amazon SageMaker APIs and any other
          AWS services needed. If not specified, the estimator creates one
          using the default AWS configuration chain.
      **kwargs: Keyword arguments passed to the ``FrameworkModel``
          initializer.
docstr_tok: ["Function","to","initialize","KNNModel",".","Args",":","model_data","(","str","or","PipelineVariable",")",":","The","S3","location","of","a","SageMaker","model","data","``",".tar.gz","``","file",".","role","(","str",")",":","An","AWS","IAM","role","(","either","name","or","full","ARN",")",".","The","Amazon","SageMaker","training","jobs","and","APIs","that","create","Amazon","SageMaker","endpoints","use","this","role","to","access","training","data","and","model","artifacts",".","After","the","endpoint","is","created",",","the","inference","code","might","use","the","IAM","role",",","if","it","needs","to","access","an","AWS","resource",".","sagemaker_session","(","sagemaker.session.Session",")",":","Session","object","which","manages","interactions","with","Amazon","SageMaker","APIs","and","any","other","AWS","services","needed",".","If","not","specified",",","the","estimator","creates","one","using","the","default","AWS","configuration","chain",".","*","*","kwargs",":","Keyword","arguments","passed","to","the","``","FrameworkModel","``","initializer","."]
code: def __init__(
      self,
      model_data: Union[str, PipelineVariable],
      role: Optional[str] = None,
      sagemaker_session: Optional[Session] = None,
      **kwargs,
  ):
      """Function to initialize KNNModel.
  
      Args:
          model_data (str or PipelineVariable): The S3 location of a SageMaker model data
              ``.tar.gz`` file.
          role (str): An AWS IAM role (either name or full ARN). The Amazon
              SageMaker training jobs and APIs that create Amazon SageMaker
              endpoints use this role to access training data and model
              artifacts. After the endpoint is created, the inference code
              might use the IAM role, if it needs to access an AWS resource.
          sagemaker_session (sagemaker.session.Session): Session object which
              manages interactions with Amazon SageMaker APIs and any other
              AWS services needed. If not specified, the estimator creates one
              using the default AWS configuration chain.
          **kwargs: Keyword arguments passed to the ``FrameworkModel``
              initializer.
      """
      sagemaker_session = sagemaker_session or Session()
      image_uri = image_uris.retrieve(
          KNN.repo_name,
          sagemaker_session.boto_region_name,
          version=KNN.repo_version,
      )
      pop_out_unused_kwarg(
          "predictor_cls", kwargs, KNNPredictor.__name__
      )
      pop_out_unused_kwarg("image_uri", kwargs, image_uri)
      super(KNNModel, self).__init__(
          image_uri,
          model_data,
          role,
          predictor_cls=KNNPredictor,
          sagemaker_session=sagemaker_session,
          **kwargs,
      )
  
imports: from __future__ import absolute_import
  from typing import Union, Optional
  from sagemaker import image_uris
  from sagemaker.amazon.amazon_estimator import AmazonAlgorithmEstimatorBase
  from sagemaker.amazon.common import RecordSerializer, RecordDeserializer
  from sagemaker.amazon.hyperparameter import Hyperparameter
  from sagemaker.amazon.validation import ge, isin
  from sagemaker.predictor import Predictor
  from sagemaker.model import Model
  from sagemaker.session import Session
  from sagemaker.utils import pop_out_unused_kwarg
  from sagemaker.vpc_utils import VPC_CONFIG_DEFAULT
  from sagemaker.workflow.entities import PipelineVariable
label_desc: Use image node_id 1 to create a new KNNModel object from inherited base classes: Model with example: obj = KNNModel(model_data, role, sagemaker_session)