Lunderberg commented on PR #15700:
URL: https://github.com/apache/tvm/pull/15700#issuecomment-1711877689

   I agree, generally these parameters would be configurable at run-time.  In 
that case, they would be parameters prior to the `"num_input"` used by 
`LiftTransformParams` to identify liftable parameters.  However, we should have 
the ability to bind any parameter at any stage in the lowering.  This enables 
the most common case, where C0 is provided at compile-time and C1 is provided 
at run-time, but also enables C1 to be provided at compile-time, or at a 
model-initialization step
   
   ```python
   # Initial model definition
   class InitialModelDefinition:
       def end_to_end_model(input1, ..., inputN, config1, ..., configN, 
weight1, ..., weightN):
           ...
   
   # Option 1: Retains separate C0 and C1
   class AfterLiftingCompileTimeKnowns:
       def end_to_end_model(input1, ..., inputN, config1, ..., configN, 
transformed_weights):
           ...
   
       def compile_time_transform(weight1, ..., weightN) -> R.Tuple:
           ...
   
   # Option 2: Optional initialization, merges C0 and C1
   class AfterLiftingInitializationTimeKnowns:
       def end_to_end_model(input1, ..., inputN, 
transformed_weights_and_config):
           ...
   
       def compile_time_transform(config1, ..., configN, weight1, ..., weightN) 
-> R.Tuple:
           ...
   
   # Option 2: C0 is pre-computed at compile-time, C1 is pre-computed during 
initialization
   class AfterLiftingInitializationTimeKnowns:
       def end_to_end_model(input1, ..., inputN, 
transformed_weights_and_config):
           ...
   
       def compile_time_transform(weight1, ..., weightN) -> R.Tuple:
           ...
   
       def initialization_time_transform(config1, ...,  configN, 
transformed_weights) -> R.Tuple:
           ...
   ```
   
   For this specific PR, by making the `tvmjs` be a general utility to 
save/restore the output of a relax function, rather than a specific utility to 
save/restore only relax tensors, we avoid locking ourselves into a specific use 
case.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to