pub trait LowerCx {
// Required methods
fn target(&self) -> Target;
fn op(
&mut self,
name: &str,
operands: &[HloValue],
attributes: &str,
results: &[AVal],
) -> Vec<HloValue>;
fn op_with_regions(
&mut self,
name: &str,
operands: &[HloValue],
attributes: &str,
regions: &mut [Region<'_>],
results: &[AVal],
) -> Result<Vec<HloValue>>;
fn constant(&mut self, value: &HostArray) -> HloValue;
fn import(&mut self, module: &str, name_hint: &str) -> Result<String>;
fn function(&mut self, f: &Function, name_hint: &str) -> Result<String>;
// Provided method
fn platform(&self) -> Platform { ... }
}Expand description
A context that emits StableHLO operations.
Required Methods§
Sourcefn op(
&mut self,
name: &str,
operands: &[HloValue],
attributes: &str,
results: &[AVal],
) -> Vec<HloValue>
fn op( &mut self, name: &str, operands: &[HloValue], attributes: &str, results: &[AVal], ) -> Vec<HloValue>
Emits an operation and returns its results.
attributes is the attribute dictionary without braces, such as
broadcast_dimensions = array<i64: 1>, or empty.
Sourcefn op_with_regions(
&mut self,
name: &str,
operands: &[HloValue],
attributes: &str,
regions: &mut [Region<'_>],
results: &[AVal],
) -> Result<Vec<HloValue>>
fn op_with_regions( &mut self, name: &str, operands: &[HloValue], attributes: &str, regions: &mut [Region<'_>], results: &[AVal], ) -> Result<Vec<HloValue>>
Emits an operation with regions and returns its results.
§Errors
Returns an error from lowering a region’s body.
Sourcefn import(&mut self, module: &str, name_hint: &str) -> Result<String>
fn import(&mut self, module: &str, name_hint: &str) -> Result<String>
Adds the functions of another StableHLO module (such as one written
by jax.export) to the module, renamed after name_hint, and
returns the new symbol name of its public main (without @).
§Errors
Returns an error if the module cannot be parsed or has no main.
Provided Methods§
Implementations§
Source§impl dyn LowerCx + '_
impl dyn LowerCx + '_
Sourcepub fn op1(
&mut self,
name: &str,
operands: &[HloValue],
attributes: &str,
result: &AVal,
) -> HloValue
pub fn op1( &mut self, name: &str, operands: &[HloValue], attributes: &str, result: &AVal, ) -> HloValue
Emits an operation with one result.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".