(tensor, B)
| 111 | return med |
| 112 | |
| 113 | def pack_seqdim(tensor, B): |
| 114 | shapelist = list(tensor.shape) |
| 115 | B_, S = shapelist[:2] |
| 116 | assert(B==B_) |
| 117 | otherdims = shapelist[2:] |
| 118 | tensor = torch.reshape(tensor, [B*S]+otherdims) |
| 119 | return tensor |
| 120 | |
| 121 | def unpack_seqdim(tensor, B): |
| 122 | shapelist = list(tensor.shape) |
no outgoing calls
no test coverage detected