Skip to content

Commit 63ce338

Browse files
committed
chore: lints
1 parent df34358 commit 63ce338

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

wonnx/src/gpu.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub struct GpuModel {
3939
/// An operation that is performed on the GPU as part of inference
4040
enum GpuStep {
4141
/// A statically, pre-filled buffer containing tensor data
42-
Initializer(Arc<Buffer>),
42+
Initializer(),
4343

4444
/// A buffer containing tensor data that is obtained from inference input
4545
Input(String, Arc<Buffer>),
@@ -582,7 +582,7 @@ impl GpuModel {
582582
),
583583
buffer: tensor_buffer.clone(),
584584
});
585-
GpuStep::Initializer(tensor_buffer)
585+
GpuStep::Initializer()
586586
}
587587
// For inputs we create an empty buffer that can be used at inference time to supply input data
588588
NodeDefinition::Input(input_def) => {
@@ -711,9 +711,8 @@ impl TensorProtoExtra for TensorProto {
711711
let ints: Vec<i32> = self
712712
.get_raw_data()
713713
.iter()
714-
.map(|x| (*x).try_into())
715-
.collect::<Result<Vec<i32>, _>>()
716-
.map_err(|_e| GpuError::OutOfBoundsError)?;
714+
.map(|x| (*x as i32))
715+
.collect::<Vec<i32>>();
717716
let raw_data = bytemuck::cast_slice(&ints);
718717
buffer_with_bytes(device, readable, self.get_name(), raw_data)
719718
}
@@ -935,7 +934,7 @@ impl GpuStep {
935934
inputs: &HashMap<String, InputTensor>,
936935
) -> Result<(), GpuError> {
937936
match self {
938-
GpuStep::None | GpuStep::Forward(_) | GpuStep::Initializer(_) => {
937+
GpuStep::None | GpuStep::Forward(_) | GpuStep::Initializer() => {
939938
// Buffer already filled, no need to encode anything at this point.
940939
Ok(())
941940
}

wonnx/src/optimizer.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl<'model> Optimizer<'model> {
174174
};
175175
assert_eq!(op_def.proto.get_op_type(), "Constant");
176176
let proto = &op_def.proto;
177-
let output_name = proto.output.get(0).unwrap().to_owned();
177+
let output_name = proto.output.first().unwrap().to_owned();
178178

179179
let mut tp: TensorProto =
180180
if let Ok(values) = proto.get_attribute_value::<Vec<f32>>("value_floats", None) {
@@ -249,7 +249,7 @@ impl<'model> Optimizer<'model> {
249249

250250
// Create an output node so we can perform inference for this node
251251
if let NodeDefinition::Operator(op_def) = node.definition() {
252-
let output_name = op_def.proto.output.get(0).unwrap().to_owned();
252+
let output_name = op_def.proto.output.first().unwrap().to_owned();
253253

254254
let out_node = Arc::new(Node {
255255
definition: NodeDefinition::Outputs {

0 commit comments

Comments
 (0)