pytorch.rb 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. module Docs
  2. class Pytorch < UrlScraper
  3. self.name = 'PyTorch'
  4. self.slug = 'pytorch'
  5. self.type = 'sphinx'
  6. self.links = {
  7. home: 'https://pytorch.org/',
  8. code: 'https://github.com/pytorch/pytorch'
  9. }
  10. html_filters.push 'pytorch/entries', 'pytorch/clean_html', 'sphinx/clean_html'
  11. options[:skip] = ['cpp_index.html', 'deploy.html', 'packages.html', 'py-modindex.html', 'genindex.html']
  12. options[:skip_patterns] = [/\Acommunity/, /\A_modules/, /\Anotes/, /\Aorg\/pytorch\//]
  13. options[:max_image_size] = 1_000_000
  14. options[:attribution] = <<-HTML
  15. &copy; 2025, PyTorch Contributors<br>
  16. PyTorch has a BSD-style license, as found in the <a href="https://github.com/pytorch/pytorch/blob/main/LICENSE">LICENSE</a> file.
  17. HTML
  18. version '2.9' do
  19. self.release = '2.9'
  20. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  21. end
  22. version '2.8' do
  23. self.release = '2.8'
  24. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  25. end
  26. version '2.7' do
  27. self.release = '2.7'
  28. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  29. end
  30. version '2.6' do
  31. self.release = '2.6'
  32. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  33. end
  34. version '2.5' do
  35. self.release = '2.5'
  36. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  37. end
  38. version '2.4' do
  39. self.release = '2.4'
  40. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  41. end
  42. version '2.3' do
  43. self.release = '2.3'
  44. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  45. end
  46. version '2.2' do
  47. self.release = '2.2'
  48. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  49. end
  50. version '2.1' do
  51. self.release = '2.1'
  52. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  53. end
  54. version '2.0' do
  55. self.release = '2.0'
  56. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  57. end
  58. version '1.13' do
  59. self.release = '1.13'
  60. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  61. end
  62. def get_latest_version(opts)
  63. get_latest_github_release('pytorch', 'pytorch', opts)
  64. end
  65. end
  66. end