History

Update TensorFlow docs

Lukas Geiger committed 5 years ago

Commit 7fdcee21 parent ccd20c04 files · +60 −71Browse files

Unified · Split

4 files
  1. lib/docs/filters/tensorflow/clean_html.rb +1 −1
  2. lib/docs/filters/tensorflow/entries.rb +52 −44
  3. lib/docs/scrapers/tensorflow/tensorflow.rb +5 −15
  4. lib/docs/scrapers/tensorflow/tensorflow_cpp.rb +2 −11
lib/docs/filters/tensorflow/clean_html.rb+1−1
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
2 class Tensorflow2 class Tensorflow
3 class CleanHtmlFilter < Filter3 class CleanHtmlFilter < Filter
4 def call4 def call
5 @doc = at_css('.devsite-article-inner')5 @doc = at_css('.devsite-article')
6 6
7 css('hr', '.devsite-nav', '.devsite-content-footer', '.devsite-article-body > br', '.devsite-article-meta', 'devsite-nav-buttons', '.devsite-banner', '.tfo-api img', '.tfo-notebook-buttons img', '.tfo-notebook-buttons>:first-child').remove7 css('hr', '.devsite-nav', '.devsite-content-footer', '.devsite-article-body > br', '.devsite-article-meta', 'devsite-nav-buttons', '.devsite-banner', '.tfo-api img', '.tfo-notebook-buttons img', '.tfo-notebook-buttons>:first-child').remove
8 8
lib/docs/filters/tensorflow/entries.rb+52−44
@@ -15,93 +15,101 @@ module Docs · 14 unmodified lines
15 end15 end
16 16
17 def get_type17 def get_type
18 if slug.start_with?('tf/audio')18 if slug.start_with?('audio')
19 'tf.audio'19 'tf.audio'
20 elsif slug.start_with?('tf/autograph')20 elsif slug.start_with?('autodiff')
21 'tf.autodiff'
22 elsif slug.start_with?('autograph')
21 'tf.autograph'23 'tf.autograph'
22 elsif slug.start_with?('tf/bitwise')24 elsif slug.start_with?('bitwise')
23 'tf.bitwise'25 'tf.bitwise'
24 elsif slug.start_with?('tf/compat')26 elsif slug.start_with?('compat')
25 'tf.compat'27 'tf.compat'
26 elsif slug.start_with?('tf/config')28 elsif slug.start_with?('config')
27 'tf.config'29 'tf.config'
28 elsif slug.start_with?('tf/data')30 elsif slug.start_with?('data')
29 'tf.data'31 'tf.data'
30 elsif slug.start_with?('tf/debugging')32 elsif slug.start_with?('debugging')
31 'tf.debugging'33 'tf.debugging'
32 elsif slug.start_with?('tf/distribute')34 elsif slug.start_with?('distribute')
33 'tf.distribute'35 'tf.distribute'
34 elsif slug.start_with?('tf/dtypes')36 elsif slug.start_with?('dtypes')
35 'tf.dtypes'37 'tf.dtypes'
36 elsif slug.start_with?('tf/errors')38 elsif slug.start_with?('errors')
37 'tf.errors'39 'tf.errors'
38 elsif slug.start_with?('tf/estimator')40 elsif slug.start_with?('estimator')
39 'tf.estimator'41 'tf.estimator'
40 elsif slug.start_with?('tf/experimental')42 elsif slug.start_with?('experimental')
41 'tf.experimental'43 'tf.experimental'
42 elsif slug.start_with?('tf/feature_column')44 elsif slug.start_with?('feature_column')
43 'tf.feature_column'45 'tf.feature_column'
44 elsif slug.start_with?('tf/graph_util')46 elsif slug.start_with?('graph_util')
45 'tf.graph_util'47 'tf.graph_util'
46 elsif slug.start_with?('tf/image')48 elsif slug.start_with?('image')
47 'tf.image'49 'tf.image'
48 elsif slug.start_with?('tf/initializers')50 elsif slug.start_with?('initializers')
49 'tf.initializers'51 'tf.initializers'
50 elsif slug.start_with?('tf/io')52 elsif slug.start_with?('io')
51 'tf.io'53 'tf.io'
52 elsif slug.start_with?('tf/keras')54 elsif slug.start_with?('keras')
53 'tf.keras'55 'tf.keras'
54 elsif slug.start_with?('tf/linalg')56 elsif slug.start_with?('linalg')
55 'tf.linalg'57 'tf.linalg'
56 elsif slug.start_with?('tf/lite')58 elsif slug.start_with?('lite')
57 'tf.lite'59 'tf.lite'
58 elsif slug.start_with?('tf/lookup')60 elsif slug.start_with?('lookup')
59 'tf.lookup'61 'tf.lookup'
60 elsif slug.start_with?('tf/losses')62 elsif slug.start_with?('losses')
61 'tf.losses'63 'tf.losses'
62 elsif slug.start_with?('tf/math')64 elsif slug.start_with?('math')
63 'tf.math'65 'tf.math'
64 elsif slug.start_with?('tf/metrics')66 elsif slug.start_with?('metrics')
65 'tf.metrics'67 'tf.metrics'
66 elsif slug.start_with?('tf/nest')68 elsif slug.start_with?('mixed_precision')
69 'tf.mixed_precision'
70 elsif slug.start_with?('mlir')
71 'tf.mlir'
72 elsif slug.start_with?('nest')
67 'tf.nest'73 'tf.nest'
68 elsif slug.start_with?('tf/nn')74 elsif slug.start_with?('nn')
69 'tf.nn'75 'tf.nn'
70 elsif slug.start_with?('tf/optimizers')76 elsif slug.start_with?('optimizers')
71 'tf.optimizers'77 'tf.optimizers'
72 elsif slug.start_with?('tf/quantization')78 elsif slug.start_with?('profiler')
79 'tf.profiler'
80 elsif slug.start_with?('quantization')
73 'tf.quantization'81 'tf.quantization'
74 elsif slug.start_with?('tf/queue')82 elsif slug.start_with?('queue')
75 'tf.queue'83 'tf.queue'
76 elsif slug.start_with?('tf/ragged')84 elsif slug.start_with?('ragged')
77 'tf.ragged'85 'tf.ragged'
78 elsif slug.start_with?('tf/random')86 elsif slug.start_with?('random')
79 'tf.random'87 'tf.random'
80 elsif slug.start_with?('tf/raw_ops')88 elsif slug.start_with?('raw_ops')
81 'tf.raw_ops'89 'tf.raw_ops'
82 elsif slug.start_with?('tf/saved_model')90 elsif slug.start_with?('saved_model')
83 'tf.saved_model'91 'tf.saved_model'
84 elsif slug.start_with?('tf/sets')92 elsif slug.start_with?('sets')
85 'tf.sets'93 'tf.sets'
86 elsif slug.start_with?('tf/signal')94 elsif slug.start_with?('signal')
87 'tf.signal'95 'tf.signal'
88 elsif slug.start_with?('tf/sparse')96 elsif slug.start_with?('sparse')
89 'tf.sparse'97 'tf.sparse'
90 elsif slug.start_with?('tf/strings')98 elsif slug.start_with?('strings')
91 'tf.strings'99 'tf.strings'
92 elsif slug.start_with?('tf/summary')100 elsif slug.start_with?('summary')
93 'tf.summary'101 'tf.summary'
94 elsif slug.start_with?('tf/sysconfig')102 elsif slug.start_with?('sysconfig')
95 'tf.sysconfig'103 'tf.sysconfig'
96 elsif slug.start_with?('tf/test')104 elsif slug.start_with?('test')
97 'tf.test'105 'tf.test'
98 elsif slug.start_with?('tf/tpu')106 elsif slug.start_with?('tpu')
99 'tf.tpu'107 'tf.tpu'
100 elsif slug.start_with?('tf/train')108 elsif slug.start_with?('train')
101 'tf.train'109 'tf.train'
102 elsif slug.start_with?('tf/version')110 elsif slug.start_with?('version')
103 'tf.version'111 'tf.version'
104 elsif slug.start_with?('tf/xla')112 elsif slug.start_with?('xla')
105 'tf.xla'113 'tf.xla'
106 else114 else
107 'tf'115 'tf'
lib/docs/scrapers/tensorflow/tensorflow.rb+5−15
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
2 class Tensorflow < UrlScraper2 class Tensorflow < UrlScraper
3 self.name = 'TensorFlow'3 self.name = 'TensorFlow'
4 self.type = 'tensorflow'4 self.type = 'tensorflow'
5 self.root_path = 'index.html'5 self.root_path = 'all_symbols'
6 self.links = {6 self.links = {
7 home: 'https://www.tensorflow.org/',7 home: 'https://www.tensorflow.org/',
8 code: 'https://github.com/tensorflow/tensorflow'8 code: 'https://github.com/tensorflow/tensorflow'
@@ -14,24 +14,14 @@ module Docs · 5 unmodified lines
14 options[:container] = '.devsite-main-content'14 options[:container] = '.devsite-main-content'
15 15
16 options[:attribution] = <<-HTML16 options[:attribution] = <<-HTML
17 &copy; 2019 The TensorFlow Authors. All rights reserved.<br>17 &copy; 2020 The TensorFlow Authors. All rights reserved.<br>
18 Licensed under the Creative Commons Attribution License 3.0.<br>18 Licensed under the Creative Commons Attribution License 3.0.<br>
19 Code samples licensed under the Apache 2.0 License.19 Code samples licensed under the Apache 2.0 License.
20 HTML20 HTML
21 21
22 version '2.1' do22 for version in ['2.3', '2.2', '2.1', '2.0', '1.15'] do
23 self.release = '2.1.0'23 self.release = version + '.0'
24 self.base_url = "https://www.tensorflow.org/versions/r#{version}/api_docs/python"24 self.base_url = "https://www.tensorflow.org/versions/r#{version}/api_docs/python/tf"
25 end
26
27 version '2.0' do
28 self.release = '2.0.0'
29 self.base_url = "https://www.tensorflow.org/versions/r#{version}/api_docs/python"
30 end
31
32 version '1.15' do
33 self.release = '1.15.0'
34 self.base_url = "https://www.tensorflow.org/versions/r#{version}/api_docs/python"
35 end25 end
36 26
37 def get_latest_version(opts)27 def get_latest_version(opts)
lib/docs/scrapers/tensorflow/tensorflow_cpp.rb+2−11
@@ -3,19 +3,10 @@ module Docs · 2 unmodified lines
3 self.name = 'TensorFlow C++'3 self.name = 'TensorFlow C++'
4 self.slug = 'tensorflow_cpp'4 self.slug = 'tensorflow_cpp'
5 5
6 version '2.1' do6 for version in ['2.3', '2.2', '2.1', '2.0', '1.15'] do
7 self.release = '2.1.0'7 self.release = version + '.0'
8 self.base_url = "https://www.tensorflow.org/versions/r#{version}/api_docs/cc"8 self.base_url = "https://www.tensorflow.org/versions/r#{version}/api_docs/cc"
9 end9 end
10 10
11 version '2.0' do
12 self.release = '2.0.0'
13 self.base_url = "https://www.tensorflow.org/versions/r#{version}/api_docs/cc"
14 end
15
16 version '1.15' do
17 self.release = '1.15.0'
18 self.base_url = "https://www.tensorflow.org/versions/r#{version}/api_docs/cc"
19 end
20 end11 end
21end12end