Skip to main content

adopt_untracked_eager_value

Function adopt_untracked_eager_value 

Source
pub fn adopt_untracked_eager_value(
    ctx: Arc<EagerRuntime>,
    value: TensorValue,
) -> Result<EagerTensor>
Expand description

Adopt a runtime value produced by an extension kernel as an untracked eager tensor of ctx.

§Examples

use tenferro_ad::{EagerRuntime, Tensor};
use tenferro_tensor::TensorValue;

let ctx = EagerRuntime::new()?;
let value = TensorValue::from_tensor(Tensor::from_vec_col_major(vec![1], vec![2.0_f64])?);
let tensor = tenferro_ad::extension::adopt_untracked_eager_value(ctx, value)?;
assert!(!tensor.tracks_grad());

§Errors

Returns Error::RuntimeState when the TensorValue cannot be transferred into its allocation group.