# torch 2.15.0 (BSD-3-Clause), harvested by tools/harvest_corpus.py
=== input

    Check whether the device index of specified backend is valid

    In case of privateuse1 backend, your must first register a device_module for
    privateuse1 using torch._register_device_module. Implement the following
    methods in device_module like cuda: device_module._utils._get_device_index(location, True),
    device_module.device_count().

    Args:
        location: string of device
        backend_name: the backend name or the name of privateuse1, which can be renamed

    Returns:
        device_index: int
    
=== parse google
short_description: 'Check whether the device index of specified backend is valid'
long_description: |
  In case of privateuse1 backend, your must first register a device_module for
  privateuse1 using torch._register_device_module. Implement the following
  methods in device_module like cuda: device_module._utils._get_device_index(location, True),
  device_module.device_count().
blank_after_short_description: True
blank_after_long_description: True
style: google
- DocstringParam
  description: 'string of device'
  kind: param
  key: 'param'
  arg_name: 'location'
  is_optional: False
- DocstringParam
  description: 'the backend name or the name of privateuse1, which can be renamed'
  kind: param
  key: 'param'
  arg_name: 'backend_name'
  is_optional: False
- DocstringReturns
  description: 'int'
  kind: returns
  key: 'returns'
  type_name: 'device_index'
  is_generator: False
=== detect
google
=== compose google
Check whether the device index of specified backend is valid

In case of privateuse1 backend, your must first register a device_module for
privateuse1 using torch._register_device_module. Implement the following
methods in device_module like cuda: device_module._utils._get_device_index(location, True),
device_module.device_count().

Args:
    location: string of device
    backend_name: the backend name or the name of privateuse1, which can be renamed

Returns:
    device_index: int
