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

Method Tensor

oneflow/api/cpp/framework/tensor.cpp:34–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32namespace functional = of::one::functional;
33
34Tensor::Tensor(const Shape& shape, const Device& device, const DType& dtype) {
35 of::LazyMode::Guard lazy_mode_disabled_guard(/*is_enabled*/ false);
36 tensor_ = functional::Empty(*shape.shape_,
37 of::DType::Get(static_cast<of::DataType>(dtype)).GetOrThrow(),
38 *device.device_, /*requires_grad=*/false, /*pin_memory=*/false)
39 .GetPtrOrThrow();
40}
41Tensor::Tensor(const std::shared_ptr<oneflow::one::Tensor>& tensor) : tensor_(tensor) {}
42
43Tensor::Tensor(const Tensor& tensor) : tensor_(tensor.tensor_) {}

Callers 15

__init__Method · 0.45
_calc_valueMethod · 0.45
train_by_oneflowFunction · 0.45
train_by_oneflowFunction · 0.45
_test_bn_add_reluFunction · 0.45
_test_bn_reluFunction · 0.45
_test_bn_add_relu_evalFunction · 0.45
_test_bn_relu_evalFunction · 0.45
test_type_tensor_ctorMethod · 0.45

Calls 3

GetFunction · 0.85
GetPtrOrThrowMethod · 0.80
GetOrThrowMethod · 0.45

Tested by 15

train_by_oneflowFunction · 0.36
train_by_oneflowFunction · 0.36
_test_bn_add_reluFunction · 0.36
_test_bn_reluFunction · 0.36
_test_bn_add_relu_evalFunction · 0.36
_test_bn_relu_evalFunction · 0.36
test_type_tensor_ctorMethod · 0.36
test_nested_moduleMethod · 0.36
test_reluMethod · 0.36