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

Method Size

oneflow/core/ndarray/slice.cpp:70–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70size_t Slice::Size() const {
71 CHECK(IsBounded());
72 if (stride_ > 0 && start_ >= end_) { return 0; }
73 if (stride_ < 0 && start_ <= end_) { return 0; }
74 return ((end_ - start_) + (stride_ - ((stride_ > 0) - (stride_ < 0)))) / stride_;
75}
76
77bool Slice::IsContiguous() const {
78 CHECK(IsBounded());

Callers 15

__init__Method · 0.45
sampleMethod · 0.45
__init__Method · 0.45
sampleMethod · 0.45
rsampleMethod · 0.45
sample_nMethod · 0.45
_extended_shapeMethod · 0.45
_get_valid_output_sizeFunction · 0.45
test_half_randnMethod · 0.45
_get_valid_output_sizeFunction · 0.45

Calls

no outgoing calls

Tested by 15

_get_valid_output_sizeFunction · 0.36
test_half_randnMethod · 0.36
_get_valid_output_sizeFunction · 0.36
_test_graph_randint_likeFunction · 0.36
test_type_tensor_ctorMethod · 0.36
test_moduledictMethod · 0.36
_test_flattenFunction · 0.36
_test_slice_emptyFunction · 0.36
helperFunction · 0.36
_test_global_randFunction · 0.36