hpt_common/error/
autograd.rs

1use std::panic::Location;
2
3use thiserror::Error;
4
5/// Errors related to autograd
6#[derive(Debug, Error)]
7pub enum AutogradError {
8    /// Error that occurs when inplace computation is not allowed in autograd
9    #[error("Inplace computation {op} is not allowed in autograd, at {location}")]
10    InplaceCompError {
11        /// Operation name
12        op: &'static str,
13        /// Location where the error occurred
14        location: &'static Location<'static>,
15    },
16    /// Error that occurs when the operation is not supported in autograd
17    #[error("Operation {op} is not supported in autograd, at {location}")]
18    UnsupportOpError {
19        /// Operation name
20        op: &'static str,
21        /// Location where the error occurred
22        location: &'static Location<'static>,
23    },
24}