mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
add -Wnarrowing as error to cmake builds (#89207)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/89207 Approved by: https://github.com/wconstab, https://github.com/malfet
This commit is contained in:
parent
fd0efb01a7
commit
92f9214a31
3 changed files with 4 additions and 4 deletions
|
|
@ -815,7 +815,6 @@ endif()
|
|||
# ---[ Build flags
|
||||
if(NOT MSVC)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -O2 -fPIC")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wno-narrowing")
|
||||
# Eigen fails to build with some versions, so convert this to a warning
|
||||
# Details at http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1459
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wall")
|
||||
|
|
@ -824,6 +823,7 @@ if(NOT MSVC)
|
|||
append_cxx_flag_if_supported("-Werror=non-virtual-dtor" CMAKE_CXX_FLAGS)
|
||||
append_cxx_flag_if_supported("-Werror=braced-scalar-init" CMAKE_CXX_FLAGS)
|
||||
append_cxx_flag_if_supported("-Werror=range-loop-construct" CMAKE_CXX_FLAGS)
|
||||
append_cxx_flag_if_supported("-Wnarrowing" CMAKE_CXX_FLAGS)
|
||||
append_cxx_flag_if_supported("-Wno-missing-field-initializers" CMAKE_CXX_FLAGS)
|
||||
append_cxx_flag_if_supported("-Wno-type-limits" CMAKE_CXX_FLAGS)
|
||||
append_cxx_flag_if_supported("-Wno-array-bounds" CMAKE_CXX_FLAGS)
|
||||
|
|
|
|||
|
|
@ -209,8 +209,8 @@ Tensor _nnpack_spatial_convolution(
|
|||
.height = (size_t)output.size(2),
|
||||
};
|
||||
const nnp_size output_subsample = {
|
||||
.width = stride[1],
|
||||
.height = stride[0],
|
||||
.width = static_cast<std::size_t>(stride[1]),
|
||||
.height = static_cast<std::size_t>(stride[0]),
|
||||
};
|
||||
|
||||
const auto input_ = input.contiguous();
|
||||
|
|
|
|||
|
|
@ -438,7 +438,7 @@ Tensor& multinomial_with_replacement_mps_kernel(
|
|||
MPSGraphTensor *randomTensor = generatorTensors[0];
|
||||
|
||||
auto broadcastShape = @[ns_numDist ,ns_n_sample, ns_numCategories];
|
||||
int broadcastShapeVals[3] = {numDist, n_sample, numCategories};
|
||||
int broadcastShapeVals[3] = {numDist, static_cast<int>(n_sample), numCategories};
|
||||
MPSGraphTensor *broadcastShapeTensor = [mpsGraph constantWithData:[NSData dataWithBytes:broadcastShapeVals length:sizeof(int) * broadcastShape.count]
|
||||
shape:@[[NSNumber numberWithUnsignedInteger:broadcastShape.count]]
|
||||
dataType:MPSDataTypeUInt32];
|
||||
|
|
|
|||
Loading…
Reference in a new issue