Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tensor str #5783

Merged
merged 254 commits into from
Aug 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
254 commits
Select commit Hold shift + click to select a range
76fcd6f
refine code
clackhan Jun 22, 2021
ab4b2f5
refine code
clackhan Jun 23, 2021
daf5bcc
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jun 30, 2021
497fc82
optimize code
clackhan Jun 30, 2021
e129aa2
refine code
clackhan Jun 30, 2021
d5b7b39
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jun 30, 2021
870909c
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 2, 2021
c572b50
Merge branch 'master' into support_tensor_to/to_local
clackhan Jul 5, 2021
6546627
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 6, 2021
f7da2fe
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 7, 2021
79ecc37
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 7, 2021
ca9e32a
refine
clackhan Jul 7, 2021
708732e
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 8, 2021
f616d8a
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 9, 2021
0bc6143
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 14, 2021
b76498d
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 16, 2021
aadf35d
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 16, 2021
4b98830
back up
clackhan Jul 19, 2021
62b03e1
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 20, 2021
75a3c20
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 20, 2021
c5c4cfb
add tensor.to func
clackhan Jul 20, 2021
0aa5eb2
make of_format
clackhan Jul 20, 2021
50d667c
remove to in pyTensor
clackhan Jul 21, 2021
5fe6f3d
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 21, 2021
4eaad64
sync gpu data
clackhan Jul 22, 2021
25f471c
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 22, 2021
e496f0c
refine
clackhan Jul 22, 2021
58fdcee
refine
clackhan Jul 23, 2021
912955f
refine
clackhan Jul 23, 2021
fbdc64e
refine
clackhan Jul 23, 2021
4efb2e8
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 23, 2021
5240fba
refine
clackhan Jul 23, 2021
f8e6fd9
refine
clackhan Jul 23, 2021
2b120a4
refine
clackhan Jul 23, 2021
f41a674
refine
clackhan Jul 23, 2021
6baec14
refine
clackhan Jul 23, 2021
6f6aae4
backup
clackhan Jul 23, 2021
d20904d
refine
clackhan Jul 26, 2021
db7e064
Merge branch 'support_tensor_to/to_local' of https://github.com/Onefl…
clackhan Jul 26, 2021
d248b3d
rebase
jackalcooper Jul 26, 2021
68bb49f
Merge branch 'master' into deduce_consistent_op_interpreter
lixinqi Jul 26, 2021
6e8a083
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
jackalcooper Jul 26, 2021
f7aa67f
check in gen py
jackalcooper Jul 26, 2021
9a2f9d5
Merge branch 'deduce_consistent_op_interpreter' of github.com:Oneflow…
lixinqi Jul 26, 2021
122acb7
merge master and fix bugs
lixinqi Jul 26, 2021
43a2ac5
Merge branch 'master' into deduce_consistent_op_interpreter
lixinqi Jul 26, 2021
0101184
address pr comments
lixinqi Jul 26, 2021
6a7cb4a
eager boxing
clackhan Jul 26, 2021
f2b0c79
address pr comments
lixinqi Jul 26, 2021
e670f76
merge master
lixinqi Jul 26, 2021
b269845
fix b2p error
clackhan Jul 27, 2021
5be290a
auto format by CI
oneflow-ci-bot Jul 27, 2021
95ee6e2
remove boxing
clackhan Jul 27, 2021
1926037
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 27, 2021
784e1b5
export sbp
clackhan Jul 27, 2021
761b854
Merge branch 'master' into inferface_eager_boxing
clackhan Jul 27, 2021
3ee8ff8
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 27, 2021
f740b5b
add tensor to_consistent
clackhan Jul 27, 2021
9e766f5
/minor fix
clackhan Jul 27, 2021
9ae95db
Merge branch 'inferface_eager_boxing' of https://github.com/Oneflow-I…
clackhan Jul 27, 2021
d8b2201
minor fix
clackhan Jul 27, 2021
be254d9
refine
clackhan Jul 27, 2021
e3db142
Merge branch 'master' into deduce_consistent_op_interpreter
lixinqi Jul 27, 2021
835fe87
remove useless head file
clackhan Jul 27, 2021
5532ab3
Fix optional
hjchen2 Jul 27, 2021
647cc4e
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow
hjchen2 Jul 27, 2021
36877dd
remove to in tensor.cpp
clackhan Jul 27, 2021
0fa7d71
update
hjchen2 Jul 27, 2021
32129f1
Merge branch 'master' into dev_fix_optional
oneflow-ci-bot Jul 27, 2021
cbed793
Merge branch 'master' into dev_fix_optional
oneflow-ci-bot Jul 27, 2021
241b21e
Support symbol placement type in functional.
hjchen2 Jul 27, 2021
0ac82e5
add sbp and sbp list arg
clackhan Jul 27, 2021
58b0b03
refine
clackhan Jul 27, 2021
2157e94
Merge branch 'deduce_consistent_op_interpreter' of https://github.com…
clackhan Jul 27, 2021
f22f41a
Merge branch 'dev_functional_support_placement_and_sbp_type' of https…
clackhan Jul 27, 2021
2197648
use functional
clackhan Jul 27, 2021
f359664
Merge branch 'support_tensor_to/to_local' of https://github.com/Onefl…
clackhan Jul 27, 2021
6e320a1
refactor CastConsistentOpExpr
clackhan Jul 27, 2021
6dafbfe
Merge branch 'support_tensor_to/to_local' of https://github.com/Onefl…
clackhan Jul 27, 2021
9238d18
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 28, 2021
e323677
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 28, 2021
e86d99c
to_consistent(flow.B) backward
clackhan Jul 29, 2021
960ec64
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 29, 2021
5d481a2
Cache op expr
clackhan Jul 30, 2021
b53c42d
add EagerNcclOpKernelState
clackhan Jul 30, 2021
fcbb0b2
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 30, 2021
df73c27
refine
clackhan Jul 30, 2021
035fcb5
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 30, 2021
076d113
refine
clackhan Jul 30, 2021
8045564
refine
clackhan Jul 30, 2021
0e6543e
refine
clackhan Jul 30, 2021
8bce478
refine
clackhan Jul 30, 2021
c80ffa5
refine
clackhan Jul 30, 2021
154a13c
minor fix
clackhan Jul 30, 2021
e562062
Merge branch 'master' into support_tensor_to/to_local
clackhan Jul 30, 2021
e7a0e1b
capture OpInterpContext
lixinqi Jul 30, 2021
7662fe9
unimplemented apply
lixinqi Jul 30, 2021
6e638e8
add GetNdSbp
clackhan Jul 30, 2021
57d86b3
Merge branch 'support_tensor_to/to_local' of https://github.com/Onefl…
clackhan Jul 30, 2021
7bd72c3
add mutex
clackhan Jul 30, 2021
36acab6
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 30, 2021
777e8d8
Merge branch 'capture_op_interp_context' of https://github.com/Oneflo…
clackhan Jul 30, 2021
997af6b
refine
clackhan Jul 30, 2021
85d9282
merge master
lixinqi Jul 31, 2021
8ef19de
merge EagerConsistentTensorImpl::NewWithPhyTensor and EagerConsistent…
lixinqi Jul 31, 2021
9947b59
rename functiona SyncData to SyncMetaAndData
lixinqi Jul 31, 2021
11d804a
Merge branch 'support_tensor_to/to_local' of https://github.com/Onefl…
clackhan Jul 31, 2021
5a0115b
fix function yml
clackhan Jul 31, 2021
f5f5dc0
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Jul 31, 2021
99b4474
refine
clackhan Jul 31, 2021
e279ac6
refine
clackhan Jul 31, 2021
243f38f
refine collective boxing
clackhan Jul 31, 2021
571ee49
make of_format
clackhan Jul 31, 2021
e9546cf
Merge branch 'master' into support_tensor_to/to_local
clackhan Jul 31, 2021
6d410c6
of_format
clackhan Jul 31, 2021
36b795f
Merge branch 'support_tensor_to/to_local' of https://github.com/Onefl…
clackhan Jul 31, 2021
347ed40
add to_local to pybind
clackhan Jul 31, 2021
3dbd4a0
refactor EagerBoxingInterpreter
clackhan Jul 31, 2021
31b84b1
minor fix
clackhan Jul 31, 2021
cb60b7f
Merge branch 'support_tensor_to/to_local' of https://github.com/Onefl…
clackhan Jul 31, 2021
c22dadc
optimize CastParallelDistribution
clackhan Jul 31, 2021
4e9be9f
add placement_sbp_util
lixinqi Aug 1, 2021
b375cb6
minor fix
clackhan Aug 1, 2021
bd8e674
Merge branch 'support_tensor_to/to_local' of https://github.com/Onefl…
clackhan Aug 1, 2021
757f3af
eager boxing backward
clackhan Aug 1, 2021
dabdc82
minor fix
clackhan Aug 1, 2021
2025c49
sync shape and data when tensor_to_local
lixinqi Aug 1, 2021
8064006
merge origin
lixinqi Aug 1, 2021
583631e
Merge branch 'dev_fix_optional' into support_tensor_to/to_local
lixinqi Aug 1, 2021
f6d8b7b
fix rpc_token bugs
lixinqi Aug 1, 2021
75d3b25
fix p2s backward bug
clackhan Aug 1, 2021
aa6aa51
refactor AsyncRpcCtx
lixinqi Aug 1, 2021
244e7c5
set logical_shape correctly
lixinqi Aug 1, 2021
884a8b1
simplify implementation of consistent_tensor.to_local
lixinqi Aug 1, 2021
3bb999d
Merge branch 'support_tensor_to/to_local' of https://github.com/Onefl…
clackhan Aug 2, 2021
672e154
Merge branch 'inferface_eager_boxing' of https://github.com/Oneflow-I…
clackhan Aug 2, 2021
3685ef2
Merge branch 'support_tensor_to/to_local' of https://github.com/Onefl…
clackhan Aug 2, 2021
82a9a6a
refine
clackhan Aug 2, 2021
519a412
initialize rpc_token with zero
lixinqi Aug 2, 2021
e50541e
Merge branch 'support_tensor_to/to_local' of https://github.com/Onefl…
clackhan Aug 2, 2021
2001a3e
refactor grad functions of to_consistent/to_local
lixinqi Aug 2, 2021
722c2bd
Merge branch 'support_tensor_to/to_local' of https://github.com/Onefl…
clackhan Aug 2, 2021
16cbecc
refine
clackhan Aug 2, 2021
98f0a34
reformat and address pr comment
lixinqi Aug 2, 2021
5a07dbd
reformat
lixinqi Aug 2, 2021
3aba1e5
add check_meta_consistency in consistent2sonsistent
clackhan Aug 2, 2021
ccea342
merge master
lixinqi Aug 2, 2021
adeae51
Merge branch 'master' into support_tensor_to/to_local
oneflow-ci-bot Aug 2, 2021
9ee20d1
refactor eager_nccl_reduce lernel
clackhan Aug 3, 2021
ddafc4b
Merge branch 'master' into support_tensor_to/to_local
clackhan Aug 3, 2021
a9f22cf
Merge branch 'support_tensor_to/to_local' of https://github.com/Onefl…
clackhan Aug 3, 2021
a3f24c9
refine
clackhan Aug 3, 2021
9a11d91
refine to_consistent api
clackhan Aug 3, 2021
8314ac8
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Aug 3, 2021
d7313b8
Merge branch 'master' into inferface_eager_boxing
clackhan Aug 3, 2021
7ff3642
ban_non_pod_data_in_eager_boxing
clackhan Aug 4, 2021
4012be1
refine
clackhan Aug 4, 2021
16931d8
Merge branch 'ban_non_pod_data_in_eager_boxing' of https://github.com…
clackhan Aug 4, 2021
732e3b9
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Aug 4, 2021
1aeb9cb
refine
clackhan Aug 4, 2021
b7928ca
Merge branch 'master' into inferface_eager_boxing
clackhan Aug 4, 2021
f14211d
refine
clackhan Aug 4, 2021
02723df
backup code
lixinqi Aug 4, 2021
9ab791c
THREAD_LOCAL_CACHED
lixinqi Aug 4, 2021
2225e69
Merge branch 'master' into dev_thread_local
lixinqi Aug 4, 2021
b4f2e2a
Merge branch 'master' into dev_thread_local
lixinqi Aug 4, 2021
1713683
Merge branch 'master' into inferface_eager_boxing
lixinqi Aug 4, 2021
3ba9155
Merge branch 'dev_thread_local' into inferface_eager_boxing
lixinqi Aug 4, 2021
ef7fbef
Delete thread_local_cache.h
lixinqi Aug 5, 2021
ab450a5
Merge branch 'dev_thread_local' of github.com:Oneflow-Inc/oneflow int…
lixinqi Aug 5, 2021
ad5c97c
bugfix: DeviceId4ParallelId -> MachineId4ParallelId
lixinqi Aug 5, 2021
6216608
optimize
clackhan Aug 5, 2021
36d0548
Merge branch 'inferface_eager_boxing' of https://github.com/Oneflow-I…
clackhan Aug 5, 2021
36de59a
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
clackhan Aug 5, 2021
d4fd982
Merge branch 'master' into inferface_eager_boxing
oneflow-ci-bot Aug 5, 2021
97ae072
support tensor str
liufengwei0103 Aug 6, 2021
548252f
Init code and can print consistent
wyg1997 Aug 6, 2021
54230c0
refine format
wyg1997 Aug 6, 2021
690b304
remove useless to_consistent and format
wyg1997 Aug 6, 2021
266d39c
refine code and print according data
wyg1997 Aug 6, 2021
1b28569
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
liufengwei0103 Aug 7, 2021
ae56afa
attempt to support multi rank when fetch data
liufengwei0103 Aug 7, 2021
95486f1
Revert "attempt to support multi rank when fetch data"
liufengwei0103 Aug 9, 2021
1fb94a0
skip if tensor is consistent
liufengwei0103 Aug 9, 2021
8fbcd87
delete useless
liufengwei0103 Aug 9, 2021
3780265
add comment
liufengwei0103 Aug 9, 2021
ae5db2a
delete useless
liufengwei0103 Aug 9, 2021
acd3aee
traversal data to determine if int_mode
liufengwei0103 Aug 9, 2021
f53e8eb
if consistent, return [...]
liufengwei0103 Aug 9, 2021
56e4a9a
refine
liufengwei0103 Aug 9, 2021
1ad368d
add test and fix bug
liufengwei0103 Aug 9, 2021
e6f7e17
add more assertTrue and delete useless
liufengwei0103 Aug 9, 2021
7111986
getitem using integer return scalar when tensor shape is [1]
liufengwei0103 Aug 10, 2021
9f197aa
add test cast
liufengwei0103 Aug 10, 2021
5aca834
refine
liufengwei0103 Aug 10, 2021
d0d6ae7
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
liufengwei0103 Aug 10, 2021
59fc9fb
fix spelling mistake
liufengwei0103 Aug 10, 2021
d78fef4
Merge branch 'master' into tensor_str
wyg1997 Aug 10, 2021
b4ebba3
add op test and enhance in parse device
liufengwei0103 Aug 10, 2021
e2672bd
Merge branch 'tensor_str' of https://github.com/Oneflow-Inc/oneflow i…
liufengwei0103 Aug 10, 2021
ee5c062
Merge branch 'master' into tensor_str
liufengwei0103 Aug 10, 2021
a8fdf98
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 10, 2021
c847b20
fix bug
liufengwei0103 Aug 11, 2021
f3c2083
Merge branch 'tensor_str' of https://github.com/Oneflow-Inc/oneflow i…
liufengwei0103 Aug 11, 2021
f6480f1
fix docstr test bug and support to print meta
liufengwei0103 Aug 11, 2021
0709d73
refine
liufengwei0103 Aug 11, 2021
9132a7c
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
liufengwei0103 Aug 11, 2021
a4bca38
Merge branch 'master' into tensor_str
liufengwei0103 Aug 11, 2021
f98f955
auto format by CI
oneflow-ci-bot Aug 11, 2021
ae827d2
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 11, 2021
aaccdfa
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 11, 2021
1007a34
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 11, 2021
05efe42
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 11, 2021
7672567
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 11, 2021
fce2324
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 11, 2021
668eb0d
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 12, 2021
14b84f5
Merge branch 'tensor_str' of https://github.com/Oneflow-Inc/oneflow i…
liufengwei0103 Aug 12, 2021
ec4e5c3
fix docstr in clip_grad.py
liufengwei0103 Aug 12, 2021
e5891f1
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 12, 2021
d5af9e2
fix docstr
liufengwei0103 Aug 12, 2021
1d4b384
Merge branch 'tensor_str' of https://github.com/Oneflow-Inc/oneflow i…
liufengwei0103 Aug 12, 2021
e97a98f
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 12, 2021
922dd44
fix docstr and bug
liufengwei0103 Aug 12, 2021
efe4036
Merge branch 'tensor_str' of https://github.com/Oneflow-Inc/oneflow i…
liufengwei0103 Aug 12, 2021
ab3db5d
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 12, 2021
50a7112
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 12, 2021
0429a70
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 12, 2021
8edd278
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 12, 2021
60b4de3
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 12, 2021
2608d7c
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 12, 2021
b8ded1b
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 12, 2021
77d28c9
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 12, 2021
a879c24
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 12, 2021
846532f
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 13, 2021
a2708cd
Merge branch 'master' into tensor_str
liufengwei0103 Aug 13, 2021
f500d83
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 13, 2021
6b4659a
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 13, 2021
401f31b
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 13, 2021
aced335
Merge branch 'master' into tensor_str
chengtbf Aug 13, 2021
9aad791
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 13, 2021
5db1b30
the input shape parameter of reshape changed
liufengwei0103 Aug 13, 2021
6ca303d
Merge branch 'master' into tensor_str
liufengwei0103 Aug 13, 2021
2815036
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 13, 2021
644051b
Merge branch 'master' of https://github.com/Oneflow-Inc/oneflow into …
liufengwei0103 Aug 14, 2021
5585631
add with flow.no_grad when operate tensor
liufengwei0103 Aug 14, 2021
07e4f7e
Merge branch 'master' into tensor_str
liufengwei0103 Aug 14, 2021
96ef2e8
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 14, 2021
3857253
Merge branch 'master' into tensor_str
liufengwei0103 Aug 14, 2021
8e44cef
fix docstr
liufengwei0103 Aug 14, 2021
705b323
Merge branch 'master' into tensor_str
oneflow-ci-bot Aug 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion oneflow/api/python/framework/tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ Maybe<Tensor> NewTensor(py::args args, py::kwargs kwargs, const DType* desired_d
|| py::isinstance<py::str>(device_kwarg));

