liwei-cpp / metann Goto Github PK
View Code? Open in Web Editor NEWLicense: Boost Software License 1.0
License: Boost Software License 1.0
Here is the Set method code https://github.com/liwei-cpp/MetaNN/blob/book/MetaNN/facilities/var_type_dict.h#L111
m_tuple[TagPos] = std::shared_ptr<void>(tmp,
[](void* ptr){
rawVal* nptr = static_cast<rawVal*>(ptr);
delete nptr;
});
What does the lambda function actually do?(It seems convert the tmp which is already rawVal* type to rawVal* type) why not just use:
m_tuple[TagPos] = std::shared_ptr<void>(tmp);
因为书籍我还没有读完,所以下面的一些想法可能已经有了,请见谅
与书籍对应的代码中没有卷积层,但训练与识别 MNIST 库应该是绰绰有余了。当然,没有卷积层的神经网络,图像识别性能与效果会大打折扣。希望仓库中提供一个 demo,一个真实可用的网络实例,比如 MNIST/CIFAR 的识别,或者说向量数组的分类也是可以的
提这个建议的目的是我想知道与书籍对应的库,实现了神经网络系统的哪些部分,具体可以实现那些应用
感谢~
书中代码如下:
#include <iostream>
#include <tuple>
template <typename TSeqCont>
struct Tail_;
template <template <typename...> class Container, typename TH, typename...TCases>
struct Tail_<Container<TH, TCases...>>
{
using type = Container<TCases...>;
};
template <typename TSeqCont>
using Tail = typename Tail_<TSeqCont>::type;
int main(){
using Cont=std::tuple<char,long,int>;
std::cout<<"tail:"<<typeid(Tail<Cont>).name()<<std::endl;
return 0;
}
理论上输出应该为i,但是实际上输出为St5tupleIJliEE。
请问什么原因,如何解决
data/batch.h怎么才这几行?BatchScalar和BatchMatrix具体实现的代码呢?
#include <iostream>
#include <type_traits>
template < bool AddOrRemoveRef >
struct Fun_;
template <>
struct Fun_< true > {
template < typename T >
using type = std::add_lvalue_reference< T >;
};
template <>
struct Fun_< false > {
template < typename T >
using type = std::remove_reference< T >;
};
// 注意这里的高级用法
template < typename T >
template < bool AddOrRemoveRef >
using Fun = typename Fun_< AddOrRemoveRef >::template type< T >; //error
// 即使是有别名,还是需要显式说明模板
template < typename T >
using Res_ = Fun< false >;
int main()
{
Res_< int& >::type h = 3;
std::cout << h << std::endl;
return 0;
}
I have tested these code with clang14 and gcc11 and gcc9 all failed.
[{
"resource": "/root/code/cpp/vscode/Books/TemplateMetaProgrammingPractice/1.2.1templateAsMetaFucntionInput.cpp",
"owner": "generated_diagnostic_collection_name#1",
"code": "alias_template_extra_headers",
"severity": 8,
"message": "Extraneous template parameter list in alias template declaration",
"source": "clang",
"startLineNumber": 22,
"startColumn": 1,
"endLineNumber": 22,
"endColumn": 6
}]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.