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


C++ Activation类代码示例

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


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

示例1: main

int main() {
	Activation acv;
	std::cout << "Sigmoid Function Val = 2.0 :: " << acv.getSigmoid(2.0) << std::endl;
	std::cout << "GradSigmoid Function Val = 2.0 :: " << acv.getGradSigmoid(2.0) << std::endl;

	std::cout << "ReLU Function Val = 2.0 :: " << acv.getReLU(2.0) << std::endl;
	std::cout << "GradReLU Function Val = 2.0 :: " << acv.getGradReLU(2.0) << std::endl;
}
开发者ID:revers3r,项目名称:Deep_Learning,代码行数:8,代码来源:activation.cpp

示例2: DisableActivationFromAsmJS

static void
DisableActivationFromAsmJS(AsmJSActivation *activation)
{
    JSContext *cx = activation->cx();
    Activation *act = cx->mainThread().activation();
    JS_ASSERT(act->isJit());
    act->asJit()->setActive(cx, false);
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例3: MarkInterpreterActivation

void
js::MarkInterpreterActivations(PerThreadData *ptd, JSTracer *trc)
{
    for (ActivationIterator iter(ptd); !iter.done(); ++iter) {
        Activation *act = iter.activation();
        if (act->isInterpreter())
            MarkInterpreterActivation(trc, act->asInterpreter());
    }
}
开发者ID:aeddi,项目名称:gecko-dev,代码行数:9,代码来源:Stack.cpp

示例4: MarkInterpreterActivation

void
js::MarkInterpreterActivations(JSRuntime *rt, JSTracer *trc)
{
    for (ActivationIterator iter(rt); !iter.done(); ++iter) {
        Activation *act = iter.activation();
        if (act->isInterpreter())
            MarkInterpreterActivation(trc, act->asInterpreter());
    }

}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例5: parseActivation

    Activation* FllImporter::parseActivation(const std::string& name) const {
        if (name == "none") return FactoryManager::instance()->activation()->constructObject("");
        std::vector<std::string> tokens = Op::split(name, " ");
        Activation* result = FactoryManager::instance()->activation()->constructObject(tokens.front());

        std::ostringstream parameters;
        for (std::size_t i = 1; i < tokens.size(); ++i) {
            parameters << tokens.at(i);
            if (i + 1 < tokens.size()) parameters << " ";
        }
        result->configure(parameters.str());
        return result;
    }
开发者ID:NatalProductions,项目名称:fuzzylite,代码行数:13,代码来源:FllImporter.cpp

示例6: fail

bool
TraceLoggerThread::enable(JSContext* cx)
{
    if (!enable())
        return fail(cx, "internal error");

    if (enabled_ == 1) {
        // Get the top Activation to log the top script/pc (No inlined frames).
        ActivationIterator iter(cx->runtime());
        Activation* act = iter.activation();

        if (!act)
            return fail(cx, "internal error");

        JSScript* script = nullptr;
        int32_t engine = 0;

        if (act->isJit()) {
            JitFrameIterator it(iter);

            while (!it.isScripted() && !it.done())
                ++it;

            MOZ_ASSERT(!it.done());
            MOZ_ASSERT(it.isIonJS() || it.isBaselineJS());

            script = it.script();
            engine = it.isIonJS() ? TraceLogger_IonMonkey : TraceLogger_Baseline;
        } else if (act->isWasm()) {
            JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_TRACELOGGER_ENABLE_FAIL,
                                 "not yet supported in wasm code");
            return false;
        } else {
            MOZ_ASSERT(act->isInterpreter());
            InterpreterFrame* fp = act->asInterpreter()->current();
            MOZ_ASSERT(!fp->runningInJit());

            script = fp->script();
            engine = TraceLogger_Interpreter;
            if (script->compartment() != cx->compartment())
                return fail(cx, "compartment mismatch");
        }

        TraceLoggerEvent event(this, TraceLogger_Scripts, script);
        startEvent(event);
        startEvent(engine);
    }

    return true;
}
开发者ID:cstipkovic,项目名称:gecko-dev,代码行数:50,代码来源:TraceLogging.cpp

示例7: main

int main(int argc, char* argv[])
{
    std::vector<float> cell(10);

    for(unsigned int i = 0; i < cell.size(); ++i) {
        cell[i] = (float)i * 1.0;
    }
    Activation* act = new Softmax();
    auto ans = act->calc(cell);

    float sum = 0.0;
    for(unsigned int i = 0; i < ans.size(); ++i) {
        std::cout << ans[i] << std::endl;
        sum += ans[i];
    }
    std::cout << "sum of cells : " << sum << std::endl;

    return 0;
}
开发者ID:e5120,项目名称:DeepLearning,代码行数:19,代码来源:softmaxTest.cpp

示例8: while

