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


C++ dimensions函数代码示例

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


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

示例1:

std::vector<std::string> petabricks::IterationDefinition::packedargs() const {
  std::string t[] = {
    "IndexT "COORD_BEGIN_STR"["+jalib::XToString(dimensions())+"]",
    "IndexT "COORD_END_STR"["+jalib::XToString(dimensions())+"]"
  };
  return std::vector<std::string>(t, t+2);
}
开发者ID:AikidoGuy,项目名称:petabricks,代码行数:7,代码来源:iterationorders.cpp

示例2: dimensions

/**
 * See also constructor that takes a std::istream.
 */
bool HaarWavelet::write(std::ostream &output) const
{
    if (dimensions() == 0) //won't store a meaningless wavelet
    {
        return false;
    }

    output << dimensions() << ' ';

    bool first = true;
    for (unsigned int i = 0; i < dimensions(); i++)
    {
        if (first)
        {
            first = false;
        }
        else
        {
            output << ' ';
        }
        output << rects[i].x << ' '
               << rects[i].y << ' '
               << rects[i].width << ' '
               << rects[i].height << ' '
               << weights[i];
    }

    return true;
}
开发者ID:ramiromagalhaes,项目名称:haarcommon,代码行数:32,代码来源:haarwavelet.cpp

示例3: user_assert

Expr ImageParam::operator()() const {
    user_assert(dimensions() == 0)
        << "Zero-argument access to Buffer " << name()
        << ", which has " << dimensions() << "dimensions.\n";
    std::vector<Expr> args;
    return Internal::Call::make(param, args);
}
开发者ID:AheadIO,项目名称:Halide,代码行数:7,代码来源:Param.cpp

示例4: return

int QPushButton::baselinePosition(int height) const
{
    // Button text is centered vertically, with a fudge factor to account for the shadow.

    return (int)ceil(-dimensions()[topMargin]
        + ((height + dimensions()[topMargin] + dimensions()[bottomMargin])) / 2.0
        - dimensions()[baselineFudgeFactor]);
}
开发者ID:BackupTheBerlios,项目名称:wxwebcore-svn,代码行数:8,代码来源:KWQPushButton.cpp

示例5: fprintf

 int DynImage::size(int i) const {
     if (i >= dimensions()) {
         fprintf(stderr,
                 "ERROR: accessing size of dim %d of %d-dimensional image %s\n",
                 i, dimensions(), name().c_str());
         assert(i < dimensions());
     }
     return contents->size[i];
 }
开发者ID:gabriel-kent,项目名称:Halide,代码行数:9,代码来源:Image.cpp

示例6: indexSize

void Grid::__init() {
	gSize = indexSize();

	if (trueDimensions() != dimensions())
		cout << gridName << ": dim = " << dimensions() << ", trueDim = "
				<< trueDimensions() << ", index range = " << String(getN())
				<< ", index size = " << indexSize() << endl;

}
开发者ID:blake0701,项目名称:terrainBlockMesher,代码行数:9,代码来源:Grid.cpp

示例7: read

bool MyHaarWavelet::read(std::istream &input)
{
    if ( !HaarWavelet::read(input) )
    {
        return false;
    }

    means.resize(dimensions());
    for (unsigned int i = 0; i < dimensions(); i++)
    {
        input >> means[i];
    }

    return true;
}
开发者ID:ramiromagalhaes,项目名称:haarcommon,代码行数:15,代码来源:haarwavelet.cpp

示例8: assert

