"use strict";(self.webpackChunkrspress_doc_template=self.webpackChunkrspress_doc_template||[]).push([["5886"],{74276:function(e,r,n){n.r(r);var s=n(85893),a=n(50065);function o(e){let r=Object.assign({h1:"h1",a:"a",p:"p",pre:"pre",code:"code",span:"span"},(0,a.ah)(),e.components);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(r.h1,{id:"fxfx_helperwrap",children:[(0,s.jsx)(r.a,{className:"header-anchor","aria-hidden":"true",href:"#fxfx_helperwrap",children:"#"}),"fx.fx_helper.wrap"]}),"\n",(0,s.jsx)(r.p,{children:"Extended tracer and wrap of torch.fx."}),"\n",(0,s.jsx)(r.p,{children:"This file defines a inherit tracer of torch.fx.Tracer and a extended wrap to allow wrapping of user-defined Module or method, which help users do some optimization of their own module by torch.fx"}),"\n",(0,s.jsx)(r.pre,{className:"code",children:(0,s.jsx)(r.pre,{className:"shiki css-variables has-line-number",style:{backgroundColor:"var(--shiki-color-background)"},tabIndex:"0",children:(0,s.jsxs)(r.code,{className:"language-python",meta:"",children:[(0,s.jsxs)(r.span,{className:"line line-number",children:[(0,s.jsx)(r.span,{style:{color:"var(--shiki-color-text)"},children:"horizon_plugin_pytorch"}),(0,s.jsx)(r.span,{style:{color:"var(--shiki-token-punctuation)"},children:"."}),(0,s.jsx)(r.span,{style:{color:"var(--shiki-color-text)"},children:"fx"}),(0,s.jsx)(r.span,{style:{color:"var(--shiki-token-punctuation)"},children:"."}),(0,s.jsx)(r.span,{style:{color:"var(--shiki-color-text)"},children:"fx_helper"}),(0,s.jsx)(r.span,{style:{color:"var(--shiki-token-punctuation)"},children:"."}),(0,s.jsx)(r.span,{style:{color:"var(--shiki-token-function)"},children:"wrap "}),(0,s.jsx)(r.span,{style:{color:"var(--shiki-token-punctuation)"},children:"(skip_compile: bool "}),(0,s.jsx)(r.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,s.jsx)(r.span,{style:{color:"var(--shiki-token-punctuation)"},children:" "}),(0,s.jsx)(r.span,{style:{color:"var(--shiki-token-constant)"},children:"False"}),(0,s.jsx)(r.span,{style:{color:"var(--shiki-token-punctuation)"},children:")"})]}),"\n"]})})}),"\n",(0,s.jsx)(r.p,{children:"Extend torch.fx.wrap."}),"\n",(0,s.jsx)(r.p,{children:"This function can be:"}),"\n",(0,s.jsx)(r.p,{children:"called or used as a decorator on a string to register a builtin : function as a \u201Cleaf function\u201D"}),"\n",(0,s.jsx)(r.p,{children:"called or used as a decorator on a function to register this : function as a \u201Cleaf function\u201D"}),"\n",(0,s.jsx)(r.p,{children:"called or used as a decorator on subclass of torch.nn.Module to register this module as a \u201Cleaf module\u201D, and register all user defined method in this class as \u201Cleaf method\u201D"}),"\n",(0,s.jsx)(r.p,{children:"called or used as a decorator on a class method to register it as \u201Cleaf method\u201D"}),"\n",(0,s.jsx)(r.p,{children:"Parameters: skip_compile ( bool , optional) \u2013 Whether wrapped obj is skipped in compile, used by horizon_plugin_pytorch.quantization.fx.split_compilable_model.split_compilable_model. Defaults to False."}),"\n",(0,s.jsx)(r.p,{children:"Returns: The actural decorator."}),"\n",(0,s.jsx)(r.p,{children:"Return type: FxWrapManager.wrap"})]})}function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:r}=Object.assign({},(0,a.ah)(),e.components);return r?(0,s.jsx)(r,Object.assign({},e,{children:(0,s.jsx)(o,e)})):o(e)}r.default=i,i.__RSPRESS_PAGE_META={},i.__RSPRESS_PAGE_META["latest%2Fzh%2Fguide%2Fplugin%2Fplugin_api_reference%2Fqat_api%2Fhorizon_plugin_pytorch_fx_fx_helper_wrap.md"]={toc:[],title:"fx.fx_helper.wrap",frontmatter:{}}}}]);