| 170 | } |
| 171 | |
| 172 | Maybe<void> CheckInplaceCastValid(const std::shared_ptr<Tensor>& x, |
| 173 | const std::shared_ptr<Tensor>& x_cast) { |
| 174 | CHECK_OR_RETURN(*x->dtype() == *x_cast->dtype()) |
| 175 | << Error::RuntimeError() << "result type " << x_cast->dtype()->name() |
| 176 | << " can't be cast to the desired output type " << x->dtype()->name(); |
| 177 | return Maybe<void>::Ok(); |
| 178 | } |
| 179 | |
| 180 | Maybe<void> CheckInplaceShapeCanExpandTo(const Shape& shape, const Shape& expand_shape) { |
| 181 | if (shape == expand_shape) { return Maybe<void>::Ok(); } |
no test coverage detected