Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2a43bef
Return 0 from the zero branch of the xlogy/xlog1py/xdivy GPU kernels
vishwakt Sep 25, 2026
d854010
Update the xlogy/xlog1py/xdivy GPU test baselines for +0
vishwakt Sep 25, 2026
f424878
Set intra op threadpool in ynn param when using NanoRt Executable.
SiqiaoWu1993 Sep 29, 2026
059acf0
Automated Code Change
cantonios Sep 29, 2026
0a3b7c4
Protect XNNPACK runtime creation and destruction with workspace_mutex_.
tensorflower-gardener Sep 29, 2026
4be465e
[xla:cpu] ir_compiler: remove obsolete comment about AllowFPOpFusion
cota Sep 29, 2026
d064165
Modernize manual status checks, deprecated TF_* macros, and StrCat er…
toli-y Sep 29, 2026
dc599b3
[XLA] Add PrecisionConfig algorithms for FP8x3 and FP8x4 BF16 dot emu…
SamGinzburg Sep 29, 2026
e324dfe
Use HeapSimulator to decide schedule-by-structure reruns
deqiangc Sep 30, 2026
e8fecb2
[xla:cpu] sink same-block, contract, single-use fmul before fadd/fsub
cota Sep 30, 2026
fdf964b
Previously, `buildMaxAndArgmaxBody` computed `selected_value` using `…
pgmoka Sep 30, 2026
a599fd9
Fix data race in ThreadSafeStatus::status() by returning absl::Status…
dmiltr3 Sep 30, 2026
c53bc6e
[XLA][SPMD] Optimize 2-concatenate for multi devices
wsmoses Sep 30, 2026
51e5cf1
Add llvm_xz dependency and BUILD definition.
mrguenther Sep 30, 2026
2091fe0
Support broadcast-based grouped-query attention (GQA) during prefill …
vksnk Sep 30, 2026
276976b
Automated Code Change
tensorflower-gardener Sep 30, 2026
90d577c
Merge pull request #128034 from vishwakt:fix-xfunctor-gpu-kernels
tensorflower-gardener Sep 30, 2026
0fa5880
Don't rewrite integer Pow(x, -1) to Reciprocal in Grappler, so intege…
dmiltr3 Sep 30, 2026
da199e6
Automated Code Change
tensorflower-gardener Sep 30, 2026
1154e44
[Mosaic] Fix tpu.memref_squeeze verification and layout propagation f…
tlongeri Sep 30, 2026
10141aa
Preserve metadata and frontend attributes in AllGatherDecomposer.
derdrdirk Sep 30, 2026
103b097
Allow concurrent `workflow_dispatch` runs in `postsubmit_benchmark.yml`
Andrew-Dame Sep 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tensorflow/compiler/mlir/tensorflow/tests/lower_tf.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ func.func @xdivy(%lhs: tensor<*xf32>, %rhs: tensor<*xf32>) -> tensor<*xf32> {
// CHECK: %[[ZERO:.*]] = "tf.Const"() <{value = dense<0.000000e+00> : tensor<f32>}> : () -> tensor<f32>
// CHECK: %[[IS_ZERO:.*]] = "tf.Equal"(%[[X]], %[[ZERO]]) <{incompatible_shape_error = true}> : (tensor<*xf32>, tensor<f32>) -> tensor<*xi1>
// CHECK: %[[MUL:.*]] = "tf.Div"(%[[X]], %[[Y]]) : (tensor<*xf32>, tensor<*xf32>) -> tensor<*xf32>
// CHECK: %[[RESULT:.*]] = "tf.SelectV2"(%[[IS_ZERO]], %[[X]], %[[MUL]]) : (tensor<*xi1>, tensor<*xf32>, tensor<*xf32>) -> tensor<*xf32>
// CHECK: %[[RESULT:.*]] = "tf.SelectV2"(%[[IS_ZERO]], %[[ZERO]], %[[MUL]]) : (tensor<*xi1>, tensor<f32>, tensor<*xf32>) -> tensor<*xf32>
%0 = "tf.Xdivy"(%lhs, %rhs) : (tensor<*xf32>, tensor<*xf32>) -> tensor<*xf32>
// CHECK: return %[[RESULT]]
func.return %0 : tensor<*xf32>
Expand All @@ -1065,7 +1065,7 @@ func.func @xlog1py(%lhs: tensor<*xf32>, %rhs: tensor<*xf32>) -> tensor<*xf32> {
// CHECK: %[[IS_ZERO:.*]] = "tf.Equal"(%[[X]], %[[ZERO]]) <{incompatible_shape_error = true}> : (tensor<*xf32>, tensor<f32>) -> tensor<*xi1>
// CHECK: %[[LOG:.*]] = "tf.Log1p"(%[[Y]]) : (tensor<*xf32>) -> tensor<*xf32>
// CHECK: %[[MUL:.*]] = "tf.Mul"(%[[X]], %[[LOG]]) : (tensor<*xf32>, tensor<*xf32>) -> tensor<*xf32>
// CHECK: %[[RESULT:.*]] = "tf.SelectV2"(%[[IS_ZERO]], %[[X]], %[[MUL]]) : (tensor<*xi1>, tensor<*xf32>, tensor<*xf32>) -> tensor<*xf32>
// CHECK: %[[RESULT:.*]] = "tf.SelectV2"(%[[IS_ZERO]], %[[ZERO]], %[[MUL]]) : (tensor<*xi1>, tensor<f32>, tensor<*xf32>) -> tensor<*xf32>
%0 = "tf.Xlog1py"(%lhs, %rhs) : (tensor<*xf32>, tensor<*xf32>) -> tensor<*xf32>
// CHECK: return %[[RESULT]]
func.return %0 : tensor<*xf32>
Expand All @@ -1078,7 +1078,7 @@ func.func @xlogy(%lhs: tensor<*xf32>, %rhs: tensor<*xf32>) -> tensor<*xf32> {
// CHECK: %[[IS_ZERO:.*]] = "tf.Equal"(%[[X]], %[[ZERO]]) <{incompatible_shape_error = true}> : (tensor<*xf32>, tensor<f32>) -> tensor<*xi1>
// CHECK: %[[LOG:.*]] = "tf.Log"(%[[Y]]) : (tensor<*xf32>) -> tensor<*xf32>
// CHECK: %[[MUL:.*]] = "tf.Mul"(%[[X]], %[[LOG]]) : (tensor<*xf32>, tensor<*xf32>) -> tensor<*xf32>
// CHECK: %[[RESULT:.*]] = "tf.SelectV2"(%[[IS_ZERO]], %[[X]], %[[MUL]]) : (tensor<*xi1>, tensor<*xf32>, tensor<*xf32>) -> tensor<*xf32>
// CHECK: %[[RESULT:.*]] = "tf.SelectV2"(%[[IS_ZERO]], %[[ZERO]], %[[MUL]]) : (tensor<*xi1>, tensor<f32>, tensor<*xf32>) -> tensor<*xf32>
%0 = "tf.Xlogy"(%lhs, %rhs) : (tensor<*xf32>, tensor<*xf32>) -> tensor<*xf32>
// CHECK: return %[[RESULT]]
func.return %0 : tensor<*xf32>
Expand Down
7 changes: 5 additions & 2 deletions tensorflow/compiler/mlir/tensorflow/transforms/lower_tf.td
Original file line number Diff line number Diff line change
Expand Up @@ -479,17 +479,20 @@ def LowerScatterNdOp :
// Xdivy, Xlog1p and Xlogy op patterns.
//===----------------------------------------------------------------------===//

// Selects zero rather than $x when $x == 0, like BinaryNoNanPat above: $x can
// compare equal to zero without being +0, as -0 does and as a subnormal does
// when denormals are flushed.
class BinaryXopyPat<dag From, dag To> : Pat<
From,
(TF_SelectV2Op
(TF_EqualOp
$x,
(TF_ConstOp
(TF_ConstOp:$zero
(GetScalarOfType<0> $x)
),
/*incompatible_shape_error*/ConstBoolAttrTrue
),
$x,
$zero,
To
)>;

Expand Down
14 changes: 7 additions & 7 deletions tensorflow/core/framework/tensor_testutil_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,23 +226,23 @@ TEST(TensorTestUtilTest, ExpectTensorCloseHalf) {
EXPECT_TRUE(IsClose(static_cast<T>(1.0f), static_cast<T>(1.0f), 0.0, 0.0));
EXPECT_FALSE(IsClose(static_cast<T>(1.0f), static_cast<T>(1.1f), 0.0, 0.0));

// Epsilon: 0 00010 0000000000 -> 2^-13 = 0.0001220703125
// Default Tolerance: 0 00100 0100000000 -> 5/2^13 = 0.0006103515625
// Epsilon: 0 00101 0000000000 -> 2^-10 = 0.0009765625
// Default Tolerance: 5 * 2^-10 = 0.0048828125

// 1.234 -> 0 01111 0011110000 -> 1264/2^10 = 1.234375
// 1.233 -> 0 01111 0011101111 -> 1263/2^10 = 1.2333984375
// 1.235 -> 0 01111 0011110001 -> 1265/2^10 = 1.2353515625
// 1.232 -> 0 01111 0011101110 -> 1262/2^10 = 1.232421875
// 1.236 -> 0 01111 0011110010 -> 1266/2^10 = 1.236328125
// 1/2^10 = 0.0009765625E
// Threshold = 0.0013637542724609375
// 1.200 -> 1229/2^10 = 1.2001953125
// 1.260 -> 1290/2^10 = 1.259765625
EXPECT_TRUE(IsClose(static_cast<T>(1.234f), static_cast<T>(1.234f)));
EXPECT_TRUE(IsClose(static_cast<T>(1.234f), static_cast<T>(1.233f)));
EXPECT_TRUE(IsClose(static_cast<T>(1.234f), static_cast<T>(1.235f)));

// Diff = 0.001953125
EXPECT_FALSE(IsClose(static_cast<T>(1.234f), static_cast<T>(1.232f)));
EXPECT_FALSE(IsClose(static_cast<T>(1.234f), static_cast<T>(1.236f)));
// Diff exceeds default tolerance (atol + rtol * abs(x) ~ 0.0109)
EXPECT_FALSE(IsClose(static_cast<T>(1.234f), static_cast<T>(1.200f)));
EXPECT_FALSE(IsClose(static_cast<T>(1.234f), static_cast<T>(1.260f)));
EXPECT_TRUE(
IsClose(static_cast<T>(1.234f), static_cast<T>(1.232f), 8e-4f, 1e-3f));
EXPECT_TRUE(
Expand Down
4 changes: 3 additions & 1 deletion tensorflow/core/grappler/optimizers/arithmetic_optimizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3309,7 +3309,9 @@ class ConvertPowStage : public ArithmeticOptimizerStage {
node->set_input(1, AsControlDependency(y->name()));
AddToOptimizationQueue(node);
AddToOptimizationQueue(y);
} else if (curr == complex128(-1, 0)) {
} else if (curr == complex128(-1, 0) && !DataTypeIsInteger(pow.dtype())) {
// Integer Pow rejects negative exponents, while integer Reciprocal
// computes 1 / x, so the rewrite is only valid for non-integer types.
node->set_op("Reciprocal");
node->set_input(1, AsControlDependency(y->name()));
AddToOptimizationQueue(node);
Expand Down
33 changes: 33 additions & 0 deletions tensorflow/core/grappler/optimizers/arithmetic_optimizer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ limitations under the License.
#include "tensorflow/core/grappler/optimizers/arithmetic_optimizer.h"

#include <complex>
#include <cstdint>

#include "absl/strings/match.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "tensorflow/cc/ops/array_ops.h"
#include "tensorflow/cc/ops/const_op.h"
#include "tensorflow/cc/ops/math_ops.h"
#include "tensorflow/cc/ops/nn_ops.h"
#include "tensorflow/cc/ops/resource_variable_ops.h"
Expand Down Expand Up @@ -3280,6 +3282,37 @@ TEST_F(ArithmeticOptimizerTest, ConvertPow) {
CompareGraphs(want, got);
}

TEST_F(ArithmeticOptimizerTest, ConvertPowDoesNotRewriteIntegerNegativeOne) {
// Integer Pow rejects negative exponents, so Pow(x, -1) must not become
// Reciprocal(x), which would silently compute 1 / x instead.
tensorflow::Scope s = tensorflow::Scope::NewRootScope();
auto x32 = ops::Const(s.WithOpName("x32"), {-1, 1}, {2});
auto y32 = ops::Const(s.WithOpName("y32"), -1);
auto x64 = ops::Const<int64_t>(s.WithOpName("x64"), {-1, 1}, {2});
auto y64 = ops::Const<int64_t>(s.WithOpName("y64"), {-1, -1}, {2});
Output out32 = ops::Pow(s.WithOpName("out32"), x32, y32);
Output out64 = ops::Pow(s.WithOpName("out64"), x64, y64);

GrapplerItem item;
item.fetch = {"out32", "out64"};
TF_CHECK_OK(s.ToGraphDef(&item.graph));

GraphDef got;
ArithmeticOptimizer optimizer;
EnableOnlyConvertPow(&optimizer);
OptimizeAndPrune(&optimizer, &item, &got);

GraphDef want;
AddNode("x32", "Const", {}, {}, &want);
AddNode("y32", "Const", {}, {}, &want);
AddNode("x64", "Const", {}, {}, &want);
AddNode("y64", "Const", {}, {}, &want);
AddNode("out32", "Pow", {"x32", "y32"}, {}, &want);
AddNode("out64", "Pow", {"x64", "y64"}, {}, &want);

CompareGraphs(want, got);
}

TEST_F(ArithmeticOptimizerTest, Log1p) {
tensorflow::Scope s = tensorflow::Scope::NewRootScope();

Expand Down
5 changes: 3 additions & 2 deletions tensorflow/core/kernels/batching_util/batch_resource_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1081,8 +1081,9 @@ absl::Status BatchResourceBase::ConcatInputTensors(
// the priority queue). If so, skip the output concatenation — the
// output TensorMatrix may contain uninitialized entries that would
// cause a crash in Concat/memcpy.
if (!input_task->status->status().ok()) {
input_task->FinishTask(input_task->status->status());
absl::Status task_status = input_task->status->status();
if (!task_status.ok()) {
input_task->FinishTask(task_status);
return;
}
OpKernelContext* context = input_task->context;
Expand Down
4 changes: 2 additions & 2 deletions tensorflow/core/kernels/batching_util/threadsafe_status.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ limitations under the License.
#include "tensorflow/core/platform/mutex.h"

namespace tensorflow {
const absl::Status& ThreadSafeStatus::status() const& {
absl::Status ThreadSafeStatus::status() const& {
tf_shared_lock lock(mutex_);
return status_;
}

absl::Status ThreadSafeStatus::status() && {
tf_shared_lock lock(mutex_);
mutex_lock lock(mutex_);
return std::move(status_);
}

Expand Down
2 changes: 1 addition & 1 deletion tensorflow/core/kernels/batching_util/threadsafe_status.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace tensorflow {
// When updated in a multi-threading setup, only the first error is retained.
class ThreadSafeStatus {
public:
const absl::Status& status() const& TF_LOCKS_EXCLUDED(mutex_);
absl::Status status() const& TF_LOCKS_EXCLUDED(mutex_);
absl::Status status() && TF_LOCKS_EXCLUDED(mutex_);

// Retains the first error status: replaces the current status with
Expand Down
28 changes: 28 additions & 0 deletions tensorflow/core/kernels/batching_util/threadsafe_status_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ limitations under the License.

#include "tensorflow/core/kernels/batching_util/threadsafe_status.h"

#include <atomic>
#include <thread> // NOLINT(build/c++11)
#include <utility>

#include "tensorflow/core/lib/core/status_test_util.h"
#include "tensorflow/core/platform/errors.h"
#include "tensorflow/core/platform/test.h"
Expand Down Expand Up @@ -47,5 +51,29 @@ TEST(ThreadSafeStatus, Move) {
TF_EXPECT_OK(std::move(status).status());
}

TEST(ThreadSafeStatus, ConcurrentReadAndUpdate) {
ThreadSafeStatus status;
std::atomic<bool> done{false};
std::thread reader([&]() {
while (!done.load(std::memory_order_relaxed)) {
absl::Status s = status.status();
if (!s.ok()) {
EXPECT_EQ(s.code(), error::INTERNAL);
}
}
});

std::thread updater([&]() {
for (int i = 0; i < 1000; ++i) {
status.Update(absl::InternalError("concurrent error"));
}
done.store(true, std::memory_order_relaxed);
});

updater.join();
reader.join();
EXPECT_EQ(status.status().code(), error::INTERNAL);
}

} // namespace
} // namespace tensorflow
6 changes: 3 additions & 3 deletions tensorflow/core/kernels/conv_ops_fused_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ class FusedConv2DOp : public OpKernel {
using FCT = FusedComputationType;

std::vector<FusedComputationPattern> patterns;
if (std::is_same<Device, CPUDevice>::value) {
if (std::is_same_v<Device, CPUDevice>) {
patterns = {
{FCT::kBiasAdd, {"BiasAdd"}},
{FCT::kBiasAddWithRelu, {"BiasAdd", "Relu"}},
Expand All @@ -748,8 +748,8 @@ class FusedConv2DOp : public OpKernel {
// identity activation function, it in theory should allow to fuse
// convolution with BiasAdd, but in practice it doesn't work, cuDNN ignores
// this parameter and always does Relu activation.
if (std::is_same<Device, GPUDevice>::value) {
if (std::is_same<T, int8_t>::value || std::is_same<T, qint8>::value) {
if (std::is_same_v<Device, GPUDevice>) {
if (std::is_same_v<T, int8_t> || std::is_same_v<T, qint8>) {
patterns = {{FCT::kBiasAdd, {"BiasAdd"}},
{FCT::kBiasAddWithRelu, {"BiasAdd", "Relu"}}};
} else {
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/core/kernels/conv_ops_gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int64_t GetDnnWorkspaceLimitOrDefault();
// the kernel finishes.
class DnnScratchAllocator : public se::ScratchAllocator {
public:
virtual ~DnnScratchAllocator() {}
~DnnScratchAllocator() override {}
DnnScratchAllocator(int64_t memory_limit, OpKernelContext* context)
: memory_limit_(memory_limit), total_byte_size_(0), context_(context) {}
int64_t GetMemoryLimitInBytes() override { return memory_limit_; }
Expand Down
6 changes: 3 additions & 3 deletions tensorflow/core/kernels/conv_ops_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ class FusedConv2DOpTest : public OpsTestBase {
static constexpr int kImageBatchCount = 8;

static constexpr bool kIsInt8 =
std::is_same<T, int8_t>::value || std::is_same<T, qint8>::value;
std::is_same_v<T, int8_t> || std::is_same_v<T, qint8>;

using BiasAddGraphRunner =
std::function<void(const Tensor& input_data, const Tensor& filter_data,
Expand Down Expand Up @@ -909,7 +909,7 @@ class FusedConv2DOpTest : public OpsTestBase {

void ExpectMatch(const Tensor& x, const Tensor& y, double atol) {
constexpr bool exact_match =
std::is_same<T, int8_t>::value || std::is_same<T, qint8>::value;
std::is_same_v<T, int8_t> || std::is_same_v<T, qint8>;
if (exact_match) {
test::ExpectEqual(x, y);
} else {
Expand All @@ -926,7 +926,7 @@ class FusedConv2DOpTest : public OpsTestBase {

constexpr int int8_scale = 80;

using ConvT = typename std::conditional<kIsInt8, int8_t, T>::type;
using ConvT = std::conditional_t<kIsInt8, int8_t, T>;
DataType dtype_conv = DataTypeToEnum<ConvT>::v();

TensorShape image_shape{image_batch_count, image_height, image_width,
Expand Down
4 changes: 2 additions & 2 deletions tensorflow/core/kernels/cudnn_rnn_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ class CudnnRnnAllocatorInTemp : public ScratchAllocator {
template <typename T>
class CudnnRnnAllocatorInOutput : public ScratchAllocator {
public:
~CudnnRnnAllocatorInOutput() override {}
~CudnnRnnAllocatorInOutput() override = default;
CudnnRnnAllocatorInOutput(OpKernelContext* context, int output_index)
: context_(context), output_index_(output_index) {}
int64_t GetMemoryLimitInBytes() override {
Expand Down Expand Up @@ -464,7 +464,7 @@ class CudnnRNNSpaceAllocator : public ScratchAllocator {
explicit CudnnRNNSpaceAllocator(OpKernelContext* context)
: context_(context) {}

~CudnnRNNSpaceAllocator() override {}
~CudnnRNNSpaceAllocator() override = default;

int64_t GetMemoryLimitInBytes() override {
return std::numeric_limits<int64_t>::max();
Expand Down
2 changes: 1 addition & 1 deletion tensorflow/core/kernels/cwise_op_leakyrelu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class LeakyReluOp : public OpKernel {
void Compute(OpKernelContext* ctx) override {
const Tensor& inp = ctx->input(0);
Tensor* out = nullptr;
if (std::is_same<Tin, Tout>::value) {
if (std::is_same_v<Tin, Tout>) {
OP_REQUIRES_OK(ctx, ctx->forward_input_or_allocate_output(
{0}, 0, inp.shape(), &out));
} else {
Expand Down
14 changes: 6 additions & 8 deletions tensorflow/core/kernels/cwise_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ struct scalar_arg_op<std::complex<double>> {

template <typename Scalar, typename Exponent>
struct safe_scalar_binary_pow_op {
static_assert(std::is_integral<Scalar>::value, "Integer type expected");
static_assert(std::is_integral<Exponent>::value &&
std::is_signed<Exponent>::value,
static_assert(std::is_integral_v<Scalar>, "Integer type expected");
static_assert(std::is_integral_v<Exponent> && std::is_signed_v<Exponent>,
"Signed integer type expected");

bool* const error;
Expand All @@ -81,7 +80,7 @@ struct functor_traits<safe_scalar_binary_pow_op<Scalar, Exponent>> {

template <typename T, typename DivOrMod>
struct safe_div_or_mod_op {
static_assert(std::is_integral<T>::value, "Integer type expected");
static_assert(std::is_integral_v<T>, "Integer type expected");

bool* const error;

Expand Down Expand Up @@ -377,8 +376,7 @@ struct google_floor_div {
};

template <typename T>
struct google_floor_div<
T, typename std::enable_if<std::is_unsigned<T>::value>::type> {
struct google_floor_div<T, std::enable_if_t<std::is_unsigned_v<T>>> {
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T operator()(const T& x,
const T& y) const {
return x / y;
Expand Down Expand Up @@ -1255,7 +1253,7 @@ struct safe_pow : base<T, Eigen::internal::safe_scalar_binary_pow_op<T, T>> {
// completes; this functor must still produce a defined result on the device.
template <typename T>
struct safe_pow_ignore_error_op {
static_assert(std::is_integral<T>::value, "Integer type expected");
static_assert(std::is_integral_v<T>, "Integer type expected");
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T operator()(const T& x,
const T& y) const {
if (TF_PREDICT_FALSE(y < 0)) {
Expand Down Expand Up @@ -1372,7 +1370,7 @@ struct left_shift_op {
} else if (y_clamped > sizeof(T) * CHAR_BIT - 1) {
y_clamped = sizeof(T) * CHAR_BIT - 1;
}
using U = typename std::make_unsigned<T>::type;
using U = std::make_unsigned_t<T>;
return static_cast<T>(static_cast<U>(x) << static_cast<U>(y_clamped));
}
};
Expand Down
4 changes: 2 additions & 2 deletions tensorflow/core/kernels/cwise_ops_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ class SimpleBinaryOp : public OpKernel {
const Device& eigen_device = ctx->eigen_device<Device>();

Tensor* out = nullptr;
if (std::is_same<Tin, Tout>::value) {
if (std::is_same_v<Tin, Tout>) {
OP_REQUIRES_OK(ctx, ctx->forward_input_or_allocate_output(
{0, 1}, 0, in0.shape(), &out));
} else {
Expand Down Expand Up @@ -316,7 +316,7 @@ class UnaryOp : public OpKernel {
void Compute(OpKernelContext* ctx) override {
const Tensor& inp = ctx->input(0);
Tensor* out = nullptr;
if (std::is_same<Tin, Tout>::value) {
if (std::is_same_v<Tin, Tout>) {
OP_REQUIRES_OK(ctx, ctx->forward_input_or_allocate_output(
{0}, 0, inp.shape(), &out));
} else {
Expand Down
Loading
Loading