Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mapping url in mapping doc generation #6835

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import sys

script_path = os.path.abspath(__file__)
script_dir = os.path.dirname(__file__)
sys.path.append(script_dir)
print(script_dir)
tools_dir = os.path.dirname(__file__)
sys.path.append(tools_dir)

cfp_basedir = os.path.join(tools_dir, "..")

from validate_mapping_files import (
DiffMeta,
Expand Down Expand Up @@ -106,7 +107,7 @@ def docs_url_to_relative_page(url):

def doc_path_to_relative_page(path):
"""将映射文档的本地路径转换为网页相对路径"""
md_path = os.path.relpath(path, script_dir)
md_path = os.path.relpath(path, cfp_basedir)

assert md_path.endswith(".md"), f"Unexpected mapping doc path: {path}"

Expand Down Expand Up @@ -312,9 +313,6 @@ def get_c2a_dict(conditions, meta_dict):

CHECK_ONLY = args.check_only

# convert from pytorch basedir
tools_dir = os.path.dirname(__file__)
cfp_basedir = os.path.join(tools_dir, "..")
# pysrc_api_mapping_cn
mapping_index_file = os.path.join(cfp_basedir, "pytorch_api_mapping_cn.md")

Expand Down