//
// We need to do the checks here instead of in `native_functions.yaml`
// to preserve backwards compatibility.
- if (! self.is_xla()) {
+ if (!self.is_xla() && !self.is_lazy()) {
return self._reshape_alias(shape, stride.value());
} else {
return self.view(shape);
return impl_->is_xla();
}
+ /// Returns if a `Tensor` has Lazy backend.
+ bool is_lazy() const {
+ return impl_->is_lazy();
+ }
+
/// Returns if a `Tensor` has HIP backend.
bool is_hip() const {
// NB: this is not a native function to avoid dispatching overhead.
return key_set_.has(DispatchKey::XLA);
}
+ bool is_lazy() const {
+ return key_set_.has(DispatchKey::Lazy);
+ }
+
bool is_hip() const {
// NB: This method is not virtual and avoid dispatches for performance
// reasons.