MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / slice_fn

Function slice_fn

fastdeploy/model_executor/utils.py:118–129  ·  view source on GitHub ↗
(weight_or_paramter, output_dim, start, end, step=1)

Source from the content-addressed store, hash-verified

116
117
118def slice_fn(weight_or_paramter, output_dim, start, end, step=1):
119 if hasattr(weight_or_paramter, "get_shape"):
120 shape = weight_or_paramter.get_shape()
121 else:
122 shape = weight_or_paramter.shape
123 if len(shape) == 1:
124 weight_or_paramter = weight_or_paramter[start:end]
125 elif output_dim:
126 weight_or_paramter = weight_or_paramter[..., start:end]
127 else:
128 weight_or_paramter = weight_or_paramter[start:end, ...]
129 return weight_or_paramter
130
131
132def process_weight_transpose(layer, weight_name):

Callers 12

weight_loaderMethod · 0.90
weight_loaderMethod · 0.90
weight_loaderMethod · 0.90
qkv_weight_loaderMethod · 0.90
gate_weight_loaderMethod · 0.90
weight_loaderMethod · 0.90
weight_loaderMethod · 0.90
_load_gate_up_weightMethod · 0.90
_load_down_weightMethod · 0.90
qkv_weight_loaderMethod · 0.90
fnFunction · 0.85

Calls 1

get_shapeMethod · 0.80

Tested by

no test coverage detected