(weight_or_paramter, output_dim, start, end, step=1)
| 116 | |
| 117 | |
| 118 | def 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 | |
| 132 | def process_weight_transpose(layer, weight_name): |
no test coverage detected