File tree Expand file tree Collapse file tree 10 files changed +49
-60
lines changed Expand file tree Collapse file tree 10 files changed +49
-60
lines changed Original file line number Diff line number Diff line change @@ -140,13 +140,10 @@ struct type_convert<
140140 final {
141141 explicit type_convert (ETensor value)
142142 : value_(value),
143- converted_(
144- at::from_blob (
145- value_.mutable_data_ptr(),
146- std::vector<int64_t>{
147- value_.sizes ().begin (),
148- value_.sizes ().end ()},
149- c10::ScalarType (value_.scalar_type()))) {}
143+ converted_(at::from_blob(
144+ value_.mutable_data_ptr(),
145+ std::vector<int64_t>{value_.sizes ().begin (), value_.sizes ().end ()},
146+ c10::ScalarType (value_.scalar_type()))) {}
150147
151148 ATensor call () {
152149 return converted_;
Original file line number Diff line number Diff line change @@ -90,18 +90,16 @@ runtime::Error save_ptd(
9090 builder.CreateVector (
9191 tensor.dim_order ().data (), tensor.dim_order ().size ()));
9292
93- named_data.push_back (
94- ::flat_tensor_flatbuffer::CreateNamedData (
95- /* _fbb=*/ builder,
96- /* key=*/ key,
97- /* segment_index=*/ i,
98- /* tensor_layout=*/ tensor_layout));
99-
100- segments.push_back (
101- ::flat_tensor_flatbuffer::CreateDataSegment (
102- /* _fbb=*/ builder,
103- /* offset=*/ total_segment_size,
104- /* size=*/ tensor.nbytes()));
93+ named_data.push_back (::flat_tensor_flatbuffer::CreateNamedData (
94+ /* _fbb=*/ builder,
95+ /* key=*/ key,
96+ /* segment_index=*/ i,
97+ /* tensor_layout=*/ tensor_layout));
98+
99+ segments.push_back (::flat_tensor_flatbuffer::CreateDataSegment (
100+ /* _fbb=*/ builder,
101+ /* offset=*/ total_segment_size,
102+ /* size=*/ tensor.nbytes ()));
105103
106104 // Do not pad the last tensor.
107105 total_segment_size += (i == tensor_count - 1 )
Original file line number Diff line number Diff line change @@ -587,12 +587,11 @@ PYBIND11_MODULE(_llm_runner, m) {
587587 if (audio_tensor.scalar_type () == torch::kUInt8 ) {
588588 uint8_t * data = audio_tensor.data_ptr <uint8_t >();
589589 std::vector<uint8_t > audio_data (data, data + audio_tensor.numel ());
590- return MultimodalInput (
591- RawAudio{
592- std::move (audio_data),
593- static_cast <int32_t >(batch_size),
594- static_cast <int32_t >(n_channels),
595- static_cast <int32_t >(n_samples)});
590+ return MultimodalInput (RawAudio{
591+ std::move (audio_data),
592+ static_cast <int32_t >(batch_size),
593+ static_cast <int32_t >(n_channels),
594+ static_cast <int32_t >(n_samples)});
596595 } else {
597596 throw std::runtime_error (
598597 " Unsupported raw audio tensor dtype. Only uint8 is supported for raw audio." );
Original file line number Diff line number Diff line change @@ -195,9 +195,8 @@ runtime::Error Module::load(const Program::Verification verification) {
195195 for (const auto & data_map : named_data_maps_) {
196196 raw_data_maps.push_back (data_map.get ());
197197 }
198- auto res_merged = MergedDataMap::load (
199- runtime::Span<const NamedDataMap*>(
200- raw_data_maps.data (), raw_data_maps.size ()));
198+ auto res_merged = MergedDataMap::load (runtime::Span<const NamedDataMap*>(
199+ raw_data_maps.data (), raw_data_maps.size ()));
201200 if (!res_merged.ok ()) {
202201 return res_merged.error ();
203202 }
@@ -330,9 +329,8 @@ runtime::Error Module::set_inputs(
330329 const std::vector<runtime::EValue>& input_values) {
331330 ET_CHECK_OK_OR_RETURN_ERROR (load_method (method_name));
332331 auto & method = methods_.at (method_name).method ;
333- return method->set_inputs (
334- executorch::aten::ArrayRef<runtime::EValue>(
335- input_values.data (), input_values.size ()));
332+ return method->set_inputs (executorch::aten::ArrayRef<runtime::EValue>(
333+ input_values.data (), input_values.size ()));
336334}
337335
338336runtime::Error Module::set_output (
Original file line number Diff line number Diff line change @@ -34,10 +34,9 @@ class MergedDataMap final
3434 * @param[in] data_maps vector of NamedDataMap pointers to merge.
3535 * Note: the data maps must outlive the MergedDataMap instance.
3636 */
37- static executorch::runtime::Result<MergedDataMap> load (
38- executorch::runtime::Span<
39- const executorch::ET_RUNTIME_NAMESPACE::NamedDataMap*>
40- named_data_maps);
37+ static executorch::runtime::Result<MergedDataMap>
38+ load (executorch::runtime::Span<
39+ const executorch::ET_RUNTIME_NAMESPACE::NamedDataMap*> named_data_maps);
4140
4241 /* *
4342 * Retrieve the tensor_layout for the specified key.
Original file line number Diff line number Diff line change @@ -294,17 +294,15 @@ struct PyBundledModule : public BundledModule {
294294 uint32_t bundled_input_pool_size)
295295 : BundledModule(buffer.cast<std::string_view>().data()),
296296 bundled_program_ptr_(buffer),
297- program_ptr_(
298- static_cast <const void *>(
299- bundled_program_flatbuffer::GetBundledProgram (
300- get_bundled_program_ptr ())
301- ->program()
302- ->data())),
303- program_len_(
297+ program_ptr_(static_cast <const void *>(
304298 bundled_program_flatbuffer::GetBundledProgram (
305299 get_bundled_program_ptr ())
306300 ->program()
307- ->size()) {}
301+ ->data())),
302+ program_len_(bundled_program_flatbuffer::GetBundledProgram(
303+ get_bundled_program_ptr ())
304+ ->program()
305+ ->size()) {}
308306
309307 static std::unique_ptr<PyBundledModule> load_from_buffer (
310308 const py::bytes& buffer,
Original file line number Diff line number Diff line change @@ -101,9 +101,9 @@ class ET_EXPERIMENTAL JsTokenizer {
101101 if (data.isString ()) {
102102 Error error = tokenizer_->load (data.as <std::string>());
103103 THROW_IF_ERROR (error, " Failed to load tokenizer" );
104- } else if (data.instanceof (val::global (" Uint8Array" ))) {
104+ } else if (data.instanceof (val::global (" Uint8Array" ))) {
105105 return load_from_uint8_array (data);
106- } else if (data.instanceof (val::global (" ArrayBuffer" ))) {
106+ } else if (data.instanceof (val::global (" ArrayBuffer" ))) {
107107 return load_from_uint8_array (val::global (" Uint8Array" ).new_ (data));
108108 } else {
109109 THROW_JS_ERROR (
Original file line number Diff line number Diff line change @@ -394,7 +394,8 @@ EValue to_evalue(val v) {
394394 } else if (type_str == " object" ) {
395395 // If it is an object, assume it is a tensor.
396396 THROW_IF_FALSE (
397- v.instanceof (val::module_property (" Tensor" )),
397+ v.instanceof
398+ (val::module_property (" Tensor" )),
398399 " Received non-tensor object: %s" ,
399400 val::global (" JSON" ).call <std::string>(" stringify" , v).c_str ());
400401 return EValue (v.as <JsTensor&>().get_tensor ());
@@ -591,9 +592,9 @@ class ET_EXPERIMENTAL JsModule final {
591592 data.as <std::string>(),
592593 Module::LoadMode::File,
593594 std::move (etdump_gen)));
594- } else if (data.instanceof (val::global (" Uint8Array" ))) {
595+ } else if (data.instanceof (val::global (" Uint8Array" ))) {
595596 return load_from_uint8_array (data);
596- } else if (data.instanceof (val::global (" ArrayBuffer" ))) {
597+ } else if (data.instanceof (val::global (" ArrayBuffer" ))) {
597598 return load_from_uint8_array (val::global (" Uint8Array" ).new_ (data));
598599 } else {
599600 THROW_JS_ERROR (
Original file line number Diff line number Diff line change @@ -88,15 +88,15 @@ class OpProdIntOutTest : public ::testing::Test {
8888 }
8989};
9090
91- TEST_F (OpProdOutTest, SmokeTest) {
91+ TEST_F (OpProdOutTest, SmokeTest){
9292#define TEST_ENTRY (ctype, dtype ) test_dtype<ScalarType::dtype>();
93- ET_FORALL_REALHBBF16_TYPES (TEST_ENTRY)
93+ ET_FORALL_REALHBBF16_TYPES (TEST_ENTRY)
9494#undef TEST_ENTRY
9595}
9696
97- TEST_F (OpProdIntOutTest, SmokeTest) {
97+ TEST_F (OpProdIntOutTest, SmokeTest){
9898#define TEST_ENTRY (ctype, dtype ) test_dtype<ScalarType::dtype>();
99- ET_FORALL_REALHBBF16_TYPES (TEST_ENTRY)
99+ ET_FORALL_REALHBBF16_TYPES (TEST_ENTRY)
100100#undef TEST_ENTRY
101101}
102102
Original file line number Diff line number Diff line change @@ -193,11 +193,10 @@ class BackendDelegate final {
193193 }
194194 case executorch_flatbuffer::DataLocation::SEGMENT: {
195195 const char * backend_id = delegate.id ()->c_str ();
196- return program->LoadSegment (
197- DataLoader::SegmentInfo (
198- DataLoader::SegmentInfo::Type::Backend,
199- processed->index (),
200- backend_id));
196+ return program->LoadSegment (DataLoader::SegmentInfo (
197+ DataLoader::SegmentInfo::Type::Backend,
198+ processed->index (),
199+ backend_id));
201200 }
202201 default :
203202 ET_LOG (
@@ -470,9 +469,9 @@ Error Method::parse_values(const NamedDataMap* external_data_map) {
470469 static_cast <const executorch_flatbuffer::Int*>(val)->int_val ());
471470 } break ;
472471 case executorch_flatbuffer::KernelTypes::Double: {
473- new (&values_[i]) EValue (
474- static_cast <const executorch_flatbuffer::Double*>(val)
475- ->double_val ());
472+ new (&values_[i])
473+ EValue ( static_cast <const executorch_flatbuffer::Double*>(val)
474+ ->double_val ());
476475 } break ;
477476 case executorch_flatbuffer::KernelTypes::Bool: {
478477 new (&values_[i]) EValue (
You can’t perform that action at this time.
0 commit comments