#pragma once

// @generated by aten/src/ATen/gen.py

#include <THC/THC.h>
#include <THC/THCTensor.hpp>
#include <THCUNN/THCUNN.h>
#undef THNN_
#undef THCIndexTensor_

#include "ATen/Storage.h"
#include "ATen/Context.h"

#include <memory>

namespace at {

struct Allocator;

struct CUDAHalfStorage final : public Storage {
public:
  explicit CUDAHalfStorage(Context* context);
  CUDAHalfStorage(Context* context, THStorage *wrapped);
  CUDAHalfStorage(Context* context, size_t size);
  CUDAHalfStorage(Context* context, size_t size, Allocator* allocator);
  CUDAHalfStorage(Context* context,
    void * data, size_t size, const std::function<void(void*)> & deleter);
  virtual ~CUDAHalfStorage();

  virtual size_t elementSize() const override;
  virtual size_t size() const override;
  virtual void* data() override;
  virtual const void* data() const override;
  virtual CUDAHalfStorage& retain() override;
  virtual CUDAHalfStorage& free() override;
  virtual void * unsafeGetTH(bool retain) const override;

  virtual CUDAHalfStorage& resize(int64_t new_size) override;
  virtual CUDAHalfStorage& fill(Scalar value) override;
  virtual CUDAHalfStorage& set(size_t ind, Scalar value) override;
  virtual CUDAHalfStorage& fast_set(size_t ind, Scalar value) override;
  virtual Scalar get(size_t ind) override;
  virtual Scalar fast_get(size_t ind) override;

  virtual void set_flag(char flag) override;
  virtual void clear_flag(char flag) override;

  virtual Type& type() const override;
  virtual int getDevice() const override;
  virtual const char * toString() const override;

  static const char * typeString();


protected:
  friend struct CUDAHalfType;
  THStorage *storage;
  Context* context;
};

} // namespace at
