MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / CheckInplaceCastValid

Function CheckInplaceCastValid

oneflow/core/functional/impl/common.cpp:172–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172Maybe<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
180Maybe<void> CheckInplaceShapeCanExpandTo(const Shape& shape, const Shape& expand_shape) {
181 if (shape == expand_shape) { return Maybe<void>::Ok(); }

Callers 10

operator()Method · 0.85
operator()Method · 0.85
operator()Method · 0.85
operator()Method · 0.85
operator()Method · 0.85
operator()Method · 0.85
operator()Method · 0.85
operator()Method · 0.85
operator()Method · 0.85
operator()Method · 0.85

Calls 2

dtypeMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected