#[allow(unused_imports)]
use super::common::{SerializationFormat, SerializationOptions, TensorMetadata};
#[allow(unused_imports)]
use crate::{Tensor, TensorElement};
#[allow(unused_imports)]
use std::path::Path;
#[allow(unused_imports)]
use torsh_core::error::{Result, TorshError};
#[cfg(feature = "serialize-onnx")]
pub mod onnx {
use super::*;
pub fn serialize_onnx<T: TensorElement>(
tensor: &Tensor<T>,
_path: &Path,
options: &SerializationOptions,
) -> Result<()> {
let _metadata = TensorMetadata::from_tensor(
tensor,
options,
SerializationFormat::Onnx,
tensor.numel() * std::mem::size_of::<T>(),
);
Err(TorshError::SerializationError(
"ONNX serialization not yet implemented".to_string(),
))
}
pub fn deserialize_onnx<T: TensorElement>(path: &Path) -> Result<Tensor<T>> {
let _ = path;
Err(TorshError::SerializationError(
"ONNX deserialization not yet implemented".to_string(),
))
}
}
#[cfg(not(feature = "serialize-onnx"))]
pub mod onnx {
use super::*;
pub fn serialize_onnx<T: TensorElement>(
_tensor: &Tensor<T>,
_path: &Path,
_options: &SerializationOptions,
) -> Result<()> {
Err(TorshError::SerializationError(
"ONNX serialization requires the 'serialize-onnx' feature to be enabled".to_string(),
))
}
pub fn deserialize_onnx<T: TensorElement>(_path: &Path) -> Result<Tensor<T>> {
Err(TorshError::SerializationError(
"ONNX deserialization requires the 'serialize-onnx' feature to be enabled".to_string(),
))
}
}