Update Rust code in crates/rktensor/src, focusing on improving the Tensor struct, error handling, and reducing unsafe blocks.