当前位置: 首页>>代码示例>>C++>>正文


C++ InputType类代码示例

本文整理汇总了C++中InputType的典型用法代码示例。如果您正苦于以下问题:C++ InputType类的具体用法?C++ InputType怎么用?C++ InputType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了InputType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: score

//TODO this should be a factory function!
TranslationOption::TranslationOption(const WordsRange &wordsRange
																		 , const TargetPhrase &targetPhrase
																		 , const InputType &inputType
																		 , int /*whatever*/)
: m_targetPhrase(targetPhrase)
, m_sourceWordsRange	(wordsRange)
, m_futureScore(0)
{
	const UnknownWordPenaltyProducer *up = StaticData::Instance().GetUnknownWordPenaltyProducer();
  if (up) {
		const ScoreProducer *scoreProducer = (const ScoreProducer *)up; // not sure why none of the c++ cast works
		vector<float> score(1);
		score[0] = FloorScore(-numeric_limits<float>::infinity());
		m_scoreBreakdown.Assign(scoreProducer, score);
	}

	if (inputType.GetType() == SentenceInput)
	{
		Phrase phrase = inputType.GetSubString(wordsRange);
		m_sourcePhrase = new Phrase(phrase);
	}
	else
	{ // TODO lex reordering with confusion network
		m_sourcePhrase = new Phrase(*targetPhrase.GetSourcePhrase());
		//the target phrase from a confusion network/lattice has input scores that we want to keep
		m_scoreBreakdown.PlusEquals(targetPhrase.GetScoreBreakdown());

	}
}
开发者ID:poetzhangzi,项目名称:test,代码行数:30,代码来源:TranslationOption.cpp

示例2: operator

	int operator()(const InputType &x, ValueType& fvec) const {
		m_decoder.Decode(m_rots, x);

		Vector3 v = sik.endPosition(m_rots);
		v -= m_goal;
		fvec.setZero();
		fvec.head<3>() = Eigen::Vector3f::Map(&v.x);

		// limit-exceed panelaty
		auto limpanl = fvec.tail(x.size());
		for (int i = 0; i < x.size(); i++)
		{
			if (x[i] < m_min[i])
				limpanl[i] = m_limitPanalty*(x[i] - m_min[i])*(x[i] - m_min[i]);
			else if (x[i] > m_max[i])
				limpanl[i] = m_limitPanalty*(x[i] - m_max[i])*(x[i] - m_max[i]);
		}

		if (m_useRef)
		{
			limpanl += m_refWeights *(x - m_ref);
		}

		return 0;
	}
开发者ID:flair2005,项目名称:OpenAvataring,代码行数:25,代码来源:StylizedIK+-+Copy.cpp

示例3: UTIL_THROW_IF2

void ChartParser::CreateInputPaths(const InputType &input)
{
  size_t size = input.GetSize();
  m_inputPathMatrix.resize(size);

  UTIL_THROW_IF2(input.GetType() != SentenceInput && input.GetType() != TreeInputType,
		  "Input must be a sentence or a tree, not lattice or confusion networks");
  for (size_t phaseSize = 1; phaseSize <= size; ++phaseSize) {
    for (size_t startPos = 0; startPos < size - phaseSize + 1; ++startPos) {
      size_t endPos = startPos + phaseSize -1;
      vector<InputPath*> &vec = m_inputPathMatrix[startPos];

      WordsRange range(startPos, endPos);
      Phrase subphrase(input.GetSubString(WordsRange(startPos, endPos)));
      const NonTerminalSet &labels = input.GetLabelSet(startPos, endPos);

      InputPath *node;
      if (range.GetNumWordsCovered() == 1) {
        node = new InputPath(subphrase, labels, range, NULL, NULL);
        vec.push_back(node);
      } else {
        const InputPath &prevNode = GetInputPath(startPos, endPos - 1);
        node = new InputPath(subphrase, labels, range, &prevNode, NULL);
        vec.push_back(node);
      }

      //m_inputPathQueue.push_back(node);
    }
  }
}
开发者ID:BinaryBlob,项目名称:mosesdecoder,代码行数:30,代码来源:ChartParser.cpp

示例4: TEST