SequenceDataPtr TransposeTransformer::TypedApply(SequenceDataPtr sequence,
                                                 const StreamDescription &inputStream,
                                                 const StreamDescription &outputStream)
{
    assert(inputStream.m_storageType == StorageType::dense);
    auto inputSequence = static_cast<DenseSequenceData&>(*sequence.get());
    assert(inputSequence.m_numberOfSamples == 1);
    assert(inputStream.m_sampleLayout->GetNumElements() == outputStream.m_sampleLayout->GetNumElements());

    size_t count = inputStream.m_sampleLayout->GetNumElements() * GetSizeByType(inputStream.m_elementType);

    auto result = std::make_shared<DenseSequenceWithBuffer>();
    result->m_buffer.resize(count);

    ImageDimensions dimensions(*inputStream.m_sampleLayout, ImageLayoutKind::HWC);
    size_t rowCount = dimensions.m_height * dimensions.m_width;
    size_t channelCount = dimensions.m_numChannels;

    auto src = reinterpret_cast<TElemType*>(inputSequence.m_data);
    auto dst = reinterpret_cast<TElemType*>(result->m_buffer.data());

    for (size_t irow = 0; irow < rowCount; irow++)
    {
        for (size_t icol = 0; icol < channelCount; icol++)
        {
            dst[icol * rowCount + irow] = src[irow * channelCount + icol];
        }
    }

    result->m_sampleLayout = outputStream.m_sampleLayout;
    result->m_data = result->m_buffer.data();
    result->m_numberOfSamples = inputSequence.m_numberOfSamples;
    return result;
}
开发者ID:JohnCraigPublic,项目名称:CNTK,代码行数:34,代码来源:ImageTransformers.cpp

示例9: config

void TransposeTransformer::Initialize(TransformerPtr next,
                                      const ConfigParameters &readerConfig)
{
    TransformerBase::Initialize(next, readerConfig);

    // Currently we only support a single stream.
    ImageConfigHelper config(readerConfig);
    size_t featureStreamId = config.GetFeatureStreamId();
    m_appliedStreamIds.push_back(featureStreamId);

    const auto &inputStreams = GetInputStreams();
    m_outputStreams.resize(inputStreams.size());
    std::copy(inputStreams.begin(), inputStreams.end(), m_outputStreams.begin());

    for (auto id : m_appliedStreamIds)
    {
        auto &stream = inputStreams[id];

        ImageDimensions dimensions(*stream->m_sampleLayout, HWC);

        // Changing from NHWC to NCHW
        auto changedStream = std::make_shared<StreamDescription>(*stream);
        changedStream->m_sampleLayout = std::make_shared<TensorShape>(dimensions.AsTensorShape(CHW));
        m_outputStreams[id] = changedStream;
    }
}
开发者ID:6779660,项目名称:CNTK,代码行数:26,代码来源:ImageTransformers.cpp

示例10: dimensions

void Player::init(b2World* world, const glm::vec2& position, taengine::SoundEffect jumpEffect) {
	m_hitbox = new Box;
	glm::vec2 dimensions(1.0f, 2.5f);
	static_cast<Box*> (m_hitbox)->init(world, b2_dynamicBody, position, true, false,
		dimensions, 1.0f, 1.0f, 0.0f, false, FixtureTag::PLAYER_BODY, FixtureTag::ALL);

	m_hitbox->getBody()->SetLinearDamping(2.0f);
	m_hitbox->getBody()->SetUserData(this);

	//add foot sensor fixture
	b2PolygonShape polygonShape;
	polygonShape.SetAsBox(0.45f, 0.2f, b2Vec2(0, -1.25f), 0);
	b2FixtureDef fixtureDef;
	fixtureDef.isSensor = true;
	fixtureDef.shape = &polygonShape;
	fixtureDef.filter.categoryBits = FixtureTag::PLAYER_FOOT;
	fixtureDef.filter.maskBits = FixtureTag::WALL | FixtureTag::ENEMY_BODY;
	b2Fixture* footSensorFixture = m_hitbox->getBody()->CreateFixture(&fixtureDef);
	footSensorFixture->SetUserData((void*)3);

	m_tileSheet.init(taengine::ResourceManager::getTexture("Sprites/anya.png"), glm::ivec2(7, 4));
	m_drawDimensions = glm::vec2(3.0f, 3.0f);

	m_jumpEffect = jumpEffect;

	m_animationSpeed = 0.15f;
	m_animationTime = 0.0f;

	m_direction = 1;

	m_footContacts = 0;

	m_killCount = 0;
	m_moveState = PlayerMoveState::STANDING;
}
开发者ID:NihilAleph,项目名称:ElvenBlood,代码行数:35,代码来源:Player.cpp

