#[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-arrow")]
pub mod arrow {
use super::*;
pub fn serialize_arrow<T: TensorElement>(
tensor: &Tensor<T>,
_path: &Path,
options: &SerializationOptions,
) -> Result<()> {
let _metadata = TensorMetadata::from_tensor(
tensor,
options,
SerializationFormat::Arrow,
tensor.numel() * std::mem::size_of::<T>(),
);
Err(TorshError::SerializationError(
"Arrow serialization not yet implemented".to_string(),
))
}
pub fn deserialize_arrow<T: TensorElement>(path: &Path) -> Result<Tensor<T>> {
let _ = path;
Err(TorshError::SerializationError(
"Arrow deserialization not yet implemented".to_string(),
))
}
}
#[cfg(feature = "serialize-arrow")]
pub mod parquet {
use super::*;
pub fn serialize_parquet<T: TensorElement>(
tensor: &Tensor<T>,
_path: &Path,
options: &SerializationOptions,
) -> Result<()> {
let _metadata = TensorMetadata::from_tensor(
tensor,
options,
SerializationFormat::Parquet,
tensor.numel() * std::mem::size_of::<T>(),
);
Err(TorshError::SerializationError(
"Parquet serialization not yet implemented".to_string(),
))
}
pub fn deserialize_parquet<T: TensorElement>(path: &Path) -> Result<Tensor<T>> {
let _ = path;
Err(TorshError::SerializationError(
"Parquet deserialization not yet implemented".to_string(),
))
}
}
#[cfg(not(feature = "serialize-arrow"))]
pub mod arrow {
use super::*;
pub fn serialize_arrow<T: TensorElement>(
_tensor: &Tensor<T>,
_path: &Path,
_options: &SerializationOptions,
) -> Result<()> {
Err(TorshError::SerializationError(
"Arrow serialization requires the 'serialize-arrow' feature to be enabled".to_string(),
))
}
pub fn deserialize_arrow<T: TensorElement>(_path: &Path) -> Result<Tensor<T>> {
Err(TorshError::SerializationError(
"Arrow deserialization requires the 'serialize-arrow' feature to be enabled"
.to_string(),
))
}
}
#[cfg(not(feature = "serialize-arrow"))]
pub mod parquet {
use super::*;
pub fn serialize_parquet<T: TensorElement>(
_tensor: &Tensor<T>,
_path: &Path,
_options: &SerializationOptions,
) -> Result<()> {
Err(TorshError::SerializationError(
"Parquet serialization requires the 'serialize-arrow' feature to be enabled"
.to_string(),
))
}
pub fn deserialize_parquet<T: TensorElement>(_path: &Path) -> Result<Tensor<T>> {
Err(TorshError::SerializationError(
"Parquet deserialization requires the 'serialize-arrow' feature to be enabled"
.to_string(),
))
}
}