Skip to content

Commit 06ffbc4

Browse files
committed
Merge branch 'shape_int_to_int64' of https://github.com/seiriosPlus/Paddle into cpu-for-1.1-merge-with-shape
test=develop
2 parents ef9bfcf + 06de824 commit 06ffbc4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

paddle/fluid/pybind/protobuf.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,18 @@ struct variant_caster<V<Ts...>> {
5757
auto caster = make_caster<T>();
5858
if (!load_success_ && caster.load(src, convert)) {
5959
load_success_ = true;
60+
61+
if (std::is_same<T, std::vector<float>>::value) {
62+
auto caster_ints = make_caster<std::vector<int64_t>>();
63+
if (caster_ints.load(src, convert)) {
64+
VLOG(4) << "This value are floats and int64_ts satisfy "
65+
"simultaneously, will set it's type to "
66+
"std::vector<int64_t>";
67+
value = cast_op<std::vector<int64_t>>(caster_ints);
68+
return true;
69+
}
70+
}
71+
6072
value = cast_op<T>(caster);
6173
return true;
6274
}

0 commit comments

Comments
 (0)