Fix ResolveInputDynamismIntoPredVector to consider values dynamic on failure to resolve dynamism
ResolveInputDynamismIntoPred correctly handles this. Dynamism computation could fail if the input depends on some unsupported ops like custom-call. In such cases, all elements for the input should conservatively be marked as dynamic and not static. PiperOrigin-RevId: 361161831 Change-Id: I7f6fcbd29fc1a2562af26d9682eaf1f02e11f6a7
This commit is contained in:
parent
901112863e
commit
411f0d2800
@ -266,11 +266,10 @@ Status XlaOpKernelContext::ResolveInputDynamismIntoPred(int index, bool* out) {
|
||||
xla::StatusOr<Tensor> dynamism_or_status = e.ResolveDynamism(client);
|
||||
if (!dynamism_or_status.ok()) {
|
||||
// When failed to resolve dynamism, conservatively consider the value
|
||||
// dynamic. This could happen if the input depends on some ops like
|
||||
// custom-call that is not supported generally for dynamism computation.
|
||||
// dynamic.
|
||||
//
|
||||
// TODO(b/176993339): Support resolving dynamism across computations so
|
||||
// resolving dynamism will not fail in those cases.
|
||||
// resolving dynamism will not fail.
|
||||
*out = true;
|
||||
return Status::OK();
|
||||
}
|
||||
@ -297,12 +296,11 @@ Status XlaOpKernelContext::ResolveInputDynamismIntoPredVector(
|
||||
xla::StatusOr<Tensor> dynamism_or_status = e.ResolveDynamism(client);
|
||||
if (!dynamism_or_status.ok()) {
|
||||
// When failed to resolve dynamism, conservatively consider the value
|
||||
// dynamic. This could happen if the input depends on some ops like
|
||||
// custom-call that is not supported generally for dynamism computation.
|
||||
// dynamic.
|
||||
//
|
||||
// TODO(b/176993339): Support resolving dynamism across computations so
|
||||
// resolving dynamism will not fail in those cases.
|
||||
out->resize(InputShape(index).num_elements(), true);
|
||||
// resolving dynamism will not fail.
|
||||
out->resize(InputShape(index).num_elements(), false);
|
||||
return Status::OK();
|
||||
}
|
||||
Tensor dynamism = dynamism_or_status.ValueOrDie();
|
||||
|
Loading…
Reference in New Issue
Block a user