TEST(FileInputTypeTest, ignoreDroppedNonNativeFiles)
{
    Document* document = Document::create();
    HTMLInputElement* input =
        HTMLInputElement::create(*document, nullptr, false);
    InputType* fileInput = FileInputType::create(*input);

    DataObject* nativeFileRawDragData = DataObject::create();
    const DragData nativeFileDragData(nativeFileRawDragData, IntPoint(), IntPoint(), DragOperationCopy);
    nativeFileDragData.platformData()->add(File::create("/native/path"));
    nativeFileDragData.platformData()->setFilesystemId("fileSystemId");
    fileInput->receiveDroppedFiles(&nativeFileDragData);
    EXPECT_EQ("fileSystemId", fileInput->droppedFileSystemId());
    ASSERT_EQ(1u, fileInput->files()->length());
    EXPECT_EQ(String("/native/path"), fileInput->files()->item(0)->path());

    DataObject* nonNativeFileRawDragData = DataObject::create();
    const DragData nonNativeFileDragData(nonNativeFileRawDragData, IntPoint(), IntPoint(), DragOperationCopy);
    FileMetadata metadata;
    metadata.length = 1234;
    const KURL url(ParsedURLStringTag(), "filesystem:http://example.com/isolated/hash/non-native-file");
    nonNativeFileDragData.platformData()->add(File::createForFileSystemFile(url, metadata, File::IsUserVisible));
    nonNativeFileDragData.platformData()->setFilesystemId("fileSystemId");
    fileInput->receiveDroppedFiles(&nonNativeFileDragData);
    // Dropping non-native files should not change the existing files.
    EXPECT_EQ("fileSystemId", fileInput->droppedFileSystemId());
    ASSERT_EQ(1u, fileInput->files()->length());
    EXPECT_EQ(String("/native/path"), fileInput->files()->item(0)->path());
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:29,代码来源:FileInputTypeTest.cpp

示例5: Train

    typename std::enable_if<NetworkTraits<ModelType>::IsSAE, void>::type
    Train(InputType& data, OutputType& /* unused */)
    {
      // Reset the training error.
      trainingError = 0;

      arma::uvec indices(batchSize);

      if (index.n_elem > batchSize)
      {
        for (size_t i = 0; i < index.n_elem; i += batchSize)
        {
          for (size_t j = 0; j < batchSize; j++)
            indices(j) = index(j + i);

          MatType input = data.rows(indices);
          net.FeedForward(input, input, error);

          trainingError += net.Error();
          net.FeedBackward(input, error);
          net.ApplyGradients();
        }

        trainingError /= (index.n_elem / batchSize);
      }
      else
      {
        net.FeedForward(data, data, error);
        trainingError += net.Error();
        net.FeedBackward(data, error);
        net.ApplyGradients();
      }
    }
开发者ID:Andrew-He,项目名称:mlpack,代码行数:33,代码来源:trainer.hpp

示例6: ChartRuleLookupManagerCYKPlus

ChartRuleLookupManagerOnDisk::ChartRuleLookupManagerOnDisk(
  const InputType &sentence,
  const ChartCellCollectionBase &cellColl,
  const PhraseDictionaryOnDisk &dictionary,
  OnDiskPt::OnDiskWrapper &dbWrapper,
  const std::vector<FactorType> &inputFactorsVec,
  const std::vector<FactorType> &outputFactorsVec,
  const std::string &filePath)
  : ChartRuleLookupManagerCYKPlus(sentence, cellColl)
  , m_dictionary(dictionary)
  , m_dbWrapper(dbWrapper)
  , m_inputFactorsVec(inputFactorsVec)
  , m_outputFactorsVec(outputFactorsVec)
  , m_filePath(filePath)
{
  CHECK(m_expandableDottedRuleListVec.size() == 0);
  size_t sourceSize = sentence.GetSize();
  m_expandableDottedRuleListVec.resize(sourceSize);

  for (size_t ind = 0; ind < m_expandableDottedRuleListVec.size(); ++ind) {
    DottedRuleOnDisk *initDottedRule = new DottedRuleOnDisk(m_dbWrapper.GetRootSourceNode());

    DottedRuleStackOnDisk *processedStack = new DottedRuleStackOnDisk(sourceSize - ind + 1);
    processedStack->Add(0, initDottedRule); // init rule. stores the top node in tree

    m_expandableDottedRuleListVec[ind] = processedStack;
  }
}
开发者ID:bbtt505,项目名称:mosesdecoder,代码行数:28,代码来源:ChartRuleLookupManagerOnDisk.cpp

示例7: Gradient

 void Gradient(const InputType& input,
               const arma::Mat<eT>& d,
               GradientDataType& g)
 {
   g = d * input.t() / static_cast<typename InputType::value_type>(
       input.n_cols) + lambda * weights;
 }
开发者ID:AmesianX,项目名称:mlpack,代码行数:7,代码来源:sparse_input_layer.hpp

示例8: ChartRuleLookupManager

ChartRuleLookupManagerOnDisk::ChartRuleLookupManagerOnDisk(
  const InputType &sentence,
  const ChartCellCollection &cellColl,
  const PhraseDictionaryOnDisk &dictionary,
  OnDiskPt::OnDiskWrapper &dbWrapper,
  const LMList *languageModels,
  const WordPenaltyProducer *wpProducer,
  const std::vector<FactorType> &inputFactorsVec,
  const std::vector<FactorType> &outputFactorsVec,
  const std::vector<float> &weight,
  const std::string &filePath)
  : ChartRuleLookupManager(sentence, cellColl)
  , m_dictionary(dictionary)
  , m_dbWrapper(dbWrapper)
  , m_languageModels(languageModels)
  , m_wpProducer(wpProducer)
  , m_inputFactorsVec(inputFactorsVec)
  , m_outputFactorsVec(outputFactorsVec)
  , m_weight(weight)
  , m_filePath(filePath)
{
  assert(m_expandableDottedRuleListVec.size() == 0);
  size_t sourceSize = sentence.GetSize();
  m_expandableDottedRuleListVec.resize(sourceSize);

  for (size_t ind = 0; ind < m_expandableDottedRuleListVec.size(); ++ind) {
    DottedRuleOnDisk *initDottedRule = new DottedRuleOnDisk(m_dbWrapper.GetRootSourceNode());

    DottedRuleStackOnDisk *processedStack = new DottedRuleStackOnDisk(sourceSize - ind + 1);
    processedStack->Add(0, initDottedRule); // init rule. stores the top node in tree

    m_expandableDottedRuleListVec[ind] = processedStack;
  }
}
开发者ID:fancycheung,项目名称:ondrej-test-project-1,代码行数:34,代码来源:ChartRuleLookupManagerOnDisk.cpp

示例9: df

	int df(const InputType &x, JacobianType& fjac) {
		m_decoder.Decode(m_rots, x);

		fjac.setZero();

		m_jacb.resize(3, 3 * n);
		sik.endPositionJaccobiRespectEuler(m_rots, 
			array_view<Vector3>(reinterpret_cast<Vector3*>(m_jacb.data()),3*n));

		m_decoder.EncodeJacobi(m_rots, m_jacb);

		fjac.topRows<3>() = m_jacb;//Eigen::Matrix3Xf::Map(&m_jac[0].x, 3, 3 * n);

		// limit-exceed panelaty
		for (int i = 0; i < x.size(); i++)
		{
			if (x[i] < m_min[i])
				fjac(3 + i, i) = m_limitPanalty * (x[i] - m_min[i]);
			else if (x[i] > m_max[i])
				fjac(3 + i, i) = m_limitPanalty * (x[i] - m_max[i]);

			if (m_useRef)
			{
				fjac(3 + i, i) += m_refWeights;
			}
		}

		return 0;
	}
开发者ID:flair2005,项目名称:OpenAvataring,代码行数:29,代码来源:StylizedIK+-+Copy.cpp

示例10: ChartRuleLookupManagerCYKPlus

ChartRuleLookupManagerMemory::ChartRuleLookupManagerMemory(
  const InputType &src,
  const ChartCellCollectionBase &cellColl,
  const PhraseDictionarySCFG &ruleTable)
  : ChartRuleLookupManagerCYKPlus(src, cellColl)
  , m_ruleTable(ruleTable)
{
  CHECK(m_dottedRuleColls.size() == 0);
  size_t sourceSize = src.GetSize();
  m_dottedRuleColls.resize(sourceSize);

  const PhraseDictionaryNodeSCFG &rootNode = m_ruleTable.GetRootNode();

  for (size_t ind = 0; ind < m_dottedRuleColls.size(); ++ind) {
#ifdef USE_BOOST_POOL
    DottedRuleInMemory *initDottedRule = m_dottedRulePool.malloc();
    new (initDottedRule) DottedRuleInMemory(rootNode);
#else
    DottedRuleInMemory *initDottedRule = new DottedRuleInMemory(rootNode);
#endif

    DottedRuleColl *dottedRuleColl = new DottedRuleColl(sourceSize - ind + 1);
    dottedRuleColl->Add(0, initDottedRule); // init rule. stores the top node in tree

    m_dottedRuleColls[ind] = dottedRuleColl;
  }
}
开发者ID:lolobaro,项目名称:mosesdecoder-stackrescore,代码行数:27,代码来源:ChartRuleLookupManagerMemory.cpp

示例11: Evaluate

typename MRFIsingSmoothnessTerm<TInputValueType, TOutputValueType>::OutputType
MRFIsingSmoothnessTerm<TInputValueType, TOutputValueType>::
Evaluate(const InputType &input) const
{
	if(input.Size() != Superclass::m_NumberOfParameters)
	{
		itkExceptionMacro(<< "Not the expected number of paramters");
	}
开发者ID:zhuangfangwang,项目名称:PhDProject,代码行数:8,代码来源:MRFIsingSmoothnessTerm.hpp

示例12: handleKeyupEvent

void BaseClickableWithKeyInputType::handleKeyupEvent(InputType& inputType, KeyboardEvent* event)
{
    const String& key = event->keyIdentifier();
    if (key != "U+0020")
        return;
    // Simulate mouse click for spacebar for button types.
    inputType.dispatchSimulatedClickIfActive(event);
}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:8,代码来源:BaseClickableWithKeyInputType.cpp

示例13: Phrase

//TODO this should be a factory function!
TranslationOption::TranslationOption(const WordsRange &wordsRange
																		, const TargetPhrase &targetPhrase
																		, const InputType &inputType)
: m_targetPhrase(targetPhrase)
, m_sourceWordsRange(wordsRange)
{
	// set score
	m_scoreBreakdown.PlusEquals(targetPhrase.GetScoreBreakdown());

	if (inputType.GetType() == SentenceInput)
	{
		Phrase phrase = inputType.GetSubString(wordsRange);
		m_sourcePhrase = new Phrase(phrase);
	}
	else
	{ // TODO lex reordering with confusion network
		m_sourcePhrase = new Phrase(*targetPhrase.GetSourcePhrase());
	}
}
开发者ID:poetzhangzi,项目名称:test,代码行数:20,代码来源:TranslationOption.cpp

示例14:

Search::Search(Manager& manager, const InputType &source)
  : m_manager(manager)
  , m_source(source)
  , m_inputPath()
  , m_initialTransOpt()
  , m_options(manager.options())
  , interrupted_flag(0)
  , m_bitmaps(source.GetSize(), source.m_sourceCompleted)
{
  m_initialTransOpt.SetInputPath(m_inputPath);
}
开发者ID:hschreib,项目名称:mosesdecoder,代码行数:11,代码来源:Search.cpp

示例15: ResultType

typename Tokenizer<TokenEnumType, InputType>::ResultType Tokenizer<TokenEnumType, InputType>::Tokenize(const InputType &input) const
{
    typename ResultType::TokenList tokens;

    auto iterator = input.begin( );

    while (iterator < input.end( ))
    {
        TokenType token;

        readToken( iterator, input.end( ), token );

        iterator += token.value.size( );

        if (token.value.empty( ))
            ++iterator;
        else
            tokens.push_back( token );
    }

    return ResultType( tokens );
}
开发者ID:AustinBrunkhorst,项目名称:CPP-Reflection,代码行数:22,代码来源:Tokenizer.hpp


注:本文中的InputType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。