MCPcopy Create free account
hub / github.com/ciphermodelabs/ciphercore / put_in_bits

Function put_in_bits

ciphercore-base/src/ops/utils.rs:105–114  ·  view source on GitHub ↗

Panics if `x` is not an array.

(x: Node)

Source from the content-addressed store, hash-verified

103
104/// Panics if `x` is not an array.
105pub fn put_in_bits(x: Node) -> Result<Node> {
106 let shape = x.get_type()?.get_dimensions();
107 if shape.len() == 1 {
108 Ok(x)
109 } else {
110 let mut axes_permutation: Vec<u64> = (1..shape.len()).map(|x| x as u64).collect();
111 axes_permutation.push(0);
112 Ok(x.permute_axes(axes_permutation)?)
113 }
114}
115
116pub fn zeros_like(x: Node) -> Result<Node> {
117 x.get_graph().zeros(x.get_type()?)

Callers 7

instantiateMethod · 0.85
instantiateMethod · 0.85
instantiateMethod · 0.85
instantiateMethod · 0.85
instantiateMethod · 0.85
instantiateMethod · 0.85

Calls 4

get_dimensionsMethod · 0.80
get_typeMethod · 0.45
pushMethod · 0.45
permute_axesMethod · 0.45

Tested by

no test coverage detected