Skip to content

Commit

Permalink
Merge d8e81a8 into b0273d0
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnLangford committed Jun 6, 2019
2 parents b0273d0 + d8e81a8 commit 061d955
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion vowpalwabbit/memory_tree.cc
Expand Up @@ -786,7 +786,7 @@ float return_reward_from_node(memory_tree& b, single_learner& base, uint64_t cn,
}

void learn_at_leaf_random(
memory_tree& b, single_learner& base, const uint32_t& leaf_id, example& ec, const float& weight)
memory_tree& b, single_learner& base, const uint64_t& leaf_id, example& ec, const float& weight)
{
b.total_num_queries++;
int32_t ec_id = -1;
Expand Down
4 changes: 2 additions & 2 deletions vowpalwabbit/vw.h
Expand Up @@ -147,7 +147,7 @@ inline uint64_t hash_feature(vw& all, std::string s, uint64_t u)
ss.end = ss.begin + s.length();
return all.p->hasher(ss, u) & all.parse_mask;
}
inline uint64_t hash_feature_static(std::string s, unsigned long u, std::string h, uint32_t num_bits)
inline uint64_t hash_feature_static(std::string s, uint64_t u, std::string h, uint32_t num_bits)
{
substring ss;
ss.begin = (char*)s.c_str();
Expand All @@ -156,7 +156,7 @@ inline uint64_t hash_feature_static(std::string s, unsigned long u, std::string
return getHasher(h)(ss, u) & parse_mark;
}

inline uint64_t hash_feature_cstr(vw& all, char* fstr, unsigned long u)
inline uint64_t hash_feature_cstr(vw& all, char* fstr, uint64_t u)
{
substring ss;
ss.begin = fstr;
Expand Down
8 changes: 4 additions & 4 deletions vowpalwabbit/vwdll.cpp
Expand Up @@ -233,22 +233,22 @@ VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashSpaceStaticA(const char * s, const c
}

#ifdef USE_CODECVT
VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashFeature(VW_HANDLE handle, const char16_t * s, unsigned long u)
VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashFeature(VW_HANDLE handle, const char16_t* s, size_t u)
{ return VW_HashFeatureA(handle, utf16_to_utf8(s).c_str(),u);
}

VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashFeatureStatic(const char16_t * s, unsigned long u, const char16_t * h, unsigned int num_bits)
VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashFeatureStatic(const char16_t * s, size_t u, const char16_t * h, unsigned int num_bits)
{ return VW_HashFeatureStaticA(utf16_to_utf8(s).c_str(), u, utf16_to_utf8(h).c_str(), num_bits);
}
#endif

VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashFeatureA(VW_HANDLE handle, const char * s, unsigned long u)
VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashFeatureA(VW_HANDLE handle, const char * s, size_t u)
{ vw * pointer = static_cast<vw*>(handle);
string str(s);
return VW::hash_feature(*pointer, str, u);
}

VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashFeatureStaticA(const char * s, unsigned long u, const char * h = "strings", unsigned int num_bits = 18)
VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashFeatureStaticA(const char * s, size_t u, const char * h = "strings", unsigned int num_bits = 18)
{ string str(s);
string hash(h);
return VW::hash_feature_static(str, u, hash, num_bits);
Expand Down
10 changes: 4 additions & 6 deletions vowpalwabbit/vwdll.h
Expand Up @@ -116,13 +116,11 @@ extern "C"
VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashSpaceA(VW_HANDLE handle, const char* s);
VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashSpaceStaticA(const char* s, const char* h);
#ifdef USE_CODECVT
VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashFeature(VW_HANDLE handle, const char16_t* s, unsigned long u);
VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashFeatureStatic(
const char16_t* s, unsigned long u, const char16_t* h, unsigned int num_bits);
VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashFeature(VW_HANDLE handle, const char16_t* s, size_t u);
VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashFeatureStatic(const char16_t* s, size_t u, const char16_t* h, unsigned int num_bits);
#endif
VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashFeatureA(VW_HANDLE handle, const char* s, unsigned long u);
VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashFeatureStaticA(
const char* s, unsigned long u, const char* h, unsigned int num_bits);
VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashFeatureA(VW_HANDLE handle, const char* s, size_t u);
VW_DLL_MEMBER size_t VW_CALLING_CONV VW_HashFeatureStaticA(const char* s, size_t u, const char* h, unsigned int num_bits);

VW_DLL_MEMBER float VW_CALLING_CONV VW_Learn(VW_HANDLE handle, VW_EXAMPLE e);
VW_DLL_MEMBER float VW_CALLING_CONV VW_Predict(VW_HANDLE handle, VW_EXAMPLE e);
Expand Down

0 comments on commit 061d955

Please sign in to comment.