Merge pull request #1165 from lgeiger/tensorflow-versions

Split Tensorflow into separate Python and C++ docs
This commit is contained in:
Simon Legner 2020-11-17 07:47:39 +01:00 committed by GitHub
commit 9ad20cbc46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 86 additions and 65 deletions

View file

@ -1,4 +1,8 @@
[
[
"2020-11-17",
"TensorFlow has been split into <a href=\"/tensorflow/\">TensorFlow Python</a>, <a href=\"/tensorflow_cpp/\">TensorFlow C++</a>"
],
[
"2020-11-14",
"Newly added documentations: <a href=\"/pytorch/\">PyTorch</a>, <a href=\"/spring_boot/\">Spring Boot</a>"

View file

@ -2,9 +2,9 @@ module Docs
class Tensorflow
class CleanHtmlFilter < Filter
def call
@doc = at_css('.devsite-article-inner')
@doc = at_css('.devsite-article')
css('hr', '.devsite-nav', '.devsite-content-footer', '.devsite-article-body > br', '.devsite-article-meta', 'devsite-nav-buttons', '.devsite-banner', '.tfo-api img').remove
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
css('aside.note').each do |node|
node.name = 'blockquote'

View file

@ -15,97 +15,101 @@ module Docs
end
def get_type
if version == 'Guide' and base_url.path.start_with?('/guide')
'Guides'
elsif version == 'Guide' and base_url.path.start_with?('/tutorials')
'Tutorials'
elsif slug.start_with?('tf/audio')
if slug.start_with?('audio')
'tf.audio'
elsif slug.start_with?('tf/autograph')
elsif slug.start_with?('autodiff')
'tf.autodiff'
elsif slug.start_with?('autograph')
'tf.autograph'
elsif slug.start_with?('tf/bitwise')
elsif slug.start_with?('bitwise')
'tf.bitwise'
elsif slug.start_with?('tf/compat')
elsif slug.start_with?('compat')
'tf.compat'
elsif slug.start_with?('tf/config')
elsif slug.start_with?('config')
'tf.config'
elsif slug.start_with?('tf/data')
elsif slug.start_with?('data')
'tf.data'
elsif slug.start_with?('tf/debugging')
elsif slug.start_with?('debugging')
'tf.debugging'
elsif slug.start_with?('tf/distribute')
elsif slug.start_with?('distribute')
'tf.distribute'
elsif slug.start_with?('tf/dtypes')
elsif slug.start_with?('dtypes')
'tf.dtypes'
elsif slug.start_with?('tf/errors')
elsif slug.start_with?('errors')
'tf.errors'
elsif slug.start_with?('tf/estimator')
elsif slug.start_with?('estimator')
'tf.estimator'
elsif slug.start_with?('tf/experimental')
elsif slug.start_with?('experimental')
'tf.experimental'
elsif slug.start_with?('tf/feature_column')
elsif slug.start_with?('feature_column')
'tf.feature_column'
elsif slug.start_with?('tf/graph_util')
elsif slug.start_with?('graph_util')
'tf.graph_util'
elsif slug.start_with?('tf/image')
elsif slug.start_with?('image')
'tf.image'
elsif slug.start_with?('tf/initializers')
elsif slug.start_with?('initializers')
'tf.initializers'
elsif slug.start_with?('tf/io')
elsif slug.start_with?('io')
'tf.io'
elsif slug.start_with?('tf/keras')
elsif slug.start_with?('keras')
'tf.keras'
elsif slug.start_with?('tf/linalg')
elsif slug.start_with?('linalg')
'tf.linalg'
elsif slug.start_with?('tf/lite')
elsif slug.start_with?('lite')
'tf.lite'
elsif slug.start_with?('tf/lookup')
elsif slug.start_with?('lookup')
'tf.lookup'
elsif slug.start_with?('tf/losses')
elsif slug.start_with?('losses')
'tf.losses'
elsif slug.start_with?('tf/math')
elsif slug.start_with?('math')
'tf.math'
elsif slug.start_with?('tf/metrics')
elsif slug.start_with?('metrics')
'tf.metrics'
elsif slug.start_with?('tf/nest')
elsif slug.start_with?('mixed_precision')
'tf.mixed_precision'
elsif slug.start_with?('mlir')
'tf.mlir'
elsif slug.start_with?('nest')
'tf.nest'
elsif slug.start_with?('tf/nn')
elsif slug.start_with?('nn')
'tf.nn'
elsif slug.start_with?('tf/optimizers')
elsif slug.start_with?('optimizers')
'tf.optimizers'
elsif slug.start_with?('tf/quantization')
elsif slug.start_with?('profiler')
'tf.profiler'
elsif slug.start_with?('quantization')
'tf.quantization'
elsif slug.start_with?('tf/queue')
elsif slug.start_with?('queue')
'tf.queue'
elsif slug.start_with?('tf/ragged')
elsif slug.start_with?('ragged')
'tf.ragged'
elsif slug.start_with?('tf/random')
elsif slug.start_with?('random')
'tf.random'
elsif slug.start_with?('tf/raw_ops')
elsif slug.start_with?('raw_ops')
'tf.raw_ops'
elsif slug.start_with?('tf/saved_model')
elsif slug.start_with?('saved_model')
'tf.saved_model'
elsif slug.start_with?('tf/sets')
elsif slug.start_with?('sets')
'tf.sets'
elsif slug.start_with?('tf/signal')
elsif slug.start_with?('signal')
'tf.signal'
elsif slug.start_with?('tf/sparse')
elsif slug.start_with?('sparse')
'tf.sparse'
elsif slug.start_with?('tf/strings')
elsif slug.start_with?('strings')
'tf.strings'
elsif slug.start_with?('tf/summary')
elsif slug.start_with?('summary')
'tf.summary'
elsif slug.start_with?('tf/sysconfig')
elsif slug.start_with?('sysconfig')
'tf.sysconfig'
elsif slug.start_with?('tf/test')
elsif slug.start_with?('test')
'tf.test'
elsif slug.start_with?('tf/tpu')
elsif slug.start_with?('tpu')
'tf.tpu'
elsif slug.start_with?('tf/train')
elsif slug.start_with?('train')
'tf.train'
elsif slug.start_with?('tf/version')
elsif slug.start_with?('version')
'tf.version'
elsif slug.start_with?('tf/xla')
elsif slug.start_with?('xla')
'tf.xla'
else
'tf'

View file

@ -1,11 +1,8 @@
# frozen_string_literal: true
module Docs
class Tensorflow < UrlScraper
self.name = 'TensorFlow'
self.type = 'tensorflow'
self.release = '2.1'
self.root_path = 'index.html'
self.root_path = 'all_symbols'
self.links = {
home: 'https://www.tensorflow.org/',
code: 'https://github.com/tensorflow/tensorflow'
@ -17,22 +14,19 @@ module Docs
options[:container] = '.devsite-main-content'
options[:attribution] = <<-HTML
&copy; 2019 The TensorFlow Authors. All rights reserved.<br>
&copy; 2020 The TensorFlow Authors. All rights reserved.<br>
Licensed under the Creative Commons Attribution License 3.0.<br>
Code samples licensed under the Apache 2.0 License.
HTML
version 'Python' do
self.base_url = 'https://www.tensorflow.org/api_docs/python/'
version '2.3' do
self.release = "#{version}.0"
self.base_url = "https://www.tensorflow.org/versions/r#{version}/api_docs/python/tf"
end
version 'C++' do
self.base_url = 'https://www.tensorflow.org/api_docs/cc/'
end
version 'Guide' do
include MultipleBaseUrls
self.base_urls = ['https://www.tensorflow.org/guide/', 'https://www.tensorflow.org/tutorials/']
version '1.15' do
self.release = "#{version}.0"
self.base_url = "https://www.tensorflow.org/versions/r#{version}/api_docs/python/tf"
end
def get_latest_version(opts)
@ -42,7 +36,7 @@ module Docs
private
def parse(response)
unless response.url == root_url || self.class.version == 'Guide'
unless response.url == root_url
response.body.sub!(/<nav class="devsite-nav-responsive-sidebar.+?<\/nav>/m, '')
response.body.gsub!(/<li class="devsite-nav-item">.+?<\/li>/m, '')
end

View file

@ -0,0 +1,18 @@
module Docs
class TensorflowCpp < Tensorflow
self.name = 'TensorFlow C++'
self.slug = 'tensorflow_cpp'
self.root_path = '/'
version '2.3' do
self.release = "#{version}.0"
self.base_url = "https://www.tensorflow.org/versions/r#{version}/api_docs/cc"
end
version '1.15' do
self.release = "#{version}.0"
self.base_url = "https://www.tensorflow.org/versions/r#{version}/api_docs/cc"
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

View file

@ -0,0 +1 @@
https://www.tensorflow.org/images/favicon.png