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

Method AsLocalTensor

oneflow/core/framework/tensor.cpp:59–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59Maybe<LocalTensor> StaticZerosTensor::AsLocalTensor() {
60 CHECK_OR_RETURN(is_local()); // NOLINT
61 return std::dynamic_pointer_cast<LocalTensor>(
62 JUST(functional::Constant(*shape_, Scalar(0), CHECK_JUST(DType::Get(dtype_)), device_)));
63}
64
65Parameter::Parameter(const std::shared_ptr<Tensor>& tensor, bool requires_grad)
66 : ProxyTensor<Parameter>(tensor) {

Callers 15

cloneMethod · 0.45
InplaceViewFunction · 0.45
ReshapeFunction · 0.45
SliceFunction · 0.45
UnsqueezeFunction · 0.45
InplaceUnsqueezeFunction · 0.45
SqueezeFunction · 0.45
InplaceSqueezeFunction · 0.45
ExpandFunction · 0.45
InplaceExpandFunction · 0.45
NarrowFunction · 0.45
TransposeFunction · 0.45

Calls 3

ConstantClass · 0.85
GetFunction · 0.85
ScalarClass · 0.50

Tested by

no test coverage detected