if (py::isinstance<py::str>(device_kwarg)) {
device = DeviceExportUtil::New(py::cast<std::string>(device_kwarg));
device = DeviceExportUtil::ParseAndNew(py::cast<std::string>(device_kwarg));
} else {
device = py::cast<Symbol<Device>>(device_kwarg);
}
Expand Down
1 change: 1 addition & 0 deletions oneflow/core/functional/impl/array_functor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,7 @@ class TensorGetItemFunctor {
step[i] = slice.step();
}
bool is_identity = [&]() {
if (target_shape.NumAxes() == 0) { return false; }
for (int i = 0; i < ndims; ++i) {
if (start[i] != 0 || end[i] != x->shape()->At(i) || step[i] != 1) { return false; }
}
Expand Down
1 change: 1 addition & 0 deletions oneflow/core/functional/tensor_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Maybe<void> PrepareSliceIndices(const TensorIndex& index, const Shape& shape,
CHECK_LT_OR_RETURN(dim, ndims) << "Invalid index for tensor of dimension " << ndims;
if (index_item.IsSlice()) {
const auto& slice = index_item.slice();
CHECK_GT_OR_RETURN(slice.step(), 0) << "Step must be greater than zero.";
hjchen2 marked this conversation as resolved.
Show resolved Hide resolved
int64_t step = std::min(slice.step(), shape.At(dim));
int64_t end = std::min(slice.end(), shape.At(dim));
int64_t start = std::min(slice.start(), shape.At(dim));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ class Mish(Module):

>>> out = mish(input)
>>> out
tensor([0.8651, 1.944 , 2.9865], dtype=oneflow.float32)
tensor([0.8651, 1.9440, 2.9865], dtype=oneflow.float32)
"""

def __init__(self, inplace: bool = False):
Expand Down
8 changes: 4 additions & 4 deletions python/oneflow/framework/docstr/activation.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

>>> out = flow.F.gelu(input)
>>> out
tensor([-0.1543, 0. , 0.3457], dtype=oneflow.float32)
tensor([-0.1543, 0.0000, 0.3457], dtype=oneflow.float32)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>>> torch.zeros(2, 2)
tensor([[0., 0.],
        [0., 0.]])

torch 并不会 把 0 align 到 0.000,这样做有什么好处吗? numpy 也不会。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

torch.zeros(2, 2) 的话我们也是打印 0. 的,因为数据都是没有小数位的,这时候会启动整数模式,不打印小数位。

上面这个例子是其它数不满足这个条件,为了格式上对齐,会打印 0.0000

Copy link
Contributor

@chengtbf chengtbf Aug 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确实是这样。学到了~

>>> x = torch.zeros(3,)
>>> x
tensor([0., 0., 0.])
>>> x[0] = 0.1
>>> x
tensor([0.1000, 0.0000, 0.0000]


See
:class:`~oneflow.nn.GELU` for more details.
Expand Down Expand Up @@ -170,7 +170,7 @@
>>> input = flow.Tensor(x)
>>> out = flow.F.softsign(input)
>>> out
tensor([0.5 , 0.6667, 0.75 ], dtype=oneflow.float32)
tensor([0.5000, 0.6667, 0.7500], dtype=oneflow.float32)

See :class:`~oneflow.nn.Softsign` for more details.

Expand Down Expand Up @@ -232,7 +232,7 @@

>>> out = flow.F.mish(input)
>>> out
tensor([0.8651, 1.944 , 2.9865], dtype=oneflow.float32)
tensor([0.8651, 1.9440, 2.9865], dtype=oneflow.float32)

See :
class:`~oneflow.nn.Mish` for more details.
Expand Down Expand Up @@ -361,7 +361,7 @@
>>> input = flow.Tensor(x)
>>> out = flow.nn.functional.elu(input, alpha=1.0)
>>> out
tensor([-0.3935, 0. , 0.5 ], dtype=oneflow.float32)
tensor([-0.3935, 0.0000, 0.5000], dtype=oneflow.float32)
""",
)
add_docstr(
Expand Down
2 changes: 1 addition & 1 deletion python/oneflow/framework/docstr/pooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
>>> arr = np.array([[[ 0.0558, -0.6875, -1.6544, -0.6226, 0.1018, 0.0502, -1.2538, 0.1491]]])
>>> input = flow.Tensor(arr, dtype=flow.float32)
>>> flow.nn.functional.adaptive_avg_pool1d(input, output_size=[4])
tensor([[[-0.3158, -1.1385, 0.076 , -0.5524]]], dtype=oneflow.float32)
tensor([[[-0.3158, -1.1385, 0.0760, -0.5524]]], dtype=oneflow.float32)

""",
)
Expand Down
7 changes: 7 additions & 0 deletions python/oneflow/framework/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,12 @@ def _get_device(self):
raise NotImplementedError("get_device is only available for GPU tensor.")


def _format(self, format_spec):
if self.dim() == 0:
return self.tolist().__format__(format_spec)
return object.__format__(self, format_spec)


def RegisterMethods():
Tensor.__mul__ = lambda self, other: self.mul(other)
Tensor.__rmul__ = lambda self, other: self.mul(other)
Expand Down Expand Up @@ -356,6 +362,7 @@ def RegisterMethods():
Tensor.__rtruediv__ = _rtruediv
Tensor.__neg__ = _neg
Tensor.__pow__ = _pow
Tensor.__format__ = _format
Tensor.uniform_ = _uniform_
Tensor.kaiming_uniform_ = _kaiming_uniform
Tensor.kaiming_normal_ = _kaiming_normal
Expand Down
Loading