示例11: paper_set_units

void paper_set_units(paper_s *p, units_t ut)
{
    // Sanity check parameters.
  assert(p);
  p->units = ut;
  dimensions(p);
}
开发者ID:PatrickHead,项目名称:blue,代码行数:7,代码来源:paper.c

示例12: resize_implement

void
TexelStoreGL::
resize_implement(int new_num_layers)
{
  fastuidraw::ivec3 dims(dimensions());
  int old_num_layers(dims.z());

  if(m_texture_as_r8 != 0)
    {
      /* a resize generates a new texture which then has
         a new backing store. The texture view would then
         be using the old backing store which is useless.
         We delete the old texture view and let texture()
         recreate the view on demand.
       */
      glDeleteTextures(1, &m_texture_as_r8);
      m_texture_as_r8 = 0;
    }

  dims.z() = new_num_layers;
  m_backing_store.resize(dims);

  std::vector<uint8_t> right(dims.y(), 0), bottom(dims.x(), 0);
  for(int layer = old_num_layers; layer < new_num_layers; ++layer)
    {
      set_data(dims.x() - 1, 0, layer, //top right
               1, dims.y(), //entire height
               fastuidraw::make_c_array(right));

      set_data(0, dims.y() - 1, layer, //bottom left
               dims.x() - 1, 1, //entire width
               fastuidraw::make_c_array(bottom));
    }
}
开发者ID:cjcappel,项目名称:fastuidraw,代码行数:34,代码来源:glyph_atlas_gl.cpp

示例13: resize_implement

void
BackingStore::
resize_implement(int new_num_layers)
{
  fastuidraw::ivec2 dims(dimensions());
  m_backing_store.resize(dimensions_for_store(dims.x(), new_num_layers));
}
开发者ID:01org,项目名称:fastuidraw,代码行数:7,代码来源:colorstop_atlas_gl.cpp

示例14: configHelper

ImageDataDeserializer::ImageDataDeserializer(const ConfigParameters& config)
{
    ImageConfigHelper configHelper(config);
    m_streams = configHelper.GetStreams();
    assert(m_streams.size() == 2);
    const auto& label = m_streams[configHelper.GetLabelStreamId()];
    const auto& feature = m_streams[configHelper.GetFeatureStreamId()];

    // Expect data in HWC.
    ImageDimensions dimensions(*feature->m_sampleLayout, configHelper.GetDataFormat());
    feature->m_sampleLayout = std::make_shared<TensorShape>(dimensions.AsTensorShape(HWC));

    label->m_storageType = StorageType::sparse_csc;
    feature->m_storageType = StorageType::dense;

    m_featureElementType = feature->m_elementType;
    size_t labelDimension = label->m_sampleLayout->GetDim(0);

    if (label->m_elementType == ElementType::tfloat)
    {
        m_labelGenerator = std::make_shared<TypedLabelGenerator<float>>();
    }
    else if (label->m_elementType == ElementType::tdouble)
    {
        m_labelGenerator = std::make_shared<TypedLabelGenerator<double>>();
    }
    else
    {
        RuntimeError("Unsupported label element type '%d'.", label->m_elementType);
    }

    CreateSequenceDescriptions(configHelper.GetMapPath(), labelDimension);
}
开发者ID:wgapl,项目名称:CNTK,代码行数:33,代码来源:ImageDataDeserializer.cpp

示例15: SummaryConfig

SummaryConfig::SummaryConfig( const Deck& deck, const EclipseState& es , const ParseContext& parseContext)
    : SummaryConfig( deck,
                        *es.getSchedule(),
                        es.get3DProperties(),
                        parseContext,
                        dimensions( *es.getInputGrid() ) )
{}
开发者ID:magnesj,项目名称:ResInsight,代码行数:7,代码来源:SummaryConfig.cpp


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