Skip to content

Commit

Permalink
Removed name from ngraph tensors (#6446)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov authored Aug 3, 2021
1 parent ebd86e3 commit 344e063
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 55 deletions.
15 changes: 4 additions & 11 deletions ngraph/core/include/ngraph/runtime/host_tensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,10 @@ namespace ngraph
class NGRAPH_API HostTensor : public ngraph::runtime::Tensor
{
public:
HostTensor(const element::Type& element_type,
const Shape& shape,
void* memory_pointer,
const std::string& name = "");
HostTensor(const element::Type& element_type,
const Shape& shape,
const std::string& name = "");
HostTensor(const element::Type& element_type,
const PartialShape& partial_shape,
const std::string& name = "");
HostTensor(const std::string& name = "");
HostTensor(const element::Type& element_type, const Shape& shape, void* memory_pointer);
HostTensor(const element::Type& element_type, const Shape& shape);
HostTensor(const element::Type& element_type, const PartialShape& partial_shape);
HostTensor();
explicit HostTensor(const Output<Node>&);
explicit HostTensor(const std::shared_ptr<op::v0::Constant>& constant);
virtual ~HostTensor() override;
Expand Down
20 changes: 0 additions & 20 deletions ngraph/core/include/ngraph/runtime/tensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,6 @@ namespace ngraph
NGRAPH_DEPRECATED("Only output ports have names")
const std::string& get_name() const;

/// \brief Get the stale value of the tensor. A tensor is stale if its data is
/// changed.
/// \return true if there is new data in this tensor
NGRAPH_DEPRECATED("This method is deprecated and will be removed in 2022.1 release")
bool get_stale() const;

/// \brief Set the stale value of the tensor. A tensor is stale if its data is
/// changed.
NGRAPH_DEPRECATED("This method is deprecated and will be removed in 2022.1 release")
void set_stale(bool val);

/// \brief Write bytes directly into the tensor
/// \param p Pointer to source of data
/// \param n Number of bytes to write, must be integral number of elements.
Expand All @@ -75,15 +64,6 @@ namespace ngraph
/// \param n Number of bytes to read, must be integral number of elements.
virtual void read(void* p, size_t n) const = 0;

/// \brief check tensor for new data, call may block.
/// backends may use this to ensure tensor is updated (eg: lazy eval).
NGRAPH_DEPRECATED("This method is deprecated and will be removed in 2022.1 release")
virtual void wait_for_read_ready() {}
/// \brief notify tensor of new data, call may block.
/// backends may use this as indication of new data in tensor.
NGRAPH_DEPRECATED("This method is deprecated and will be removed in 2022.1 release")
virtual void wait_for_write_ready() {}

protected:
std::shared_ptr<ngraph::descriptor::Tensor> m_descriptor;
bool m_stale;
Expand Down
23 changes: 9 additions & 14 deletions ngraph/core/src/runtime/host_tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ static const size_t alignment = 64;

runtime::HostTensor::HostTensor(const ngraph::element::Type& element_type,
const Shape& shape,
void* memory_pointer,
const string& name)
: runtime::Tensor(std::make_shared<ngraph::descriptor::Tensor>(element_type, shape, name))
void* memory_pointer)
: runtime::Tensor(std::make_shared<ngraph::descriptor::Tensor>(element_type, shape, ""))
, m_memory_pointer(memory_pointer)
{
if (get_partial_shape().is_static() && get_element_type().is_static())
Expand All @@ -31,31 +30,27 @@ runtime::HostTensor::HostTensor(const ngraph::element::Type& element_type,
}
}

runtime::HostTensor::HostTensor(const element::Type& element_type,
const Shape& shape,
const std::string& name)
: HostTensor(element_type, shape, nullptr, name)
runtime::HostTensor::HostTensor(const element::Type& element_type, const Shape& shape)
: HostTensor(element_type, shape, nullptr)
{
}

runtime::HostTensor::HostTensor(const element::Type& element_type,
const PartialShape& partial_shape,
const std::string& name)
: runtime::Tensor(
std::make_shared<ngraph::descriptor::Tensor>(element_type, partial_shape, name))
const PartialShape& partial_shape)
: runtime::Tensor(std::make_shared<ngraph::descriptor::Tensor>(element_type, partial_shape, ""))
, m_buffer_size(0)
{
// Defer allocation until ptr is requested
}

runtime::HostTensor::HostTensor(const std::string& name)
runtime::HostTensor::HostTensor()
: HostTensor(element::dynamic, PartialShape::dynamic())
{
}

NGRAPH_SUPPRESS_DEPRECATED_START
runtime::HostTensor::HostTensor(const Output<Node>& value)
: HostTensor(value.get_element_type(), value.get_partial_shape(), value.get_tensor().get_name())
: HostTensor(value.get_element_type(), value.get_partial_shape())
{
}
NGRAPH_SUPPRESS_DEPRECATED_END
Expand Down Expand Up @@ -93,7 +88,7 @@ void runtime::HostTensor::allocate_buffer()

NGRAPH_SUPPRESS_DEPRECATED_START
runtime::HostTensor::HostTensor(const std::shared_ptr<op::v0::Constant>& constant)
: HostTensor(constant->output(0).get_tensor().get_name())
: HostTensor()
{
initialize(constant);
}
Expand Down
10 changes: 0 additions & 10 deletions ngraph/core/src/runtime/tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,3 @@ const std::string& runtime::Tensor::get_name() const
return m_descriptor->get_name();
NGRAPH_SUPPRESS_DEPRECATED_END
}

bool runtime::Tensor::get_stale() const
{
return m_stale;
}

void runtime::Tensor::set_stale(bool val)
{
m_stale = val;
}

0 comments on commit 344e063

Please sign in to comment.