Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
tensorflow
提交
bd56e040
T
tensorflow
项目概览
xxadev
/
tensorflow
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
tensorflow
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
bd56e040
编写于
1月 03, 2020
作者:
M
Mihai Maruseac
提交者:
GitHub
1月 03, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #35548 from compnerd/r2.1-windows-build
r2.1 cherry-pick request: windows build support
上级
84274759
a8adad90
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
43 addition
and
23 deletion
+43
-23
.bazelrc
.bazelrc
+4
-0
configure.py
configure.py
+1
-1
tensorflow/cc/gradients/math_grad.cc
tensorflow/cc/gradients/math_grad.cc
+0
-1
tensorflow/compiler/xla/client/lib/math.cc
tensorflow/compiler/xla/client/lib/math.cc
+1
-3
tensorflow/compiler/xla/client/lib/tridiagonal.cc
tensorflow/compiler/xla/client/lib/tridiagonal.cc
+3
-3
tensorflow/compiler/xla/service/dynamic_dimension_inference.cc
...rflow/compiler/xla/service/dynamic_dimension_inference.cc
+7
-7
tensorflow/compiler/xla/service/dynamic_dimension_inference.h
...orflow/compiler/xla/service/dynamic_dimension_inference.h
+3
-0
tensorflow/compiler/xla/service/hlo_parser.cc
tensorflow/compiler/xla/service/hlo_parser.cc
+21
-2
tensorflow/core/lib/random/random_distributions.h
tensorflow/core/lib/random/random_distributions.h
+0
-3
tensorflow/core/lib/random/random_distributions_test.cc
tensorflow/core/lib/random/random_distributions_test.cc
+1
-1
tensorflow/lite/experimental/microfrontend/lib/window_util.c
tensorflow/lite/experimental/microfrontend/lib/window_util.c
+0
-2
tensorflow/tensorflow.bzl
tensorflow/tensorflow.bzl
+2
-0
未找到文件。
.bazelrc
浏览文件 @
bd56e040
...
@@ -160,6 +160,10 @@ build:c++17 --cxxopt=-std=c++1z
...
@@ -160,6 +160,10 @@ build:c++17 --cxxopt=-std=c++1z
build:c++17 --cxxopt=-stdlib=libc++
build:c++17 --cxxopt=-stdlib=libc++
build:c++1z --config=c++17
build:c++1z --config=c++17
# Tensorflow uses M_* math constants that only get defined by MSVC headers if
# _USE_MATH_DEFINES is defined.
build:windows --copt=/D_USE_MATH_DEFINES
# Default paths for TF_SYSTEM_LIBS
# Default paths for TF_SYSTEM_LIBS
build --define=PREFIX=/usr
build --define=PREFIX=/usr
build --define=LIBDIR=$(PREFIX)/lib
build --define=LIBDIR=$(PREFIX)/lib
...
...
configure.py
浏览文件 @
bd56e040
...
@@ -1233,7 +1233,7 @@ def set_windows_build_flags(environ_cp):
...
@@ -1233,7 +1233,7 @@ def set_windows_build_flags(environ_cp):
# Fix winsock2.h conflicts
# Fix winsock2.h conflicts
write_to_bazelrc
(
write_to_bazelrc
(
'build --copt=-DWIN32_LEAN_AND_MEAN --host_copt=-DWIN32_LEAN_AND_MEAN '
'build --copt=-DWIN32_LEAN_AND_MEAN --host_copt=-DWIN32_LEAN_AND_MEAN '
'--copt=-DNOGDI --host_copt=-DNOGDI'
)
'--copt=-DNOGDI --host_copt=-DNOGDI
--copt=-D_USE_MATH_DEFINES
'
)
# Output more verbose information when something goes wrong
# Output more verbose information when something goes wrong
write_to_bazelrc
(
'build --verbose_failures'
)
write_to_bazelrc
(
'build --verbose_failures'
)
# The host and target platforms are the same in Windows build. So we don't
# The host and target platforms are the same in Windows build. So we don't
...
...
tensorflow/cc/gradients/math_grad.cc
浏览文件 @
bd56e040
...
@@ -13,7 +13,6 @@ See the License for the specific language governing permissions and
...
@@ -13,7 +13,6 @@ See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
==============================================================================*/
==============================================================================*/
#define _USE_MATH_DEFINES
#include <cmath>
#include <cmath>
#include "tensorflow/cc/ops/array_ops_internal.h"
#include "tensorflow/cc/ops/array_ops_internal.h"
...
...
tensorflow/compiler/xla/client/lib/math.cc
浏览文件 @
bd56e040
...
@@ -15,9 +15,7 @@ limitations under the License.
...
@@ -15,9 +15,7 @@ limitations under the License.
#include "tensorflow/compiler/xla/client/lib/math.h"
#include "tensorflow/compiler/xla/client/lib/math.h"
// This macro is required to make MSVC defines math constants in math.h
#include <cmath>
#define _USE_MATH_DEFINES
#include <math.h>
#include "tensorflow/compiler/xla/client/lib/arithmetic.h"
#include "tensorflow/compiler/xla/client/lib/arithmetic.h"
#include "tensorflow/compiler/xla/client/lib/constants.h"
#include "tensorflow/compiler/xla/client/lib/constants.h"
...
...
tensorflow/compiler/xla/client/lib/tridiagonal.cc
浏览文件 @
bd56e040
...
@@ -36,6 +36,8 @@ namespace {
...
@@ -36,6 +36,8 @@ namespace {
struct
TridiagonalSystemShape
{
struct
TridiagonalSystemShape
{
const
int64
rank
;
const
int64
rank
;
const
int64
num_equations
;
const
int64
num_equations
;
TridiagonalSystemShape
(
int64
rk
,
int64
num_eqs
)
:
rank
(
rk
),
num_equations
(
num_eqs
)
{}
};
};
Status
CheckSecondToLastDimension
(
const
Shape
&
op_shape
,
int64
rank
,
Status
CheckSecondToLastDimension
(
const
Shape
&
op_shape
,
int64
rank
,
...
@@ -109,9 +111,7 @@ StatusOr<TridiagonalSystemShape> CheckSystemAndReturnShape(XlaOp lower_diagonal,
...
@@ -109,9 +111,7 @@ StatusOr<TridiagonalSystemShape> CheckSystemAndReturnShape(XlaOp lower_diagonal,
TF_RETURN_IF_ERROR
(
CheckSecondToLastDimension
(
upper_diagonal_shape
,
rank
,
1
,
TF_RETURN_IF_ERROR
(
CheckSecondToLastDimension
(
upper_diagonal_shape
,
rank
,
1
,
"upper diagonal"
));
"upper diagonal"
));
TridiagonalSystemShape
result
=
{.
rank
=
rank
,
return
TridiagonalSystemShape
(
rank
,
num_equations
);
.
num_equations
=
num_equations
};
return
result
;
}
}
XlaOp
Coefficient
(
XlaOp
operand
,
int64
i
)
{
XlaOp
Coefficient
(
XlaOp
operand
,
int64
i
)
{
...
...
tensorflow/compiler/xla/service/dynamic_dimension_inference.cc
浏览文件 @
bd56e040
...
@@ -469,7 +469,7 @@ Status DynamicDimensionInferenceVisitor::HandleSetDimensionSize(
...
@@ -469,7 +469,7 @@ Status DynamicDimensionInferenceVisitor::HandleSetDimensionSize(
// Propagate dynamic dimension indicated by this set dimension size
// Propagate dynamic dimension indicated by this set dimension size
// instruction.
// instruction.
parent_
->
SetDynamicSize
(
hlo
,
{},
hlo
->
dimension
(),
hlo
->
mutable_operand
(
1
),
parent_
->
SetDynamicSize
(
hlo
,
{},
hlo
->
dimension
(),
hlo
->
mutable_operand
(
1
),
{.
stride
=
1
,
.
multiple_of
=
1
}
);
DimensionConstraint
(
1
,
1
)
);
}
}
// Also Propagate dynamic dimension already set by operands.
// Also Propagate dynamic dimension already set by operands.
...
@@ -813,7 +813,7 @@ Status DynamicDimensionInferenceVisitor::HandleReshape(HloInstruction* hlo) {
...
@@ -813,7 +813,7 @@ Status DynamicDimensionInferenceVisitor::HandleReshape(HloInstruction* hlo) {
parent_
->
SetDynamicSize
(
parent_
->
SetDynamicSize
(
reshape
,
{},
output_dynamic_dimension
,
new_dynamic_size
,
reshape
,
{},
output_dynamic_dimension
,
new_dynamic_size
,
{.
stride
=
1
,
.
multiple_of
=
constraint
.
multiple_of
/
divisor
}
);
DimensionConstraint
(
1
,
constraint
.
multiple_of
/
divisor
)
);
}
}
if
(
input_dim_size
<
output_dim_size
)
{
if
(
input_dim_size
<
output_dim_size
)
{
...
@@ -850,12 +850,12 @@ Status DynamicDimensionInferenceVisitor::HandleReshape(HloInstruction* hlo) {
...
@@ -850,12 +850,12 @@ Status DynamicDimensionInferenceVisitor::HandleReshape(HloInstruction* hlo) {
hlo
->
parent
()
->
AddInstruction
(
HloInstruction
::
CreateBinary
(
hlo
->
parent
()
->
AddInstruction
(
HloInstruction
::
CreateBinary
(
output_dynamic_size
->
shape
(),
HloOpcode
::
kMultiply
,
output_dynamic_size
->
shape
(),
HloOpcode
::
kMultiply
,
new_dynamic_size
,
operand_dynamic_size
));
new_dynamic_size
,
operand_dynamic_size
));
int64
new_multiple_of_constraint
=
constraint
.
multiple_of
*
output_dim_size
/
operand
->
shape
().
dimensions
(
input_dynamic_dimension
);
parent_
->
SetDynamicSize
(
parent_
->
SetDynamicSize
(
reshape
,
{},
output_dynamic_dimension
,
new_dynamic_size
,
reshape
,
{},
output_dynamic_dimension
,
new_dynamic_size
,
{.
stride
=
1
,
DimensionConstraint
(
1
,
new_multiple_of_constraint
));
.
multiple_of
=
constraint
.
multiple_of
*
output_dim_size
/
operand
->
shape
().
dimensions
(
input_dynamic_dimension
)});
}
}
return
Status
::
OK
();
return
Status
::
OK
();
...
@@ -1227,7 +1227,7 @@ Status DynamicDimensionInferenceVisitor::HandleParameter(HloInstruction* hlo) {
...
@@ -1227,7 +1227,7 @@ Status DynamicDimensionInferenceVisitor::HandleParameter(HloInstruction* hlo) {
parent_
->
SetDynamicSize
(
target_parameter
,
parent_
->
SetDynamicSize
(
target_parameter
,
dynamic_dimension
.
parameter_index
,
dynamic_dimension
.
parameter_index
,
dynamic_dimension
.
dimension
,
dynamic_size
,
dynamic_dimension
.
dimension
,
dynamic_size
,
{.
stride
=
1
,
.
multiple_of
=
1
}
);
DimensionConstraint
(
1
,
1
)
);
return
Status
::
OK
();
return
Status
::
OK
();
});
});
}
}
...
...
tensorflow/compiler/xla/service/dynamic_dimension_inference.h
浏览文件 @
bd56e040
...
@@ -149,6 +149,9 @@ class DynamicDimensionInference {
...
@@ -149,6 +149,9 @@ class DynamicDimensionInference {
//
//
//
//
struct
DimensionConstraint
{
struct
DimensionConstraint
{
explicit
DimensionConstraint
(
int64
s
,
int64
m
)
:
stride
(
s
),
multiple_of
(
m
)
{}
DimensionConstraint
()
:
stride
(
1
),
multiple_of
(
1
)
{}
// Stride represents the distance of a newly placed element and the previous
// Stride represents the distance of a newly placed element and the previous
// placed element on this dynamic dimension.
// placed element on this dynamic dimension.
int64
stride
;
int64
stride
;
...
...
tensorflow/compiler/xla/service/hlo_parser.cc
浏览文件 @
bd56e040
...
@@ -2611,18 +2611,37 @@ struct MinMaxFiniteValue<bfloat16> {
...
@@ -2611,18 +2611,37 @@ struct MinMaxFiniteValue<bfloat16> {
static
double
min
()
{
return
-
max
();
}
static
double
min
()
{
return
-
max
();
}
};
};
// MSVC's standard C++ library does not define isnan/isfinite for integer types.
// To work around that we will need to provide our own.
template
<
typename
T
>
std
::
enable_if_t
<
std
::
is_floating_point
<
T
>::
value
,
bool
>
IsFinite
(
T
val
)
{
return
std
::
isfinite
(
val
);
}
template
<
typename
T
>
std
::
enable_if_t
<
std
::
is_floating_point
<
T
>::
value
,
bool
>
IsNaN
(
T
val
)
{
return
std
::
isnan
(
val
);
}
template
<
typename
T
>
std
::
enable_if_t
<
std
::
is_integral
<
T
>::
value
,
bool
>
IsFinite
(
T
val
)
{
return
std
::
isfinite
(
static_cast
<
double
>
(
val
));
}
template
<
typename
T
>
std
::
enable_if_t
<
std
::
is_integral
<
T
>::
value
,
bool
>
IsNaN
(
T
val
)
{
return
std
::
isnan
(
static_cast
<
double
>
(
val
));
}
template
<
typename
LiteralNativeT
,
typename
ParsedElemT
>
template
<
typename
LiteralNativeT
,
typename
ParsedElemT
>
bool
HloParserImpl
::
CheckParsedValueIsInRange
(
LocTy
loc
,
ParsedElemT
value
)
{
bool
HloParserImpl
::
CheckParsedValueIsInRange
(
LocTy
loc
,
ParsedElemT
value
)
{
if
(
std
::
is_floating_point
<
ParsedElemT
>::
value
)
{
if
(
std
::
is_floating_point
<
ParsedElemT
>::
value
)
{
auto
value_as_native_t
=
static_cast
<
LiteralNativeT
>
(
value
);
auto
value_as_native_t
=
static_cast
<
LiteralNativeT
>
(
value
);
auto
value_double_converted
=
static_cast
<
ParsedElemT
>
(
value_as_native_t
);
auto
value_double_converted
=
static_cast
<
ParsedElemT
>
(
value_as_native_t
);
if
(
!
std
::
isfinite
(
value
)
||
std
::
isf
inite
(
value_double_converted
))
{
if
(
!
IsFinite
(
value
)
||
IsF
inite
(
value_double_converted
))
{
value
=
value_double_converted
;
value
=
value_double_converted
;
}
}
}
}
PrimitiveType
literal_ty
=
PrimitiveType
literal_ty
=
primitive_util
::
NativeToPrimitiveType
<
LiteralNativeT
>
();
primitive_util
::
NativeToPrimitiveType
<
LiteralNativeT
>
();
if
(
std
::
isnan
(
value
)
||
if
(
IsNaN
(
value
)
||
(
std
::
numeric_limits
<
ParsedElemT
>::
has_infinity
&&
(
std
::
numeric_limits
<
ParsedElemT
>::
has_infinity
&&
(
std
::
numeric_limits
<
ParsedElemT
>::
infinity
()
==
value
||
(
std
::
numeric_limits
<
ParsedElemT
>::
infinity
()
==
value
||
-
std
::
numeric_limits
<
ParsedElemT
>::
infinity
()
==
value
)))
{
-
std
::
numeric_limits
<
ParsedElemT
>::
infinity
()
==
value
)))
{
...
...
tensorflow/core/lib/random/random_distributions.h
浏览文件 @
bd56e040
...
@@ -18,10 +18,7 @@ limitations under the License.
...
@@ -18,10 +18,7 @@ limitations under the License.
#include <string.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cmath>
#include <cmath>
#undef _USE_MATH_DEFINES
#include <algorithm>
#include <algorithm>
#include <type_traits>
#include <type_traits>
...
...
tensorflow/core/lib/random/random_distributions_test.cc
浏览文件 @
bd56e040
...
@@ -15,8 +15,8 @@ limitations under the License.
...
@@ -15,8 +15,8 @@ limitations under the License.
#include "tensorflow/core/lib/random/random_distributions.h"
#include "tensorflow/core/lib/random/random_distributions.h"
#include <math.h>
#include <algorithm>
#include <algorithm>
#include <cmath>
#include <functional>
#include <functional>
#include <numeric>
#include <numeric>
#include <unordered_map>
#include <unordered_map>
...
...
tensorflow/lite/experimental/microfrontend/lib/window_util.c
浏览文件 @
bd56e040
...
@@ -14,8 +14,6 @@ limitations under the License.
...
@@ -14,8 +14,6 @@ limitations under the License.
==============================================================================*/
==============================================================================*/
#include "tensorflow/lite/experimental/microfrontend/lib/window_util.h"
#include "tensorflow/lite/experimental/microfrontend/lib/window_util.h"
// This macro is required to make MSVC defines math constants in math.h
#define _USE_MATH_DEFINES
#include <math.h>
#include <math.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
...
...
tensorflow/tensorflow.bzl
浏览文件 @
bd56e040
...
@@ -263,6 +263,8 @@ def get_win_copts(is_external = False):
...
@@ -263,6 +263,8 @@ def get_win_copts(is_external = False):
# "/EHs-c-",
# "/EHs-c-",
"/wd4577"
,
"/wd4577"
,
"/DNOGDI"
,
"/DNOGDI"
,
# Also see build:windows lines in tensorflow/opensource_only/.bazelrc
# where we set some other options globally.
]
]
if
is_external
:
if
is_external
:
return
WINDOWS_COPTS
+
[
"/UTF_COMPILE_LIBRARY"
]
return
WINDOWS_COPTS
+
[
"/UTF_COMPILE_LIBRARY"
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录