INNER CODE UNIT · Rust
set_target
tensorflow/rust · src/lib.rs:605
pub fn set_target(&mut self, target: &str) -> std::result::Result<(), NulError> {
let cstr = CString::new(target)?;
unsafe {
tf::TF_SetTarget(self.inner, cstr.as_ptr());
}
Ok(())
}
/// Set the config.
///
/// `config` should be a serialized [`ConfigProto` proto](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/protobuf/config.proto).
/// Returns an error if config was not parsed successfully as a `ConfigProto`.
pub fn set_config(&mut self, config: &[u8]) -> Result<()> {
let mut status = Status::new();
unsafe {
tf::TF_SetConfig(
self.inner,
config.as_ptr() as *const _,