Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
torch-sparse
Commits
79cffd57
"gallery/transforms/plot_transforms_getting_started.py" did not exist on "59b27ed64cf126357d60e8f2944d204f83075e2e"
Unverified
Commit
79cffd57
authored
Apr 25, 2022
by
Rex Ying
Committed by
GitHub
Apr 26, 2022
Browse files
out of range exception catching (#227)
parent
0172aeb3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
csrc/cpu/neighbor_sample_cpu.cpp
csrc/cpu/neighbor_sample_cpu.cpp
+4
-2
No files found.
csrc/cpu/neighbor_sample_cpu.cpp
View file @
79cffd57
...
@@ -117,10 +117,12 @@ sample(const torch::Tensor &colptr, const torch::Tensor &row,
...
@@ -117,10 +117,12 @@ sample(const torch::Tensor &colptr, const torch::Tensor &row,
inline
bool
satisfy_time
(
const
c10
::
Dict
<
node_t
,
torch
::
Tensor
>
&
node_time_dict
,
inline
bool
satisfy_time
(
const
c10
::
Dict
<
node_t
,
torch
::
Tensor
>
&
node_time_dict
,
const
node_t
&
src_node_type
,
int64_t
dst_time
,
const
node_t
&
src_node_type
,
int64_t
dst_time
,
int64_t
src_node
)
{
int64_t
src_node
)
{
try
{
// Check whether src -> dst obeys the time constraint:
try
{
// Check whether src -> dst obeys the time constraint
const
torch
::
Tensor
&
src_node_time
=
node_time_dict
.
at
(
src_node_type
);
const
torch
::
Tensor
&
src_node_time
=
node_time_dict
.
at
(
src_node_type
);
return
src_node_time
.
data_ptr
<
int64_t
>
()[
src_node
]
<=
dst_time
;
return
src_node_time
.
data_ptr
<
int64_t
>
()[
src_node
]
<=
dst_time
;
}
catch
(
int
err
)
{
// If no time is given, fall back to normal sampling:
}
catch
(
const
std
::
out_of_range
&
e
)
{
// If no time is given, fall back to normal sampling
return
true
;
return
true
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment