Skip to content
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

Add Dot layer #144

Closed
5 tasks
mkaze opened this issue Jun 19, 2021 · 7 comments · Fixed by #275
Closed
5 tasks

Add Dot layer #144

mkaze opened this issue Jun 19, 2021 · 7 comments · Fixed by #275
Assignees
Labels
good first issue Good for newcomers
Milestone

Comments

@mkaze
Copy link
Contributor

mkaze commented Jun 19, 2021

Currently, the support for the Dot layer is missing and it would be great if we could add support for this layer as well. The desired PR addressing this issue should include:

  • Implementation of layer class named as Dot inherited from the AbstractMerge class
  • Documentation of layer.
  • Test cases
  • Support for export of layer to JSON (see ModelSaver.kt)
  • Support for import of layer from JSON (see ModelLoader.kt)

Also, if needed, you can take a look at Keras documentation for this layer.

@zaleslaw zaleslaw added the good first issue Good for newcomers label Jun 21, 2021
@zaleslaw zaleslaw added this to the 0.3 milestone Jun 21, 2021
@zaleslaw
Copy link
Collaborator

Good issue, we could put it on the roadmap

@jyue86
Copy link

jyue86 commented Aug 18, 2021

My friend, @RandyHuynh5815, and I would like to take a shot at this task.

@zaleslaw
Copy link
Collaborator

zaleslaw commented Aug 18, 2021

Hi! @justinyue1643, I assigned it to you, welcome to the KotlinDL!

@zaleslaw
Copy link
Collaborator

Hi, @justinyue1643. Are you going to continue to work on this issue? It will be moved to the 0.4 milestone.

@zaleslaw zaleslaw modified the milestones: 0.3, 0.4 Sep 13, 2021
@zaleslaw
Copy link
Collaborator

Hi @justinyue1643 I'm going to unassign this ticket from you during the next few days, write here if you want to keep it

@therealansh
Copy link
Contributor

Hey @zaleslaw , I could try this one! Does the Ops right now have batch_dot? Also i could not find l2_normalize for normalizing.

@zaleslaw
Copy link
Collaborator

zaleslaw commented Nov 10, 2021

NOTE: Both these operations are implemented in Python using basic TF Ops

l2_normalize is missed because it's implemented in Python fully, we need to implement it in a KotlinDL like here

For example, I've created an implementation of l2_normalize below

fun  l2Normalize(scope: Scope?, x: Operand<Float>, axis: IntArray?): Operand<Float>? {
    val squareSum: Operand<Float> = ReduceSum.create(
        scope,
        Square.create(scope, x),
        Constant.create(scope, axis),
        ReduceSum.keepDims(Boolean.TRUE)
    )
    val invNorm: Operand<Float> = Rsqrt.create(
        scope,
        org.tensorflow.op.math.Maximum.create(
            scope, squareSum, Constant.create(scope, 1e-12f)
        )
    )
    return Mul.create(scope, x, invNorm)
}

Hope the same could be implemented for the batch_dot op, because it's a part of Keras, implemented in Python over the basic TF ops (looks like most of them are available)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants