Reshapes a Tensor of shape [b0,b1...bk,N,M] to [prod(b0,b1...bk),N,M].
| 508 | |
| 509 | // Reshapes a Tensor of shape [b0,b1...bk,N,M] to [prod(b0,b1...bk),N,M]. |
| 510 | Status ReshapeToRank3(const Tensor& input, int batch_size, Tensor* output) { |
| 511 | const int rank = input.dims(); |
| 512 | TensorShape output_shape = {batch_size, input.dim_size(rank - 2), |
| 513 | input.dim_size(rank - 1)}; |
| 514 | return CopyFrom(input, output_shape, output); |
| 515 | } |
| 516 | |
| 517 | // Contracts the inputs along the last axis. (or the second last if the |
| 518 | // corresponding value of swap_free_and_contract is true). The batch dimensions |
no test coverage detected