@@ -97,7 +97,7 @@ impl Model {
9797 pub fn reshape_single_input(&mut self, partial_shape: &PartialShape) -> Result<()> {
9898 try_unsafe!(openvino_sys::ov_model_reshape_single_input(
9999 self.ptr,
100- partial_shape.c_struct
100+ partial_shape.as_c_struct()
101101 ))
102102 }
103103
@@ -111,67 +111,70 @@ impl Model {
111111 try_unsafe!(openvino_sys::ov_model_reshape_input_by_name(
112112 self.ptr,
113113 name.as_ptr(),
114- partial_shape.c_struct
114+ partial_shape.as_c_struct()
115115 ))
116116 }
117117
118118 /// Reshape the model with a list of (name, `partial_shape`) pairs.
119- pub fn reshape(&mut self, shapes : &[(&str, &PartialShape)]) -> Result<()> {
120- let mut c_names = Vec::with_capacity(shapes .len());
121- let mut c_shapes = Vec::with_capacity(shapes .len());
119+ pub fn reshape(&mut self, partial_shapes : &[(&str, &PartialShape)]) -> Result<()> {
120+ let mut c_names = Vec::with_capacity(partial_shapes .len());
121+ let mut c_shapes = Vec::with_capacity(partial_shapes .len());
122122 // We must keep the CStrings alive until the FFI call is finished
123- let mut names_keep_alive = Vec::with_capacity(shapes .len());
123+ let mut names_keep_alive = Vec::with_capacity(partial_shapes .len());
124124
125- for (name, shape ) in shapes {
125+ for (name, partial_shape ) in partial_shapes {
126126 let c_name = cstr!(*name);
127127 c_names.push(c_name.as_ptr());
128128 names_keep_alive.push(c_name);
129- c_shapes.push(shape.c_struct );
129+ c_shapes.push(partial_shape.as_c_struct() );
130130 }
131131
132132 try_unsafe!(openvino_sys::ov_model_reshape(
133133 self.ptr,
134134 c_names.as_mut_ptr(),
135135 c_shapes.as_ptr(),
136- shapes .len()
136+ partial_shapes .len()
137137 ))
138138 }
139139
140140 /// Reshape the model using a list of (`port_index`, `partial_shape`) pairs.
141- pub fn reshape_by_port_indexes(&mut self, shapes: &[(usize, &PartialShape)]) -> Result<()> {
142- let mut c_indexes = Vec::with_capacity(shapes.len());
143- let mut c_shapes = Vec::with_capacity(shapes.len());
141+ pub fn reshape_by_port_indexes(
142+ &mut self,
143+ partial_shapes: &[(usize, &PartialShape)],
144+ ) -> Result<()> {
145+ let mut c_indexes = Vec::with_capacity(partial_shapes.len());
146+ let mut c_shapes = Vec::with_capacity(partial_shapes.len());
144147
145- for (index, shape ) in shapes {
148+ for (index, partial_shape ) in partial_shapes {
146149 c_indexes.push(*index);
147- c_shapes.push(shape.c_struct );
150+ c_shapes.push(partial_shape.as_c_struct() );
148151 }
149152
150153 try_unsafe!(openvino_sys::ov_model_reshape_by_port_indexes(
151154 self.ptr,
152155 c_indexes.as_ptr(),
153156 c_shapes.as_ptr(),
154- shapes .len()
157+ partial_shapes .len()
155158 ))
156159 }
157160
158161 /// Reshape the model using a list of (Node/Port, `partial_shape`) pairs.
159- pub fn reshape_by_ports(&mut self, shapes : &[(&Node, &PartialShape)]) -> Result<()> {
160- let mut c_ports = Vec::with_capacity(shapes .len());
161- let mut c_shapes = Vec::with_capacity(shapes .len());
162+ pub fn reshape_by_ports(&mut self, partial_shapes : &[(&Node, &PartialShape)]) -> Result<()> {
163+ let mut c_ports = Vec::with_capacity(partial_shapes .len());
164+ let mut c_shapes = Vec::with_capacity(partial_shapes .len());
162165
163- for (node, shape ) in shapes {
166+ for (node, partial_shape ) in partial_shapes {
164167 // ov_model_reshape_by_ports expects *const *const ov_output_port_t.
165168 // Node::as_ptr returns *mut ov_output_const_port_t.
166169 c_ports.push(node.as_ptr() as *const openvino_sys::ov_output_port_t);
167- c_shapes.push(shape.c_struct );
170+ c_shapes.push(partial_shape.as_c_struct() );
168171 }
169172
170173 try_unsafe!(openvino_sys::ov_model_reshape_by_ports(
171174 self.ptr,
172175 c_ports.as_mut_ptr(),
173176 c_shapes.as_ptr(),
174- shapes .len()
177+ partial_shapes .len()
175178 ))
176179 }
177180}
0 commit comments