MCPcopy Create free account
hub / github.com/Gadersd/stable-diffusion-burn / tensor_to_array_2

Function tensor_to_array_2

src/model/load.rs:162–166  ·  view source on GitHub ↗
(x: Tensor<B, 1>)

Source from the content-addressed store, hash-verified

160}
161
162pub fn tensor_to_array_2<B: Backend>(x: Tensor<B, 1>) -> [usize; 2] {
163 let vec: Vec<<B as Backend>::FloatElem> = x.into_data().to_vec().unwrap();
164 assert!(vec.len() == 2, "Tensor length must be 2.");
165 [vec[0].to_usize(), vec[1].to_usize()]
166}
167
168pub fn tensor_to_array<const N: usize, B: Backend>(x: Tensor<B, 1>) -> [usize; N] {
169 let vec: Vec<<B as Backend>::FloatElem> = x.into_data().to_vec().unwrap();

Callers 2

load_conv2dFunction · 0.85
load_padded_conv2dFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected