parameters: (code: CodeType)
return_statement: return not any(_startswith(filename, lib_path) for lib_path in LIB_PATHS)
docstring: Custom CodeFilter for Torchscript to trace forward calls.
      The custom CodeFilter is required while scripting a FX Traced forward calls.
      FX Traced forward calls have `code.co_filename` start with '<' which is used
      to exclude tracing of stdlib and site-packages in the default code filter.
      Since we need all forward calls to be traced, this custom code filter
      checks for code.co_name to be 'forward' and enables tracing for all such calls.
      The code filter is similar to default code filter for monkeytype and
      excludes tracing of stdlib and site-packages.
docstring_summary: Custom CodeFilter for Torchscript to trace forward calls.
      The custom CodeFilter is required while scripting a FX Traced forward calls.
      FX Traced forward calls have `code.co_filename` start with '<' which is used
      to exclude tracing of stdlib and site-packages in the default code filter.
      Since we need all forward calls to be traced, this custom code filter
      checks for code.co_name to be 'forward' and enables tracing for all such calls.
      The code filter is similar to default code filter for monkeytype and
      excludes tracing of stdlib and site-packages.
docstring_tokens: Custom CodeFilter for Torchscript to trace forward calls . The custom CodeFilter is required while scripting a FX Traced forward calls . FX Traced forward calls have code . co_filename start with < which is used to exclude tracing of stdlib and site - packages in the default code filter . Since we need all forward calls to be traced this custom code filter checks for code . co_name to be forward and enables tracing for all such calls . The code filter is similar to default code filter for monkeytype and excludes tracing of stdlib and site - packages .
function: def jit_code_filter(code: CodeType) -> bool:
      """
      Custom CodeFilter for Torchscript to trace forward calls.
      The custom CodeFilter is required while scripting a FX Traced forward calls.
      FX Traced forward calls have `code.co_filename` start with '<' which is used
      to exclude tracing of stdlib and site-packages in the default code filter.
      Since we need all forward calls to be traced, this custom code filter
      checks for code.co_name to be 'forward' and enables tracing for all such calls.
      The code filter is similar to default code filter for monkeytype and
      excludes tracing of stdlib and site-packages.
      """
      # Filter code without a source file and exclude this check for 'forward' calls.
      if code.co_name != 'forward' and (not code.co_filename or code.co_filename[0] == '<'):
          return False
  
      filename = pathlib.Path(code.co_filename).resolve()
      return not any(_startswith(filename, lib_path) for lib_path in LIB_PATHS)
function_tokens: def jit_code_filter ( code : CodeType ) -> bool : # Filter code without a source file and exclude this check for 'forward' calls. if code . co_name != 'forward' and ( not code . co_filename or code . co_filename [ 0 ] == '<' ) : return False filename = pathlib . Path ( code . co_filename ) . resolve ( ) return not any ( _startswith ( filename , lib_path ) for lib_path in LIB_PATHS )