void
ScriptFrameIter::settleOnActivation()
{
    while (true) {
        if (data_.activations_.done()) {
            data_.state_ = DONE;
            return;
        }

        Activation *activation = data_.activations_.activation();

        // If JS_SaveFrameChain was called, stop iterating here (unless
        // GO_THROUGH_SAVED is set).
        if (data_.savedOption_ == STOP_AT_SAVED && activation->hasSavedFrameChain()) {
            data_.state_ = DONE;
            return;
        }

        // Skip activations from another context if needed.
        JS_ASSERT(activation->cx());
        JS_ASSERT(data_.cx_);
        if (data_.contextOption_ == CURRENT_CONTEXT && activation->cx() != data_.cx_) {
            ++data_.activations_;
            continue;
        }

        // If the caller supplied principals, only show activations which are subsumed (of the same
        // origin or of an origin accessible) by these principals.
        if (data_.principals_) {
            if (JSSubsumesOp subsumes = data_.cx_->runtime()->securityCallbacks->subsumes) {
                JS::AutoAssertNoGC nogc;
                if (!subsumes(data_.principals_, activation->compartment()->principals)) {
                    ++data_.activations_;
                    continue;
                }
            }
        }

#ifdef JS_ION
        if (activation->isJit()) {
            data_.ionFrames_ = jit::IonFrameIterator(data_.activations_);

            // Stop at the first scripted frame.
            while (!data_.ionFrames_.isScripted() && !data_.ionFrames_.done())
                ++data_.ionFrames_;

            // It's possible to have an JitActivation with no scripted frames,
            // for instance if we hit an over-recursion during bailout.
            if (data_.ionFrames_.done()) {
                ++data_.activations_;
                continue;
            }

            nextJitFrame();
            data_.state_ = JIT;
            return;
        }
#endif

        JS_ASSERT(activation->isInterpreter());

        InterpreterActivation *interpAct = activation->asInterpreter();
        data_.interpFrames_ = InterpreterFrameIterator(interpAct);

        // If we OSR'ed into JIT code, skip the interpreter frame so that
        // the same frame is not reported twice.
        if (data_.interpFrames_.frame()->runningInJit()) {
            ++data_.interpFrames_;
            if (data_.interpFrames_.done()) {
                ++data_.activations_;
                continue;
            }
        }

        JS_ASSERT(!data_.interpFrames_.frame()->runningInJit());
        data_.pc_ = data_.interpFrames_.pc();
        data_.state_ = SCRIPTED;
        return;
    }
}
开发者ID:,项目名称:,代码行数:80,代码来源:

示例9: rescale

double rescale(double x) {
  Activation a;
  return 100.0 * (x - a.scale().first) / (a.scale().second - a.scale().first);
}
开发者ID:reunanen,项目名称:tiny-cnn,代码行数:4,代码来源:test.cpp

示例10: while

void
ScriptFrameIter::settleOnActivation()
{
    while (true) {
        if (data_.activations_.done()) {
            data_.state_ = DONE;
            return;
        }

        Activation *activation = data_.activations_.activation();

        // If JS_SaveFrameChain was called, stop iterating here (unless
        // GO_THROUGH_SAVED is set).
        if (data_.savedOption_ == STOP_AT_SAVED && activation->hasSavedFrameChain()) {
            data_.state_ = DONE;
            return;
        }

        // Skip activations from another context if needed.
        JS_ASSERT(activation->cx());
        JS_ASSERT(data_.cx_);
        if (data_.contextOption_ == CURRENT_CONTEXT && activation->cx() != data_.cx_) {
            ++data_.activations_;
            continue;
        }

#ifdef JS_ION
        if (activation->isJit()) {
            data_.ionFrames_ = jit::IonFrameIterator(data_.activations_);

            // Stop at the first scripted frame.
            while (!data_.ionFrames_.isScripted() && !data_.ionFrames_.done())
                ++data_.ionFrames_;

            // It's possible to have an JitActivation with no scripted frames,
            // for instance if we hit an over-recursion during bailout.
            if (data_.ionFrames_.done()) {
                ++data_.activations_;
                continue;
            }

            nextJitFrame();
            data_.state_ = JIT;
            return;
        }
#endif

        JS_ASSERT(activation->isInterpreter());

        InterpreterActivation *interpAct = activation->asInterpreter();
        data_.interpFrames_ = InterpreterFrameIterator(interpAct);

        // If we OSR'ed into JIT code, skip the interpreter frame so that
        // the same frame is not reported twice.
        if (data_.interpFrames_.frame()->runningInJit()) {
            ++data_.interpFrames_;
            if (data_.interpFrames_.done()) {
                ++data_.activations_;
                continue;
            }
        }

        JS_ASSERT(!data_.interpFrames_.frame()->runningInJit());
        data_.pc_ = data_.interpFrames_.pc();
        data_.state_ = SCRIPTED;
        return;
    }
}
开发者ID:chenghuk,项目名称:mozilla-central,代码行数:68,代码来源:Stack.cpp


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