1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "media/learning/common/learning_task.h" 6 7 #include "base/hash/hash.h" 8 #include "base/no_destructor.h" 9 10 namespace media { 11 namespace learning { 12 13 LearningTask::LearningTask() = default; 14 LearningTask(const std::string & name,Model model,std::initializer_list<ValueDescription> feature_init_list,ValueDescription target_description)15LearningTask::LearningTask( 16 const std::string& name, 17 Model model, 18 std::initializer_list<ValueDescription> feature_init_list, 19 ValueDescription target_description) 20 : name(name), 21 model(model), 22 feature_descriptions(std::move(feature_init_list)), 23 target_description(target_description) {} 24 25 LearningTask::LearningTask(const LearningTask&) = default; 26 27 LearningTask::~LearningTask() = default; 28 GetId() const29LearningTask::Id LearningTask::GetId() const { 30 return base::PersistentHash(name); 31 } 32 33 // static Empty()34const LearningTask& LearningTask::Empty() { 35 static const base::NoDestructor<LearningTask> empty_task; 36 return *empty_task; 37 } 38 39 } // namespace learning 40 } // namespace media 41