MCPcopy Create free account
hub / github.com/OpenSparseLLMs/Linear-MoE / set_input_tensor

Method set_input_tensor

linear_moe/sequence_modeling/ssm.py:199–207  ·  view source on GitHub ↗

Set input tensor to be used instead of forward()'s input. When doing pipeline parallelism the input from the previous stage comes from communication, not from the input, so the model's forward_step_func won't have it. This function is thus used by internal code to by

(self, input_tensor: Tensor)

Source from the content-addressed store, hash-verified

197 }
198
199 def set_input_tensor(self, input_tensor: Tensor):
200 """Set input tensor to be used instead of forward()'s input.
201
202 When doing pipeline parallelism the input from the previous
203 stage comes from communication, not from the input, so the
204 model's forward_step_func won't have it. This function is thus
205 used by internal code to bypass the input provided by the
206 forward_step_func"""
207 self.input_tensor = input_tensor
208
209 def forward(
210 self,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected