| 1573 | } |
| 1574 | |
| 1575 | PyTensor PyTensor::stack(const std::vector<PyTensor>& tensors, int dim) { |
| 1576 | std::vector<Tensor> core_tensors; |
| 1577 | core_tensors.reserve(tensors.size()); |
| 1578 | for (const auto& t : tensors) { |
| 1579 | core_tensors.push_back(t.tensor_); |
| 1580 | } |
| 1581 | return PyTensor(Tensor::stack(core_tensors, dim)); |
| 1582 | } |
| 1583 | |
| 1584 | PyTensor PyTensor::where(const PyTensor& condition, const PyTensor& x, const PyTensor& y) { |
| 1585 | return PyTensor(Tensor::where(condition.tensor_, x.tensor_, y.tensor_)); |