Don't use make_unique to create shared_ptr (#902)

The code compiled because shared_ptr's constructor actually accepts
unique_ptr.
This commit is contained in:
Cheng
2024-03-27 22:13:29 +09:00
committed by GitHub
parent dc175f08d3
commit 90dfa43ff1
8 changed files with 17 additions and 17 deletions

View File

@@ -16,7 +16,7 @@ void test_arg_reduce_small(
std::vector<int> expected_output) {
auto s = default_stream(d);
auto y =
array(out_shape, uint32, std::make_unique<ArgReduce>(s, r, axis), {x});
array(out_shape, uint32, std::make_shared<ArgReduce>(s, r, axis), {x});
y.eval();
const uint32_t* ydata = y.data<uint32_t>();
for (int i = 0; i < y.size(); i++) {
@@ -32,12 +32,12 @@ void test_arg_reduce_against_cpu(
auto y1 = array(
out_shape,
uint32,
std::make_unique<ArgReduce>(default_stream(Device::cpu), r, axis),
std::make_shared<ArgReduce>(default_stream(Device::cpu), r, axis),
{x});
auto y2 = array(
out_shape,
uint32,
std::make_unique<ArgReduce>(default_stream(Device::gpu), r, axis),
std::make_shared<ArgReduce>(default_stream(Device::gpu), r, axis),
{x});
y1.eval();
y2.eval();
@@ -136,7 +136,7 @@ void test_arg_reduce_small_bool(
{2, 3, 4});
x.eval();
auto y =
array(out_shape, uint32, std::make_unique<ArgReduce>(s, r, axis), {x});
array(out_shape, uint32, std::make_shared<ArgReduce>(s, r, axis), {x});
y.eval();
const uint32_t* ydata = y.data<uint32_t>();
for (int i = 0; i < y.size(); i++) {