(tensor)
| 38 | |
| 39 | |
| 40 | def safe_transpose(tensor): |
| 41 | if tensor.dim() <= 1: |
| 42 | return tensor |
| 43 | if tensor.dim() == 2: |
| 44 | return tensor.T |
| 45 | raise ValueError("Tensor has more than 2 dimensions, unable to safely transpose.") |
| 46 | |
| 47 | |
| 48 | WEIGHT2DTYPE = { |
nothing calls this directly
no outgoing calls
no test coverage detected