-
Notifications
You must be signed in to change notification settings - Fork 0
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
scala 3 api batch 2 #31
Conversation
@@ -5,14 +5,38 @@ import scala.language.implicitConversions | |||
import scala.reflect.ClassTag | |||
|
|||
object PythonUnion { | |||
def convert[X <: py.Any, Y <: py.Any, A <: PythonType[X], B <: PythonType[Y]](u: A | B)(implicit ev1: ClassTag[A], ev2: ClassTag[B]): py.|[X, Y] = | |||
|
|||
def fromPyhtonTypeAndScalaTypeUnion[X <: py.Any, A <: PythonType[X], B <: Any](u: A | B)(implicit ev1: ClassTag[A], ev2: ClassTag[B]): py.|[B, X] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cannot be implicit conversion without some clever type bound on B
because it collides with the one beneath fromPyhtonTypesUnion
dotty-tensorflow/src/main/scala/me/shadaj/scalapy/tensorflow/api/keras/backend/Backend.scala
Show resolved
Hide resolved
...y-tensorflow/src/main/scala/me/shadaj/scalapy/tensorflow/api/keras/layers/MaxPooling2D.scala
Show resolved
Hide resolved
dotty-tensorflow/src/main/scala/me/shadaj/scalapy/tensorflow/api/scalaUtils/PythonUnion.scala
Outdated
Show resolved
Hide resolved
dotty-tensorflow/src/main/scala/me/shadaj/scalapy/tensorflow/api/keras/backend/Backend.scala
Outdated
Show resolved
Hide resolved
...ensorflow/src/main/scala/me.shadaj.scalapy.tensorflow/example/BidirectionalLSTMExample.scala
Outdated
Show resolved
Hide resolved
cleared up git history |
println(s"x_test shape: ${x_test1.shape}") | ||
val xTrain1 = sequence.padSequences(xTrain, maxLen = Some(maxlen)).astype(np.float32) | ||
val xTest1 = sequence.padSequences(xTest, maxLen = Some(maxlen)).astype(np.float32) | ||
val yTrain1 = yTrain.astype(np.float32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you casting interger ({0, 1}?) value to a float?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no generic types implemented in lower layer (scala 2) for now, we picked Float
as a universal type because it was convenient. (created issue to add generic types VirtuslabRnD/scalapy#3 )
But we can use Numeric
in this layer and cast it to Float
when passing to scala 2 layer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made an issue, will take care of that later, It causes build problems
dotty-tensorflow/src/main/scala/me/shadaj/scalapy/tensorflow/api/keras/models/Models.scala
Outdated
Show resolved
Hide resolved
import preprocessing.Preprocessing | ||
import models.Models | ||
import datasets.Datasets | ||
import backend.Backend | ||
class Keras private[api] (val underlying: PyKeras) extends PythonType[PyKeras] with PythonModule { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is for whole PR as well as for other batches -- I'm strongly convinced that exposing public api without a line of comment does not make users' lives easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well thats true, although documentation can be found on tensorflow website.
Anyway we had somewhat inconclusive discussion about this. Lets make an issue #38 :D and don't worry for now.
dotty-tensorflow/src/main/scala/me/shadaj/scalapy/tensorflow/api/scalaUtils/PythonUnion.scala
Show resolved
Hide resolved
dotty-tensorflow/src/main/scala/me/shadaj/scalapy/tensorflow/api/keras/backend/Backend.scala
Outdated
Show resolved
Hide resolved
dotty-tensorflow/src/main/scala/me/shadaj/scalapy/tensorflow/api/keras/datasets/Datasets.scala
Outdated
Show resolved
Hide resolved
...ensorflow/src/main/scala/me.shadaj.scalapy.tensorflow/example/BidirectionalLSTMExample.scala
Outdated
Show resolved
Hide resolved
dotty-tensorflow/src/main/scala/me/shadaj/scalapy/tensorflow/api/keras/layers/LSTM.scala
Show resolved
Hide resolved
dotty-tensorflow/src/main/scala/me/shadaj/scalapy/tensorflow/api/keras/models/Sequential.scala
Outdated
Show resolved
Hide resolved
dotty-tensorflow/src/main/scala/me/shadaj/scalapy/tensorflow/api/keras/models/Sequential.scala
Outdated
Show resolved
Hide resolved
dotty-tensorflow/src/main/scala/me/shadaj/scalapy/tensorflow/api/keras/models/Sequential.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments, approving
to be clear
enums
will be added later.