MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / operator()

Method operator()

oneflow/core/functional/impl/array_functor.cpp:3201–3209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3199class To4Functor {
3200 public:
3201 Maybe<Tensor> operator()(const std::shared_ptr<Tensor>& input,
3202 const std::shared_ptr<Tensor>& other, bool copy) const {
3203 CHECK_OR_RETURN(!input->is_global() && !other->is_global())
3204 << Error::RuntimeError()
3205 << "tensor.to(other) can only be called when tensor and other are local tensors";
3206 Symbol<DType> dtype = other->dtype();
3207 Symbol<Device> device = JUST(other->device());
3208 return LocalTensorTo(input, device, dtype, copy);
3209 }
3210};
3211
3212class ToDeviceFunctor {

Callers

nothing calls this directly

Calls 4

LocalTensorToFunction · 0.85
is_globalMethod · 0.45
dtypeMethod · 0.45
deviceMethod · 0.45

Tested by

no test coverage detected