Skip to content

Commit

Permalink
#13745:fix more cpp files
Browse files Browse the repository at this point in the history
  • Loading branch information
nardoTT committed Dec 4, 2024
1 parent 1b25116 commit 033a48f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "ttnn/operations/data_movement/tilize_with_val_padding/tilize_with_val_padding.hpp"
#include "tt_metal/host_api.hpp"
#include "ttnn/operations/numpy/functions.hpp"
#include "ttnn/cpp/ttnn/operations/experimental/reshape/reshape.hpp"

using namespace tt;
using namespace tt_metal;
Expand All @@ -37,7 +38,7 @@ int main(int argc, char** argv) {
////////////////////////////////////////////////////////////////////////////
ttnn::SimpleShape shape{1, 32, 61, 32};
// Allocates a DRAM buffer on device populated with values specified by initialize
Tensor a = ttnn::numpy::arange<bfloat16>(0, shape.volume(), 1).reshape(shape).to(device);
Tensor a = ttnn::experimental::reshape(ttnn::numpy::arange<bfloat16>(0, shape.volume(), 1), shape).to(device);
Tensor b = ttnn::tilize_with_zero_padding(a);
Tensor c = b.cpu();
////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 4 additions & 2 deletions tests/tt_eager/tensors/test_async_tensor_apis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "ttnn/operations/eltwise/binary/binary.hpp"
#include "ttnn/operations/eltwise/unary/unary.hpp"

#include "ttnn/cpp/ttnn/operations/experimental/reshape/reshape.hpp"

using namespace tt;
using namespace tt_metal;
using namespace constants;
Expand Down Expand Up @@ -61,7 +63,7 @@ TEST_F(DispatchFixture, TestTensorOwnershipSanity) {
},
host_tensor.get_storage());
// Send tensor to device, read it back and copy it to empty tensor initialized by main thread
Tensor reshaped_tensor = host_tensor.reshape(ttnn::SimpleShape{1, 1, 32, 128});
Tensor reshaped_tensor = ttnn::experimental::reshape(host_tensor, ttnn::SimpleShape{1, 1, 32, 128});
auto device_tensor = reshaped_tensor.to(Layout::TILE).to(device);
auto thread_local_tensor = device_tensor.cpu().to(Layout::ROW_MAJOR);
readback_tensor.set_storage(thread_local_tensor.get_storage());
Expand Down Expand Up @@ -282,7 +284,7 @@ TEST_F(DispatchFixture, TestTensorAsyncDataMovement) {
},
host_tensor.get_storage());

Tensor reshaped_tensor = host_tensor.reshape(ttnn::SimpleShape{1, 1, 32, tensor_stop / 32});
Tensor reshaped_tensor = ttnn::experimental::reshape(host_tensor, ttnn::SimpleShape{1, 1, 32, tensor_stop / 32});
auto device_tensor = reshaped_tensor.to(Layout::TILE).to(device);
auto thread_local_tensor = device_tensor.cpu().to(Layout::ROW_MAJOR);
log_info(LogTest, "Worker populating empty host readback_tensor");
Expand Down
5 changes: 2 additions & 3 deletions tests/tt_eager/tensors/test_copy_and_move.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "ttnn/tensor/tensor_impl.hpp"
#include "tt_metal/host_api.hpp"
#include "ttnn/operations/numpy/functions.hpp"
#include "ttnn/cpp/ttnn/operations/experimental/reshape/reshape.hpp"

using namespace tt;
using namespace tt_metal;
Expand All @@ -40,9 +41,7 @@ bool test_tensor_copy_semantics(Device* device) {
pass &= dev_a_data == dev_a_copy_data;

// host tensor updated with host tensor copy assignment
Tensor host_c = ttnn::numpy::arange<bfloat16>(0, tt_metal::compute_volume(single_tile_shape), 1)
.reshape(single_tile_shape)
.to(Layout::TILE);
Tensor host_c = ttnn::experimental::reshape(ttnn::numpy::arange<bfloat16>(0, tt_metal::compute_volume(single_tile_shape), 1), single_tile_shape).to(Layout::TILE);
Tensor host_c_copy = ttnn::numpy::random::random(single_tile_shape).to(Layout::TILE);
host_c_copy = host_c;
auto host_c_data = owned_buffer::get_as<bfloat16>(host_c);
Expand Down

0 comments on commit 033a48f

Please sign in to comment.