Skip to content

Added documentation #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion lib/graph.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defmodule Tensorflex.Graph do

@moduledoc false

defstruct [:def, :name]

end
3 changes: 2 additions & 1 deletion lib/matrix.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defmodule Tensorflex.Matrix do

@moduledoc false

defstruct [:nrows, :ncols, :data]

end
2 changes: 2 additions & 0 deletions lib/nifs.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
defmodule Tensorflex.NIFs do
@moduledoc false

@on_load :load_nifs

def load_nifs do
Expand Down
3 changes: 2 additions & 1 deletion lib/tensor.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defmodule Tensorflex.Tensor do

@moduledoc false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be public given that we return it in many examples?

Copy link
Owner Author

@anshuman23 anshuman23 Jul 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that might be counter-intuitive. Since the structs mainly handle the NIF references, I don't think it would be appropriate for users to know about the internal working of the Tensorflex structs. Adding docs for the internal structs might make users think that they can also modify/work with them. Plus there is no code to really document, just the reference wrapping struct.

This is my take on it. What do you think?

PS: I'm merging this PR for now, but in case you think that we should have docs for the structs, I will put in a new PR for them

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the best is to implement Inspect protocol for this to return something opaque. Something like this after the module definition:

defimpl Inspect, for: Tensorflex.Tensor do
  def inspect(data, _opts) do
    "#Tensorflex.Tensor<#{data.datatype}>"
  end
end

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be the best thing to do. I'll add this code to all these side modules in the next PR. Thank you!


defstruct [:datatype, :tensor]

end
Loading